Adidibau wrote: Its the description for the Variants the Customer need there is some specific guidelines for customer on the different Variants
Hi,
Yes, not simple to understand the first time
Mohamed gives you something which can't work in the email. So please, don't use it.
The new templating system for the email is very flexible but we split the code and the design in two files.
You can still put some PHP code in the email but you can't mix the templating and the PHP like that.
In the file "your_email_name.preload.php" you will find this code
if($group){
foreach($data->cart->products as $j => $optionElement){
if($optionElement->order_product_option_parent_id != $item->order_product_id) continue;
$item->order_product_price +=$optionElement->order_product_price;
$item->order_product_tax +=$optionElement->order_product_tax;
$item->order_product_total_price+=$optionElement->order_product_total_price;
$item->order_product_total_price_no_vat+=$optionElement->order_product_total_price_no_vat;
$t .= '<p class="hikashop_order_option_name">' . $optionElement->order_product_name;
if($optionElement->order_product_price>0){
if($config->get('price_with_tax')){
$t .= ' ( + '.$currencyHelper->format($optionElement->order_product_price+$optionElement->order_product_tax,$data->order->order_currency_id).' )';
}else{
$t .= ' ( + '.$currencyHelper->format($optionElement->order_product_price,$data->order->order_currency_id).' )';
}
}
$t .= '</p>';
}
}
$cartProduct['PRODUCT_NAME'] = $t;
It put the "options" under the product name when the options are grouped.
You have to use the same kind of code in order to load the product description, but per product option.
$optionElement->product_id : will gives you the product id for the selected variant.
So you can add few lines
if($optionElement->order_product_price>0){
if($config->get('price_with_tax')){
$t .= ' ( + '.$currencyHelper->format($optionElement->order_product_price+$optionElement->order_product_tax,$data->order->order_currency_id).' )';
}else{
$t .= ' ( + '.$currencyHelper->format($optionElement->order_product_price,$data->order->order_currency_id).' )';
}
// begin of lines to add
if(empty($productClass)) $productClass = hikashop_get('class.product');
$fullProduct = $productClass->get($optionElement->product_id);
$t .= '<br/>' . $fullProduct->product_description;
// end of lines to add
}
to add the description for each product option.
Hope it will help you.
Regards,