'; $category_max=$i+1; $content.='
'.zen_get_category_name($cate_array[$i], (int)$_SESSION['languages_id']).'
'.zen_image(DIR_WS_IMAGES . zen_get_categories_image($cate_array[$i]), '',410, 310).'

'.zen_get_category_name($cate_array[$i], (int)$_SESSION['languages_id']).'

'; $index_cate_tree_sql="select c.categories_id, cd.categories_name,cd.categories_description, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and c.categories_status=1 " . " and c.parent_id='".$cate_array[$i]."' and cd.language_id = '" . (int)$_SESSION['languages_id'] . "' " ." order by c.parent_id, c.sort_order, cd.categories_name limit 6"; $categories = $db->Execute($index_cate_tree_sql); $cid=''; while (!$categories->EOF) { $cid.=$categories->fields['categories_id'].' '; $cpath='cPath='.$cate_array[$i].'_'.$categories->fields['categories_id']; $content.=''; $categories->MoveNext(); } // categories_description $cid=ereg_replace(' ',',',trim($cid)); $content.=''; $content.='
'; if($cid){ $index_cate_product_sql = "select distinct p.products_id, p.products_image, pd.products_name, p.product_is_always_free_shipping, p.master_categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and p.products_status = 1 and p.master_categories_id in(".$cid.") and pd.language_id = '" . (int)$_SESSION['languages_id'] . "' order by p.products_id desc limit 10"; }else{ $index_cate_product_sql = "select distinct p.products_id, p.products_image, p.product_is_always_free_shipping, pd.products_name, p.master_categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and p.products_status = 1 and p.master_categories_id in(".$cate_array[$i].") and pd.language_id = '" . (int)$_SESSION['languages_id'] . "' order by p.products_id desc limit 10"; } $index_cate_products = $db->Execute($index_cate_product_sql); while (!$index_cate_products->EOF) { $products_price = zen_get_products_display_price($index_cate_products->fields['products_id']); $products_butt = ''; $products_revies = ''; if (!empty($_SESSION['compare']) && in_array($index_cate_products->fields['products_id'],$_SESSION['compare'])) { $compare_display =''; }else{ $compare_display =''; } $count_stars_query = "select count(reviews_rating) as num, avg(reviews_rating) as aver from " . TABLE_REVIEWS . " where products_id = '" . (int)$index_cate_products->fields['products_id'] . "'"; $count_stars = $db->Execute($count_stars_query); $starnum = round($count_stars->fields['aver']); $star = array("","","","",""); if($count_stars->fields['num']>=1){ $reviews_display =''. $star[$starnum-1] .'
('.$count_stars->fields['num'].')
'; }else{ $reviews_display ='
(0 '.')
'; } if(zen_get_products_special_price($index_cate_products->fields['products_id'])){ $ps_dd=true; } else{ $ps_dd=false; } $feat_sql=$db->Execute("select * from ".TABLE_FEATURED." where products_id=".$index_cate_products->fields['products_id']); if($feat_sql->RecordCount()>0){ $pf_dd=true; }else{ $pf_dd=false; } if($index_cate_products->fields['product_is_always_free_shipping']){ $free_dd=true; }else{ $free_dd=false; } if($ps_dd&&$pf_dd&&$free_dd){ $dd='Sale Hot'; } else if(($ps_dd&&$pf_dd)||($pf_dd&&$free_dd)||($ps_dd&&$free_dd)){ if($ps_dd&&$pf_dd){ $dd='Sale Hot'; }else if($pf_dd&&$free_dd){ $dd=' '; }else if($ps_dd&&$free_dd){ $dd='Sale'; } } else if($ps_dd){ $dd='Sale'; } else if($pf_dd){ $dd=''; } else if($free_dd){ $dd=''; } else{ $dd=''; } $content.='

' .zen_trunc_string($index_cate_products->fields['products_name'],60) . '

'.$products_price.'
'. $reviews_display.'
'.$dd.'
'; $index_cate_products->MoveNext(); } $content.=' '; echo $content; } ?>