Jump to content

How to fill an array products correctly?


Recommended Posts

How to fill an array products if products of category with id=7 correctly?

I tried this method:

function smarty_function_myprod($params, &$smarty)
   {
       global $smarty, $cookie;        
               $category = new Category(7);
       $products = $category->getProducts(6, NULL, NULL, "name", "asc");
       $smarty->assign(array("products1" => $products));

}



But after calling of function myprod the array products1 is empty:(

What's wrong?

Link to comment
Share on other sites

How to fill an array products if products of category with id=7 correctly?

I tried this method:

function smarty_function_myprod($params, &$smarty)
   {
       global $smarty, $cookie;        
               $category = new Category(7);
       $products = $category->getProducts(6, NULL, NULL, "name", "asc");
       $smarty->assign(array("products1" => $products));

}



But after calling of function myprod the array products1 is empty:(

What's wrong?




function smarty_function_myprod($params, &$smarty)
   {
         global $smarty, $cookie;        
             $category = new Category($params['cat'], intval($params['cookie']->id_lang));
         $products = $category->getProducts($params['cookie']->id_lang, 1, 1, 'position', 'ASC', false, true, true, 4);
             $smarty->assign(array("myproducts" => $products));

}

Link to comment
Share on other sites

×
×
  • Create New...