Post by yasasi » Mon Jul 06, 2020 4:32 pm

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.

Attachments

manufacturer.png

manufacturer.png (38.72 KiB) Viewed 259 times


Newbie

Posts

Joined
Sat May 09, 2020 3:29 pm

Post by OSWorX » Mon Jul 06, 2020 6:07 pm

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.

Custom Development | Individuelle Entwicklung | Support & Bugfixes

Image Image Image


User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by yasasi » Sat Jul 25, 2020 1:28 am

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

Newbie

Posts

Joined
Sat May 09, 2020 3:29 pm
Who is online

Users browsing this forum: No registered users and 26 guests