麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

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

ecshop后臺添加虛擬銷量以及前臺顯示銷量

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

1.在sq執行語句

ALTER TABLE `ecs_goods` ADD `sales_volume_base` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'

INSERT INTO `ecs_shop_config` (`parent_id`, `code`, `type`, `store_range`, `store_dir`, `value`, `sort_order` ) VALUES ('7','show_goods_sales', 'select', '1,0', '', '1', '1');

INSERT INTO `ecs_shop_config` (`parent_id`, `code`, `type`, `store_range`, `store_dir`, `value`, `sort_order` ) VALUES ('3', 'show_sales_type', 'select', '1,0', '', '1', '1');

注意:如果你的數據表前綴不是‘ecs_’ 請自行修改

2./admin/includes/lib_goods.php中

$sql = "SELECT goods_id, goods_name, goods_type, goods_sn, shop_price, is_on_sale, is_best, is_new, is_hot, sort_order, goods_number, integral, " .

" (promote_price > 0 AND promote_start_date <= '$today' AND promote_end_date >= '$today') AS is_promote ".

" FROM " . $GLOBALS['ecs']->table('goods') . " AS g WHERE is_delete='$is_delete' $where" .

" ORDER BY $filter[sort_by] $filter[sort_order] ".

" LIMIT " . $filter['start'] . ",$filter[page_size]";

修改為

$sql = "SELECT goods_id, goods_name, goods_type, goods_sn, shop_price, is_on_sale, is_best, is_new, is_hot, sort_order, goods_number, integral, sales_volume_base, " .

" (promote_price > 0 AND promote_start_date <= '$today' AND promote_end_date >= '$today') AS is_promote ".

" FROM " . $GLOBALS['ecs']->table('goods') . " AS g WHERE is_delete='$is_delete' $where" .

" ORDER BY $filter[sort_by] $filter[sort_order] ".

" LIMIT " . $filter['start'] . ",$filter[page_size]";

3./admin/templates/goods_list.htm,在

{if $use_storage}

<th><a href="javascript:listTable.sort('goods_number'); ">{$lang.goods_number}</a>{$sort_goods_number}</th>

{/if}

后,添加

<th><a href="javascript:listTable.sort('sales_volume_base'); ">{$lang.sales_volume_base}</a>{$sort_sales_volume_base}</th>

{if $use_storage}

<td align="right"><span onclick="listTable.edit(this, 'edit_goods_number', {$goods.goods_id})">{$goods.goods_number}</span></td>

{/if}

后,添加

<td align="center"><span onclick="listTable.edit(this, 'edit_sales_volume_base', {$goods.goods_id})">{$goods.sales_volume_base}</span></td>

4./admin/goods.php,在

/**

* 列表鏈接

* @param bool $is_add 是否添加(插入)

* @param string $extension_code 虛擬商品擴展代碼,實體商品為空

* @return array('href' => $href, 'text' => $text)

*/

function list_link($is_add = true, $extension_code = '')

前,添加

/*------------------------------------------------------ */

//-- 修改商品虛擬銷量

/*------------------------------------------------------ */

elseif ($_REQUEST['act'] == 'edit_sales_volume_base')

{

check_authz_json('goods_manage');

$goods_id = intval($_POST['id']);

$sales_volume_base = json_str_iconv(trim($_POST['val']));

if ($exc->edit("sales_volume_base = '$sales_volume_base', last_update=" .gmtime(), $goods_id))

{

clear_cache_files();

make_json_result(stripslashes($sales_volume_base));

}

}

5.goods.php,在

$smarty->assign('categories', get_categories_tree($goods['cat_id'])); // 分類樹

后,添加

$smarty->assign('sales_count', get_sales_count($goods_id));

在末尾添加

/* 商品累計銷量帶自定義_新增加 */

function get_sales_count($goods_id)

