Custom variables from cash on delivery module in ps_mailalerts

Good evening, I bought the module "Cash on delivery with fee" and installed it in my e-commerce with prestashop 1.7, everything works fine and you did a very great job, I would need just one little thing: to use cod variables in ps_mailalerts module as well as I use in standard e-mails. There is a quick way to do that? Sorry for my not-good english, I hope is understandable. Regards.

Answer about Custom variables from cash on delivery module in ps_mailalerts prestashop

Hello
Without modification of mail alerts module it is not possible to use non-default variables. (Mail alerts module does not have any kind of feature to include some custom variables).

So, all non-default variables that other modules uses - requires a modification of ps_emailalerts.php file.
it will be required to add there functions:
publicstaticfunction getCodFeeByOrderID($id_order)
{
return Db::getInstance()->getRow('SELECT id_currency, codfee FROM ' . _DB_PREFIX_ . 'orders WHERE id_order = ' . $id_order);
}
publicstaticfunction getCodFeeTaxByOrderID($id_order)
{
return Db::getInstance()->getRow('SELECT id_currency, codfeetax FROM ' . _DB_PREFIX_ . 'orders WHERE id_order = ' . $id_order);
}

then to $template_vars variable add additional variables:
'{total_fee}' => $this->getCodFeeByOrderID((int)$params['order']->id),
'{total_fee_tax}' => $this->getCodFeeTaxByOrderID((int)$params['order']->id),
only then you will be able to use these variables in ps_emailalerts module.
Share on Google Plus

About VEKIA

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment

0 comments:

Post a comment