Jump to content

Product list in custom email template


Recommended Posts

Hi,
i try to get variables from order_conf into my custom email template. I need to change prices after client order and then send him e-mail with product list with new values by changing status.

 

I get some values like {total_products}, {total_discounts}, {total_shipping} by editing Mail.php and add $summary = Context::getContext()->cart->getSummaryDetails(); , but i can't get carrier, payment and product list.
Can anybody help me?
Here is my code from Mail.php 

		 		 if($template == 'przelew'){
					 $summary = Context::getContext()->cart->getSummaryDetails();

       
	   
	   //
	   $template_vars['{delivery_block_html}'] = $summary['formattedAddresses'];
	   $template_vars['{carrier}'] = $summary['delivery_state'];
	   $template_vars['{payment}'] = $summary['payment'];
	   
	   //$template_vars['{products}'] = print_r($summary);

	   $template_vars['{discounts}'] = $summary['discounts'];
	   $template_vars['{total_products}'] = $summary['total_products'];
	   $template_vars['{total_discounts}'] = $summary['total_discounts'];
		$template_vars['{total_shipping}'] = $summary['total_shipping'];

		 }

and code displayed after uncomment print_r and enabled dev mode

Array ( [{lastname}] => MyLastname [{firstname}] => MyFirstname [{id_order}] => 180 [{order_name}] => 2017/01/180 [{total_paid}] => 208,45 zł [{message}] => [{delivery_block_html}] => Array ( [delivery] => Array ( [ordered] => Array ( [0] => firstname lastname [1] => company [2] => vat_number [3] => address1 [4] => address2 [5] => numer_mieszkania [6] => postcode city [7] => Country:name [8] => phone_mobile ) [formated] => Array ( [firstname] => MyFirstname [lastname] => MyLastname [company] => [vat_number] => [address1] => Testowa 22 [address2] => [numer_mieszkania] => [postcode] => 12345 [city] => bialy [Country:name] => Polska [phone_mobile] => 123456789 ) [object] => Array ( [id_customer] => 2 [id_manufacturer] => 0 [id_supplier] => 0 [id_warehouse] => 0 [id_country] => 14 [id_state] => 0 [country] => Polska [alias] => My address [company] => [lastname] => MyLastname [firstname] => MyFirstname [address1] => Testowa 22 [address2] => [postcode] => 12345 [city] => bialy [other] => [phone] => +48 89 758 50 62 [phone_mobile] => 123456789 [vat_number] => [dni] => [date_add] => 2016-11-30 18:10:32 [date_upd] => 2016-12-08 13:50:41 [deleted] => 0 [id] => 6 [force_id] => ) ) [invoice] => Array ( [ordered] => Array ( [0] => firstname lastname [1] => company [2] => vat_number [3] => address1 [4] => address2 [5] => numer_mieszkania [6] => postcode city [7] => Country:name [8] => phone_mobile ) [formated] => Array ( [firstname] => MyFirstname [lastname] => MyLastname [company] => [vat_number] => [address1] => Testowa 22 [address2] => [numer_mieszkania] => [postcode] => 12345 [city] => bialy [Country:name] => Polska [phone_mobile] => 123456789 ) [object] => Array ( [id_customer] => 2 [id_manufacturer] => 0 [id_supplier] => 0 [id_warehouse] => 0 [id_country] => 14 [id_state] => 0 [country] => Polska [alias] => My address [company] => [lastname] => MyLastname [firstname] => MyFirstname [address1] => Testowa 22 [address2] => [postcode] => 12345 [city] => bialy [other] => [phone] => +48 89 758 50 62 [phone_mobile] => 123456789 [vat_number] => [dni] => [date_add] => 2016-11-30 18:10:32 [date_upd] => 2016-12-08 13:50:41 [deleted] => 0 [id] => 6 [force_id] => ) ) ) [{carrier}] => [{products}] => [{payment}] => ) 
Link to comment
Share on other sites

Thanks for answer.
How can i use this in my custom mail template? (template is for custom Order Status and it's sending after status change)

 

Adding some code like this in  Mail.php?

 

      function validateOrder($id_cart, $id_order_state, $amount_paid, $payment_method = 'Unknown',
        $message = null, $extra_vars = array(), $currency_special = null, $dont_touch_amount = false,
        $secure_key = false, Shop $shop = null)
    {
		$productListHtml = $this->getEmailTemplateContent('order_conf_product_list.tpl', Mail::TYPE_HTML, $productVarTplList);
	}

My Prestashop version: 1.6.1.9

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