{

/* 查詢該商品的自定義銷量 */

$sales_base = $GLOBALS['db']->getOne('SELECT sales_volume_base FROM '.$GLOBALS['ecs']->table('goods').' WHERE goods_id = '.$goods_id);

/* 查詢該商品的實際銷量 */

$sql = 'SELECT IFNULL(SUM(g.goods_number), 0) ' .

'FROM ' . $GLOBALS['ecs']->table('order_info') . ' AS o, ' .

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

"WHERE o.order_id = g.order_id " .

"AND o.order_status " . db_create_in(array(OS_CONFIRMED, OS_SPLITED)) .

"AND o.shipping_status " . db_create_in(array(SS_SHIPPED, SS_RECEIVED)) .

" AND o.pay_status " . db_create_in(array(PS_PAYED, PS_PAYING)) .

" AND g.goods_id = '$goods_id'";

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

/* 商品累計銷量默認顯示方式 */

if ($GLOBALS['_CFG']['show_sales_type'])

{

$row['sales_volume_total'] = $sales_count; //實際銷量

}

else

{

$row['sales_volume_total'] = $sales_base + $sales_count; //自定義銷量+實際銷量

}

return ($row['sales_volume_total']);

}

6.在/languages/zh_cn/admin/shop_config.php,中

/languages/zh_cn/admin/shop_config.php

下,添加

$_LANG['cfg_name']['show_goods_sales'] = '是否顯示商品累計銷量';

$_LANG['cfg_range']['show_goods_sales']['1'] = '顯示';

$_LANG['cfg_range']['show_goods_sales']['0'] = '不顯示';

$_LANG['cfg_name']['show_sales_type'] = '商品累計銷量默認顯示方式';

$_LANG['cfg_range']['show_sales_type'][1] = '真實顯示';

$_LANG['cfg_range']['show_sales_type'][0] = '虛擬顯示';

7./languages/zh_cn/admin/goods.php,中

$_LANG['goods_sn_exists'] = '您輸入的貨號已存在,請換一個';

后,添加

$_LANG['sales_volume_base'] = '虛擬銷量';

8./languages/zh_cn/common.php,中

$_LANG['divided_into'] = '分成規則';

后,添加

$_LANG['sales_volume_total'] = '累計銷量:';

$_LANG['pcs'] = '件';

9./themes/default/goods.dwt,在

<img src="images/stars{$goods.comment_rank}.gif" alt="comment rank {$goods.comment_rank}" />

</dd>

后,添加

{if $cfg.show_goods_sales}

<dd style="width:48%; padding-left:7px;">

<strong>{$lang.sales_volume_total}</strong>

<font class="shop">{$sales_count}{if $goods.measure_unit}{$goods.measure_unit}{else}{$lang.pcs}{/if}</font>

</dd>

{/if}

OK,完成!

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 亚洲成人福利网站 | 黄色一级片在线观看 | 欧美福利视频一区二区三区 | 久久久久91视频 | 龙的两根好大拔不出去h | 成人精品一区二区三区中文字幕 | 最新久久免费视频 | 久久久婷婷一区二区三区不卡 | 成人毛片免费在线 | 天堂在线资源av | 天天干干| 一级看片免费视频 | 91精品观看91久久久久久国产 | 狠狠干夜夜草 | 毛片中文字幕 | 九九视频精品在线观看 | 黄色片网站免费在线观看 | 欧美 日本 在线 | 亚洲精品一二三区 | 精品国产高清一区二区三区 | 精品一区二区免费视频视频 | 56av国产精品久久久久久久 | 9191色| 羞羞答答xxdd在线播放 | 欧美91看片特黄aaaa | 欧美高清视频一区 | www.99av| 神马顶级推理片免费看 | 欧美偷拍一区二区 | 九草视频| 美女福利视频国产 | 国产亚洲精品久久久久久久久 | 欧美性视频一区二区 | 日韩av片在线播放 | 黄网站在线观 | 污片视频网站 | 九草视频 | 免费国产自久久久久三四区久久 | 深夜网站在线观看 | 精品久久久久久久久久久下田 | 黑人一区二区三区四区五区 |