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

首頁 > 網站 > 建站經驗 > 正文

ecshop首頁和分類頁調用商品貨號的解決辦法

2024-04-25 20:42:19
字體:
來源:轉載
供稿:網友

小編給大家介紹在日常中如何使用ecshop首頁和分類頁調用商品貨號的解決辦法.分享給大家供大家參考。具體如下:

找到網站根目錄下面的includes目錄,打開之后找到lib_goods.php文件,打開之后找到

/**

* 獲得推薦商品

*

* @access public

* @param string $type 推薦類型,可以是 best, new, hot, promote

* @return array

*/

function get_recommend_goods($type = '', $cats = '')

{

if (!in_array($type, array('best', 'new', 'hot', 'promote')))

{

return array();

}

$time = gmtime();

 

$order_type = 0;

/* 取得每一項的數(shù)量限制 */

$type2lib = array('best'=>'recommend_best', 'new'=>'recommend_new', 'hot'=>'recommend_hot', 'promote'=>'recommend_promotion');

$num = get_library_number($type2lib[$type]);

$sql = 'SELECT g.goods_id, g.goods_name, g.goods_name_style, g.market_price, g.shop_price AS org_price, g.promote_price, ' .

"IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, ".

"promote_start_date, promote_end_date, g.goods_brief, g.goods_thumb, goods_img, b.brand_name, " .

"g.is_best, g.is_new, g.is_hot, g.is_promote, RAND() AS rnd " .

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

'LEFT JOIN ' . $GLOBALS['ecs']->table('brand') . ' AS b ON b.brand_id = g.brand_id ' .

"LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp ".

"ON mp.goods_id = g.goods_id AND mp.user_rank = '$_SESSION[user_rank]' ".

'WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 ';

1。上面這段代碼,在在goods_id 后添加 goods_sn,改后如下

$sql = 'SELECT g.goods_id, g.goods_sn, g.goods_name, g.goods_name_style, g.market_price, g.shop_price AS org_price, g.promote_price, ' .

"IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, ".

"promote_start_date, promote_end_date, g.goods_brief, g.goods_thumb, goods_img, b.brand_name, " .

"g.is_best, g.is_new, g.is_hot, g.is_promote, RAND() AS rnd " .

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

'LEFT JOIN ' . $GLOBALS['ecs']->table('brand') . ' AS b ON b.brand_id = g.brand_id ' .

"LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp ".

"ON mp.goods_id = g.goods_id AND mp.user_rank = '$_SESSION[user_rank]' ".

'WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 ';

2.在后面不遠處 添加代碼$goods[$idx]['goods_sn'] = $row['goods_sn'];,改后如下

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

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

$goods[$idx]['brief'] = $row['goods_brief'];

$goods[$idx]['goods_sn'] = $row['goods_sn'];

$goods[$idx]['brand_name'] = $row['brand_name'];

$goods[$idx]['goods_style_name'] = add_style($row['goods_name'],$row['goods_name_style']);

3.接下來在你使用的風格的library中,修改recommend_best.lbi,增加{$goods.goods_sn}在需要顯示位置就可以了。recommend_new.lbi,recommend_hot.lbi都是一樣。

4.分類頁的解決辦法。其實跟上面的一樣,大家先到根目錄下找到category.php,打開找到

function category_get_goods($children, $brand, $min, $max, $ext, $size, $page, $sort, $order)

{

$display = $GLOBALS['display'];

$where = "g.is_on_sale = 1 AND g.is_alone_sale = 1 AND ".

"g.is_delete = 0 AND ($children OR " . get_extension_goods($children) . ')';

if ($brand > 0)

{

$where .= "AND g.brand_id=$brand ";

}

if ($min > 0)

{

$where .= " AND g.shop_price >= $min ";

}

if ($max > 0)

{

$where .= " AND g.shop_price <= $max ";

}

/* 獲得商品列表 */

$sql = 'SELECT 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";

在g.goods_id字段后面增加g.goods_sn,同時在下面不遠處跟上面的相似,增加$arr[$row['goods_id']]['goods_sn'] = $row['goods_sn'];程序部分修改了,接下來大家自己去修改相應風格的模板,增加{$goods.goods_sn}在需要顯示位置就可以了。

搜索頁是一樣的道理,只要修改search.dwt和search.php即可

希望本文所述對大家設計有所幫助

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 海林市| 凌云县| 宁强县| 新田县| 商都县| 洛阳市| 沙坪坝区| 雷山县| 吉安县| 嘉善县| 时尚| 和林格尔县| 祁东县| 安康市| 印江| 报价| 阜康市| 巴塘县| 内黄县| 长沙县| 哈尔滨市| 呼伦贝尔市| 汉川市| 姜堰市| 交口县| 临潭县| 永州市| 石柱| 新密市| 襄垣县| 德惠市| 鄱阳县| 吉木萨尔县| 南木林县| 托克托县| 响水县| 尉氏县| 夏邑县| 泊头市| 罗平县| 海安县|