Jump to content

Variables in ps_emailalerts.php


Felkio

Recommended Posts

FIRST OF ALL: Sorry for my not-good english. If something is not understandable let me know, and I will try to explain it better!

Good evening, I am having some issues with prestashop 1.7 and an external module.

I bought a module to add a fee on cash on delivery, this module got some e-mail variables, like {total_fee} or {total_fee_tax}. It takes this values from database, table ps_orders, values "codfee" and "codfeetax".

In standard mails (located in /themes/themename/mails/it/) the variables works properly, but with the e-mail alerts module (/modules/ps_emailalerts) that variables does NOT work at all.

I ask to the developer if he could help me and he sent me 2 functions to include in /modules/ps_emailalerts/ps_emailalerts.php

 

public static function getCodFeeByOrderID($id_order)
        {
        return Db::getInstance()->getRow('SELECT id_currency, codfee FROM ' . _DB_PREFIX_ . 'orders WHERE id_order = ' . $id_order);
        }

public static function getCodFeeTaxByOrderID($id_order)
        {
        return Db::getInstance()->getRow('SELECT id_currency, codfeetax FROM ' . _DB_PREFIX_ . 'orders WHERE id_order = ' . $id_order);
        }

and these 2 variables in the same file

 

            '{total_fee}' => $this->getCodFeeByOrderID((int)$params['order']->id),
            '{total_fee_tax}' => $this->getCodFeeTaxByOrderID((int)$params['order']->id),


But unfortunately, something don't work properly! Testing it I see that both variables give the same result "1" instead of the expected "€4" for {total_fee} and "€0.88" for {total_fee_tax}

What's wrong?
I hope that somebody help me

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