Several community users report the following issue:
After deleting one product in the catalog grid table, the product information in the invoice and orders is disappeared automatically.
Yesterday, I tested the feature according to their report in the administrator. The result was frustrated for me. The issue is really existed in TomatoCart:
Product information shown in the order
Deleting the product in the products grid
Now, the product is disappeared in the orders
This is a fatal issue. I guess the developer implemented this feature with a mistake ago. After checking the code, I find the reason of this issue:
It is due to that the products table and orders products table in the database is linked. In fact, it is unnecessary to link them because the product information was already stored in the orders products table.
Steps to fix this issue in your store administrator
1. Open admin > includes > classes > order.php file under admin panel > Tools > File Manager module.
2. Find following code snippet in the file:
$Qproducts = $osC_Database->query('select op.orders_products_id, op.products_id, op.products_type, op.products_name, op.products_sku, op.products_price, op.products_tax, op.products_quantity, op.products_return_quantity, op.final_price, p.products_weight, p.products_weight_class, p.products_tax_class_id from :table_orders_products op, :table_products p where p.products_id = op.products_id and orders_id = :orders_id'); $Qproducts->bindTable(':table_orders_products', TABLE_ORDERS_PRODUCTS); $Qproducts->bindTable(':table_products', TABLE_PRODUCTS); $Qproducts->bindInt(':orders_id', $this->_order_id); $Qproducts->execute();
Replace it with:
$Qproducts = $osC_Database->query('select op.orders_products_id, op.products_id, op.products_type, op.products_name, op.products_sku, op.products_price, op.products_tax, op.products_quantity, op.products_return_quantity, op.final_price from :table_orders_products op where orders_id = :orders_id'); $Qproducts->bindTable(':table_orders_products', TABLE_ORDERS_PRODUCTS); $Qproducts->bindInt(':orders_id', $this->_order_id); $Qproducts->execute();
Continue to find following code snippet:
$product = array('id' => $Qproducts->valueInt('products_id'), 'orders_products_id' => $Qproducts->valueInt('orders_products_id'), 'type' => $Qproducts->valueInt('products_type'), 'quantity' => $Qproducts->valueInt('products_quantity'), 'return_quantity' => $Qproducts->valueInt('products_return_quantity'), 'name' => $Qproducts->value('products_name'), 'sku' => $Qproducts->value('products_sku'), 'tax' => $Qproducts->value('products_tax'), 'tax_class_id' => $Qproducts->value('products_tax_class_id'), 'price' => $Qproducts->value('products_price'), 'final_price' => $Qproducts->value('final_price'), 'weight' => $Qproducts->value('products_weight'), 'tax_class_id' => $Qproducts->value('products_tax_class_id'), 'weight_class_id' => $Qproducts->value('products_weight_class'));
Replace it with:
$product = array('id' => $Qproducts->valueInt('products_id'), 'orders_products_id' => $Qproducts->valueInt('orders_products_id'), 'type' => $Qproducts->valueInt('products_type'), 'quantity' => $Qproducts->valueInt('products_quantity'), 'return_quantity' => $Qproducts->valueInt('products_return_quantity'), 'name' => $Qproducts->value('products_name'), 'sku' => $Qproducts->value('products_sku'), 'tax' => $Qproducts->value('products_tax'), 'tax_class_id' => $Qproducts->value('products_tax_class_id'), 'price' => $Qproducts->value('products_price'), 'final_price' => $Qproducts->value('final_price'));
That’s it. After replacing the original code as above, the issue will be cleared.
Final Words
If you need help, same thing, drop me a message via email or Skype. I’d be glad to help.
Email: support@tomatocart.com
Skype: tocjack
Looking for quality web hosting? Look no further than Arvixe Web Hosting!