{ if(!empty($cat_id['id'])) $categories[] = $cat_id['id']; } $i++; } return $categories; }*/ // ---------------------------------------------------------------------------------------------- // /*function List_Product_By_Category( $category_id, $offset=0, $limit=DEFAULT_PAGER_LIMIT ) { if( empty( $category_id ) ) { return array(); } $categories = FindSubCategories( $category_id ); $categories_string = implode(',', $categories); $query = 'SELECT * FROM products WHERE product_category in ('; $query .= $categories_string; $query .= ") AND deleted='0' ORDER BY created_date DESC LIMIT $offset,$limit"; return MySQLSELECT($query); }*/ // ---------------------------------------------------------------------------------------------- // $product_list = List_Product_By_Category(1, 0, 100); // pd($Product_List); // $smarty = new SmartyEx; $smarty->assign("product_list", $product_list); $smarty->display('product_list3.tpl');
<?php require_once 'init.php'; $product_list = List_Product_By_Category($cat_id, 0, 100); if (count($product_list) % 2 != 0) { $product_list = array_pad($product_list, count($product_list) + 1, array('product_id' => '')); } $rows = array_chunk($product_list, 2); // pd($Product_List); // $smarty = new SmartyEx; $smarty->assign("rows", $rows); $smarty->assign("product_count", count($product_list)); $product_list = $smarty->fetch('product_list.tpl');