ecshop 首頁呼叫指定分類下的銷售排行

2022-09-16 23:54:15 字數 2276 閱讀 9984

/*

首頁呼叫指定分類下的銷售排行

*/function get_cats_top10($cat = '')

$sql = 'select g.goods_id, g.goods_brief, g.goods_name, g.goods_img, g.goods_thumb, g.shop_price, g.promote_price, g.promote_start_date, g.promote_end_date, sum(og.goods_number) as goods_number ' .

'from ' . $globals['ecs']->table('goods') . ' as g, ' .

$globals['ecs']->table('order_info') . ' as o, ' .

$globals['ecs']->table('order_goods') . ' as og ' .

"where g.is_on_sale = 1 and g.is_alone_sale = 1 and g.is_delete = 0 $where

$top10_time ";

//判斷是否啟用庫存,庫存數量是否大於0

if ($globals['_cfg']['use_storage'] == 1)

$sql .= ' and og.order_id = o.order_id and og.goods_id = g.goods_id ' .

"and o.order_status = '" . os_confirmed . "' " .

"and (o.pay_status = '" . ps_payed . "' or o.pay_status = '" . ps_paying . "') " .

"and (o.shipping_status = '" . ss_shipped . "' or o.shipping_status = '" . ss_received . "') " .

'group by g.goods_id order by goods_number desc, g.goods_id desc limit ' . $globals['_cfg']['top_number'];

$arr = $globals['db']->getall($sql

);

foreach ($arr

as$row1

)

else}}

return

$cat_arr;}

/*首頁呼叫指定分類下的銷售排行

*/

模板呼叫處方法:

<

div

class

="box"

>

<

div

class

="box_2"

>

<

h3><

span

>

span

>

h3>

<

div

class

="top10list clearfix"

>

<

ul class

="clearfix"

>

<

img

src="../images/top_.gif"

class

="iteration"

/>

<

li class

="topimg"

>

<

a href

=""><

img

src=""

alt=""

class

="samllimg"

/>

a>

li>

<

li class

="iteration1"

>

<

a href

=""title

="">

a><

br />

<

font

class

="f1"

>

font

><

br />

li>

ul>

div>

div>

div>

<

div

class

="blank5"

>

div>

ecshop首頁呼叫某分類下的商

ecshop首頁呼叫某分類下的商品 assign cat goods 同盟者 同盟者微群 歡迎有夢想有激情的年輕人加入 ecshop首頁呼叫分類下的商品其實很簡單,也有模板設定那裡可以設定,不過那個只可以用cat goods.lib,不方便,所以我想看看怎麼能簡單的實現ecshop首頁呼叫分類下的商...

ecshop呼叫指定分類的文章

舉例如首頁呼叫方法 1 先開啟index.php檔案找到以下 在它下面增加以下 呼叫方法 smarty assign class articles 4 index get class articles 4,6 分類呼叫文章 呼叫多個就修改傳進去的引數,以及模板接收的變數,其中上面的4就是文章分類id...

ecshop呼叫指定分類ID的下級分類

第一步 開啟 lib goods.php 最後加上以下函式 呼叫商品分類指定分類下級分類 function get parent id tree parent id return three c arr 第二步 宣告後用 smarty呼叫,就是在 index.php 中加上下面一句 注意這裡加的位置...