la_ostia Posted January 28, 2016 Share Posted January 28, 2016 Hi all. We have a client with an ERP and a very specific price for customers . We have a connector between the ERP and Prestashop which care about customers, addresses and updated articles ; Additional tables in a data store , for example, customer code , reference, price, OriginalPrice and discount. We made a overrride of product.php at priceCalculation, which returns the discounted price to our customers. But i need to show originalPrice and discount too. I made another function to obtain this fields: public static function PrecioAnterior($id_product){ $sql = new DbQuery(); $sql->select('reference'); $sql->from('product', 'p'); $sql->where('p.`id_product` = '.(int)$id_product); $res = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql); if (is_array($res) && count($res)) { foreach ($res as $row) { $reference = $row["reference"]; } } $sql = new DbQuery(); $sql->select('original_price'); $sql->from('e_prices', 'p'); $sql->where('p.`ref_product` = '.(int)$reference.' AND p.`customer` = '.(int)$id_customer); $original_price = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql); return $original_price[0][original_price]; } And from product.tpl: {Product::PrecioAnterior(Tools::getvalue('id_product'))} My issue is with $id_costumer, which always is set to 0 From smarty i can get id_costumer from $customer = $cookie->id_customer But it don't works in Product.php and i don't see how can i send it from tpl to function Link to comment Share on other sites More sharing options...
la_ostia Posted January 28, 2016 Author Share Posted January 28, 2016 Solved. From tpl {Product::PrecioAnterior(Tools::getvalue('id_product'),$cart->id_customer)} Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now