Jump to content

PS 1.7 Add if on sale/ product discount column in order confirmation email temple


prus

Recommended Posts

Prestashop 1.7.6.4

 

Hi everyone! 

I need to add new column to order information email.  I already added photo icon and separate unit price tax exluded column.

I know that:

1. I need to create a new variable in  override/classes/PaymentModule.php file  after  " foreach ($order->product_list as $product) { " 

2.  Assign  it to  "   $product_var_tpl = array(  "  

3. call it in email temple  themes/yourtheme/mails/en/order_conf_product_list.tpl  plus handle the table in   themes/themeclothes/mails/en/order_conf.tpl by adding new column. 

BUT, i do not know how create a new variable that will have information: if product is on sale (YES/NO) or store product discount percentage ( 20% ) or show price before discount ( 230 )

Can anyone can help me to write a code or point where i can find example of that variable?  like :

$price = Product::getPriceStatic((int) $product['id_product'], false, ($product['id_product_attribute'] ? (int) $product['id_product_attribute'] : null), 6, null, false, true, array($product['cart_quantity'], $product['cart_quantity_fractional']), false, (int) $order->id_customer, (int) $order->id_cart, (int) $order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}, $specific_price, true, true, null, true, $product['id_customization']);

 

When I make a recipe, I have to add discount to every product separately. I can't use total amount of discounts. So when custommer is using a promo code that affected only no-discounted  products but ordered both discounted and no-discouted products i have to check  mannualy every product if it is on sale or no. 

Stay healthy,

Jakub

Link to comment
Share on other sites

Can you explain me what happened in this  code?  How to modify it to get price without tax?

  $unit_price = Product::getTaxCalculationMethod($customer->id) == PS_TAX_EXC ? $product['product_price'] : $product['product_price_wt'];

 

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...