商品栏目的问题

2016-07-07 15:43 来源:www.chinab4c.com 作者:ecshop专家

商品栏目页 category

如何在商品栏目页判断栏目的ID呢??

我这样写有错误
{foreach from=$goods_list item=goods}
{if $goods.cat_id == 14}
栏目ID=14
{else}
fales
{/if}
{/foreach}


请教下老大在模板中应该怎么去写呢 ??很急麻烦了谢谢 !!!!!!!!!!!!

回答:
category_get_goods()函数中。修改sql语句为
$sql = 'SELECTg.cat_id,g.goods_id, g.goods_name, g.goods_name_style, g.market_price, g.is_new, g.is_best, g.is_hot, g.shop_price AS org_price, ' .
"IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, g.promote_price, g.goods_type, " .
'g.promote_start_date, g.promote_end_date, g.goods_brief, g.goods_thumb , g.goods_img ' .
'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' .
'LEFT JOIN ' . $GLOBALS['ecs']->table('member_price') . ' AS mp ' .
"ON mp.goods_id = g.goods_id AND mp.user_rank = '$_SESSION[user_rank]' " .
"WHERE $where $ext ORDER BY $sort $order";

或者

{foreach from=$goods_list item=goods}
{if $category == 14}
栏目ID=14
{else}
fales
{/if}
{/foreach}


这样也可以。