dazfx Posted May 1, 2011 Share Posted May 1, 2011 Function that is called in product-list.php.{mycat id_product_my=$product.id_product}In this form, write a line above, the variable($product.id_product) is not passed to function:({$product.id_product} return right result as id.{mycat id_product_my=15} return right result as categories of product with id(15).What's wrong?------------------------------------------------------------------------------------------------------php funct:function smarty_compiler_mycat($params, &$smarty){$id_product_my = $params['id_product_my'];$ret = "";if ($row = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT cl.`name` FROM `'._DB_PREFIX_.'category_lang` cl LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON cl.`id_category` = cp.`id_category` WHERE cp.`id_product` = '.(int)$id_product_my) ) foreach ($row as $val) { $ret .= $val['name']." "; } return $ret;}It need to use function except compiler in the name of function smarty_compiler_mycat($params, &$smarty) 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