日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > php >内容正文

php

php商品状态精品 热销,ecshop商品列表,商品页,热销,精品,搜索列表页调用商品销售量(已销售数量)-ECSHOP教程网...

發布時間:2024/3/12 php 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 php商品状态精品 热销,ecshop商品列表,商品页,热销,精品,搜索列表页调用商品销售量(已销售数量)-ECSHOP教程网... 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

ecshop各個頁面調用商品銷售量方法(原創可用)ECSHOP模板

首頁的推薦商品包括熱銷推薦和促銷三個文件

只對熱銷商品為例

第一步:打開根目錄/includes/lib_goods.php文件。在文件末尾添加方法

function selled_count($goods_id)

{

$sql= "select sum(goods_number) as count from ".$GLOBALS['ecs']->table('order_goods')."where goods_id ='".$goods_id."'";

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

if($res>0)

{

return $res;

}

else

{

return('0');

}

}

第二步:搜索get_recommend_goods方法

在這個方法中找到這句話

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

在這句話下添加?$goods[$idx]['count']??????????? = selled_count($row['goods_id']);

第三步:在模版的library/recommend_hot.lbi中在需要的地方添加

售出 {$goods.count}

首頁分類下的商品,實現“已售出”。

第一步:分類下商品也需要修改lib_goods.php。找到分類下的商品

assign_cat_goods方法。在

$goods[$idx]['url']????????? = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);句話下添加

$goods[$idx]['count']??????????? = selled_count($row['goods_id']);

第二步:需要修改模版文件/library/cat_goods.lbi。在需要的地方添加

銷售量:{$goods.count}

在商品分類頁面調用已售出

第一步:修改根目錄下category.php

找到category_get_goods方法

函數中foreach循環添加

$arr[$row['goods_id']]['count']? ?? ?? ?? ?= selled_count($row['goods_id']);

第二步:文件的最后部分添加函數

function selled_count($goods_id)

{

$sql= "select sum(goods_number) as count from ".$GLOBALS['ecs']->table('order_goods')."where goods_id ='".$goods_id."'";

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

if($res>0)

{

return $res;

}

else

{

return('0');

}

}

第三步:

在模版文件goods_list.lbi中需要的地方添加

銷售量:{$goods.count}

說明:搜索頁面需要修改search.php

在搜索頁面調用已售出多少件

第一步:打開根目錄/search.php

在最后加上

function selled_count($goods_id)

{

$sql= "select sum(goods_number) as count from ".$GLOBALS['ecs']->table('order_goods')."where goods_id ='".$goods_id."'";

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

if($res>0)

{

return $res;

}

else

{

return('0');

}

}

方法

第二步:在頁面搜索

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

在下面添加

$arr[$row['goods_id']]['count']? ?? ?? ?? ?= selled_count($row['goods_id']);

第三步:打開模版文件/search.dwt在需要的地方調用。銷售量:{$goods.count}

總結

以上是生活随笔為你收集整理的php商品状态精品 热销,ecshop商品列表,商品页,热销,精品,搜索列表页调用商品销售量(已销售数量)-ECSHOP教程网...的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。