Jump to content

order_conf mail - show Features depend on category


Recommended Posts

Hi i need to show in order_conf.html one feature depending of product category.
I have this done in my shopping-cart by this code:

{if $product.category =="category1" OR $product.name=="product1"}
{assign var='features' value=Product::getFrontFeaturesStatic($cookie->id_lang, $product.id_product)}
{foreach from=$features item=feature}
 {if $feature.name|escape:'htmlall':'UTF-8' == 'Cena za kg'}
  <p class="our_price_display2" itemprop="offers" itemscope itemtype="http://schema.org/Offer">
  <span>{$feature.value|escape:'htmlall':'UTF-8'}</span>    
  </p>
 {/if}
{/foreach}
{elseif $product.category =="pakiety"}
-
{/if}

Can someone help me to use this in confirmation e-mail to customer?

Link to comment
Share on other sites

The order confirmation mail is sent through the validateOrder() function in the PaymentModule.php class, in case you want to add some changes to the order confirmation mail then you have to create a separate TPL file containing the HTML you want to add and then pass that HTML content (after fetching it from the TPL file) as a template variable for your order confirmation mail.

Link to comment
Share on other sites

I found solution for categories, but i can't get future for each product.

Can someone please help me modify this code, to get feature for each product not for only with id=1?

$myprod = new Product($product['id_product']);
$features = $myprod->getFrontFeatures(1);
{
	foreach ($feature as $key => $value) 
	{
		if($value == "Cena za kg")
		{
			$kilogram = $feature['value'];
		}
	}
}

i somebody need it, here is solution for category depending in e-mail

 

Prestashop 1.6.1.9

File: PaymentModule.php

About line 465

                        $product_var_tpl = array(
                            'reference' => $product['reference'],
                            'name' => $product['name'].(isset($product['attributes']) ? ' - '.$product['attributes'] : ''),
                            'unit_price' => Tools::displayPrice($product_price, $this->context->currency, false),
                            'price' => Tools::displayPrice($product_price * $product['quantity'], $this->context->currency, false),
                            'quantity' => $product['quantity'],
                            'customization' => array(),
			'category' => $product['id_category_default'] //add category id

                        );

File: order_conf_product_list.tpl
 

{if $product['category'] =="12"}
show something
{/if}
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...