Jump to content

Discount percent problem for importing products from xml


bloods

Recommended Posts

hi, sorry for my english

i am moved from woocommerce to prestashop, i am using xml from my suppliers

i am importing products with normal price and discounted price (for striked old price) but prestashop is not automatically calculate the discount percent, therefore in product page normal price is not showing up, only showing discounted price

how to solve this?

example: 119$ is normal price (be striked), 80$ discounted price

product shows only 80$ price, not show 119$  -  80$

Edited by bloods (see edit history)
Link to comment
Share on other sites

And you can't calculate percentages from two prices?

// price 119

// discount price 80

$percentage = ((80 / 119) * 100);

// result 67.22689076%

 

$product = new Product((int)$id_product);

$product->price = $xml_price;

$product->reduction_price = $xml_discount_price;

$product->reduction_percent = $percentage;

$product->reduction_from = '2021-02-15';

$product->reduction_to = '2021-05-15';

$product->update();

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...