function get_price_discounted($prod_id)
{
//get first the discount of an item
$sql1 ='SELECT reduction
FROM '._DB_PREFIX_.'specific_price
WHERE id_product = '.$prod_id ;
$discount = Db::getInstance()->getValue($sql1);
//get the current price of an item
$sql2 ='SELECT price
FROM '._DB_PREFIX_.'product
WHERE id_product = '.$prod_id ;
$priceOrig = Db::getInstance()->getValue($sql2);
//return the discounted value of a product
return $discountedPrice = ($priceOrig - ($priceOrig * $discount));
}
//use the function and assign it to a TPL variable
'discounted_price' => $this->get_price_discounted(Tools::getValue('id_product'));
Labels
- bootstrap (1)
- css (4)
- jquery (16)
- Live Demo (14)
- Others (2)
- PHP (4)
- prestashop 1.6 (7)
- Topic - Advance (7)
- Topic - basic (27)
- Topic - Semi Advance (16)
- wordpress (6)
- wordpress plugins (1)
- YII (14)
Saturday, October 4, 2014
Total discounted price code in prestashop
By the default, The discounted price is not always available on any page when it is needed. In this tutorial, i will show you how to query the discounted price. i created a function that can be use on any controller if you need to get the discounted price.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment