Post by MrBasic » Mon Jul 26, 2021 6:37 pm

Hi,

We are importing prices to oc_product.inkoop
I have a SQL script that is updating the price depending category ID. This is running fine.

My question:
How can I edit the script so it's updating the prices for all products in all the child categories?

Sample structure:
test = category id 77
test > test1 > test2 > test3

I need to update also: test1, test2, test3 prices.
Now only test is updated.

The below sample is for updating the price of products in a parent category.

Code: Select all

$sql = "UPDATE oc_product, oc_product_to_category
SET oc_product.price = ROUND (oc_product.inkoop * 1.10,2)
WHERE oc_product.product_id = oc_product_to_category.product_id
AND oc_product_to_category.category_id = 77;";
Thank you!

User avatar
Newbie

Posts

Joined
Wed Sep 23, 2020 11:52 pm
Location - Amersfoort

Post by straightlight » Mon Jul 26, 2021 7:56 pm

MrBasic wrote:
Mon Jul 26, 2021 6:37 pm
Hi,

We are importing prices to oc_product.inkoop
I have a SQL script that is updating the price depending category ID. This is running fine.

My question:
How can I edit the script so it's updating the prices for all products in all the child categories?

Sample structure:
test = category id 77
test > test1 > test2 > test3

I need to update also: test1, test2, test3 prices.
Now only test is updated.

The below sample is for updating the price of products in a parent category.

Code: Select all

$sql = "UPDATE oc_product, oc_product_to_category
SET oc_product.price = ROUND (oc_product.inkoop * 1.10,2)
WHERE oc_product.product_id = oc_product_to_category.product_id
AND oc_product_to_category.category_id = 77;";
Thank you!
OC version. Better use an import extension from the Marketplace to achieve this, such as: https://www.opencart.com/index.php?rout ... sion_id=17 . However, I am not sure how many indents can be used with this import / export tool so you may want to try on a test database before using the data in production. As an alternative, you could always create a new service request in the Commercial Support section of the forum, or contact me directly via the forum PM, to get this done as a custom job.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: Bing [Bot] and 99 guests