ajnglagla Posted February 24, 2014 Share Posted February 24, 2014 (edited) I am trying to show product favorite count on my product page (inside the favoriteproducts module's tpl file) But i dont know how to call a function from php and show it in a tlp file. I have tried to assign val with different ways but it always return "0" or null. I will be very happy if you show me the right way. FavoriteProduct.php public static function FavoriteProductsCount($id_product) { $favorite_count = Db::getInstance()->getValue(' SELECT COUNT(*) FROM `'._DB_PREFIX_.'favorite_product` WHERE `id_product` = '.(int)$id_product ); return $favorite_count; } Edited February 24, 2014 by ajnglagla (see edit history) Link to comment Share on other sites More sharing options...
ajnglagla Posted February 24, 2014 Author Share Posted February 24, 2014 I have found my answer here finally, http://www.prestashop.com/forums/topic/251934-solved-how-to-call-the-function-and-display-the-result-from-tpl-file-in-prestashop/?hl=how+call+function&do=findComment&comment=1253560 Thank you Vekia Link to comment Share on other sites More sharing options...
Recommended Posts