Hi all, When I am editing email template (in Localization > translates > translate email message) I can use some variable like {firstname} or {order_name}. My question is How can i add new variable to template, exactly: cart id. I found file OrderHistory.php. In this file, in line 386 there is addWithemail() function. I have an idea that add some code to this function.
public function addWithemail($autodate = true, $template_vars = false, Context $context = null)
{
[.....]
if (isset($result['template']) && Validate::isEmail($result['email']))
{
ShopUrl::cacheMainDomainForShop($order->id_shop);
$topic = $result['osname'];
$data = array(
'{lastname}' => $result['lastname'],
'{firstname}' => $result['firstname'],
'{id_order}' => (int)$this->id_order,
'{id_cart}' => (int) $order->id_cart, //my modification
'{order_name}' => $order->getUniqReference()
);
if ($template_vars)
$data = array_merge($data, $template_vars);
if ($result['module_name'])
{
$module = Module::getInstanceByName($result['module_name']);
if (Validate::isLoadedObject($module) && isset($module->extra_mail_vars) && is_array($module->extra_mail_vars))
$data = array_merge($data, $module->extra_mail_vars);
[......................]
}
Is my modification correct?
thanks in advance