Hi,
Can please someone help me with DATABASE code?
I have combined two stores into 1, so I have now multiple manufacturers and different products are assigned to them from each store. Before I can delete the duplicates, I need to assign the right id to right products. So..
If manufacturer id is 11
And the same manufacturer is 57
How can I assign a right manufacturer to a products that have 57 id, but needs to be 11 now.
Can you send me the right code so I can run in SQL?
First check that you're selecting the right products:
Then AFTER BACKING UP YOUR DATABASE, you can add an update in there:
Sometimes to be safe you can add LIMIT 1 to the end so even worst case it only affects one row.
Code: Select all
SELECT * FROM `ocuy_product`
WHERE manufacturer_id = 5
Code: Select all
UPDATE * FROM `ocuy_product`
SET manufacturer_id = 11
WHERE manufacturer_id = 5
UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk
OK.If anyone needs this - this is the command and back up the DB before you are doing this
255 is the new, or existing manufacturer_id which you need to assign to the product and 5 is the manufacturer_id which you later will delete/remove
Got help from stackoverflow
Code: Select all
UPDATE `oc_product` SET manufacturer_id = 255 WHERE manufacturer_id = 5
Got help from stackoverflow
What are you talking about, this is the answer I gave you aboveideep13 wrote: ↑Wed Feb 03, 2021 7:05 pmOK.If anyone needs this - this is the command and back up the DB before you are doing this255 is the new, or existing manufacturer_id which you need to assign to the product and 5 is the manufacturer_id which you later will delete/removeCode: Select all
UPDATE `oc_product` SET manufacturer_id = 255 WHERE manufacturer_id = 5
Got help from stackoverflow
UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk
Who is online
Users browsing this forum: mattltm and 322 guests