国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 網(wǎng)站 > 建站經(jīng)驗(yàn) > 正文

ECSHOP調(diào)用指定商品分類(lèi)

2024-04-25 20:41:24
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

首先是復(fù)制一個(gè) index.php 文件,更名為 chengkao.php ,這次最模板采用ecshop做的一個(gè)頻道,因此就用成考的拼音來(lái)命名吧。

一、搜索 index.dwt 替換為 chengkao.dwt

二、把以下代碼粘貼到文件倒數(shù)第二行的位置,</?> 的前面,非特定。

/**

* 獲得指定分類(lèi)商品列表。

*/

function cat_goods_list($cat_id)

{

$sql = 'SELECT g.goods_id, g.goods_name, g.goods_name_style, g.market_price, g.shop_price, g.goods_thumb , g.goods_img, g.cat_id ' .

'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' .

"WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 AND g.cat_id = ".$cat_id . " ORDER by g.goods_id DESC LIMIT 12" ;

$res = $GLOBALS['db']->getAll($sql);

$goods = array();

foreach ($res AS $idx => $row)

{

$goods[$idx]['id'] =$row['goods_id'];

$goods[$idx]['name'] =$row['goods_name'];

$goods[$idx]['market_price'] =price_format($row['market_price']);

$goods[$idx]['shop_price'] =price_format($row['shop_price']);

$goods[$idx]['thumb'] = empty($row['goods_thumb']) ? $GLOBALS['_CFG']['no_picture'] : $row['goods_thumb'];

$goods[$idx]['goods_img'] = empty($row['goods_img']) ? $GLOBALS['_CFG']['no_picture'] : $row['goods_img'];

$goods[$idx]['url'] = build_uri('goods' , array('gid' => $row['goods_id']), $row['goods_name']);

}

return $goods;

}

三、已經(jīng)說(shuō)得有點(diǎn)傻了。然后把下面的調(diào)用復(fù)制到合適位置。

$smarty->assign('catid_39', cat_goods_list (39)); //專(zhuān)升本

$smarty->assign('catid_40', cat_goods_list (40)); //高升本專(zhuān)

$smarty->assign('catid_152', cat_goods_list (152)); //專(zhuān)插本

這里可以看出調(diào)用了三個(gè)分類(lèi)。

四、復(fù)制一個(gè) index.dwt 文件,改名為 chengkao.dwt 。復(fù)制以下代碼到合適地方,事實(shí)只要修改cat_goods.lbi 文件中的一些 smarty 調(diào)用就行了。這樣就不需要重新整什么模版了。

<div class="module clearfix">

<h3> <a >成考高升本專(zhuān)</a></h3>

<ul>

<!--{foreach from=$catid_39 item=cat_goods}-->

<li>

<p><a href="{$cat_goods.url}"><img src="{$cat_goods.thumb}" alt="{$cat_goods.name|escape:html}" /></a></p>

<p><a href="{$cat_goods.url}" title="{$cat_goods.name|escape:html}">{$cat_goods.name|escape:html}}</a></p>

<!-- {if $cat_goods.promote_price neq ""} -->

{$lang.promote_price}<span>{$cat_goods.promote_price}</span><br />

<!-- {else}-->

{$lang.shop_price}<span>{$cat_goods.shop_price}</span><br />

<!--{/if}-->

</li>

<!--{/foreach}-->

</ul>

</div>

發(fā)表評(píng)論 共有條評(píng)論
用戶(hù)名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 乌拉特前旗| 定兴县| 德昌县| 青海省| 酉阳| 洛浦县| 施秉县| 涿鹿县| 子洲县| 綦江县| 宣城市| 阿合奇县| 南开区| 正定县| 忻州市| 锡林郭勒盟| 衡山县| 南川市| 安义县| 莒南县| 长海县| 汉阴县| 荆门市| 南安市| 黎城县| 郧西县| 托克逊县| 崇左市| 元江| 恩平市| 邮箱| 长汀县| 三亚市| 灵璧县| 惠安县| 盐山县| 双江| 普兰店市| 丹巴县| 循化| 铜川市|