Page 1 of 1

How to add manufacturer name to the 'Shopping Cart' table

Posted: Mon Jul 06, 2020 4:32 pm
by yasasi
I need to add Manufucaturer name instead the product-model to the Shopping Cart table in 'view Cart' page.

I believe we need to add the manufacturer name to the 'order_product' table as the first step.

I have added this code to catalog/model/checkout/order

Code: Select all

                $this->db->query("INSERT INTO " . DB_PREFIX . "order_product SET order_id = '" . (int)$order_id . "', product_id = '" . (int)$product['product_id'] . "', name = '" . $this->db->escape($product['name']) . "', model = '" . $this->db->escape($product['model']) . "', manufacturer = '" . $this->db->escape($product['manufacturer']) . "', quantity = '" . (int)$product['quantity'] . "', price = '" . (float)$product['price'] . "', total = '" . (float)$product['total'] . "', tax = '" . (float)$product['tax'] . "', reward = '" . (int)$product['reward'] . "'");
But it was not saved to the DB.

Re: How to add manufacturer name to the 'Shopping Cart' table

Posted: Mon Jul 06, 2020 6:07 pm
by OSWorX
First of all, you should never change core tables.
Create a new table and save the additonal data in there.

Second, if the field does not exist (here manufacturer) you can save whatever you want, it will never be stored.

Re: How to add manufacturer name to the 'Shopping Cart' table

Posted: Sat Jul 25, 2020 1:28 am
by yasasi
Hi,

Thanks alot for you advice.
I got this sorted.
I altered order_product table to add the new column 'manufacturer'.
Anyways issue was that Cart was getting data from system->library where I was thinking its retrieving data directly from the model class. Once i change the system->library->cart file everything was working