Skip to content

Commit

Permalink
update ecjia-pc theme module
Browse files Browse the repository at this point in the history
  • Loading branch information
王正东 committed Jan 28, 2021
1 parent 3b5d5ed commit b2c21fb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
23 changes: 10 additions & 13 deletions content/themes/ecjia-pc/extras/controller/goods_controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public static function show()

if (!ecjia_front::$controller->is_cached('goods_show.dwt', $cache_id)) {
$goods_id = !empty($_GET['goods_id']) ? intval($_GET['goods_id']) : 0;
$goods_info = RC_DB::table('goods')->where('goods_id', $goods_id)->select('goods_id', 'store_id', 'goods_name', 'market_price', 'shop_price', 'promote_price', 'goods_thumb', 'goods_desc', 'cat_id', 'keywords', 'goods_brief')->first();
$goods_info = RC_DB::table('goods')->where('goods_id', $goods_id)->select('goods_id', 'store_id', 'goods_name', 'market_price', 'shop_price', 'promote_price', 'goods_thumb', 'goods_desc', 'cat_id', 'keywords', 'goods_brief', 'sales_volume')->first();

$has_store = pc_function::has_store();
ecjia_front::$controller->assign('has_store', $has_store);
Expand Down Expand Up @@ -234,8 +234,9 @@ public static function show()
$store_id = $goods_info['store_id'];

$favourable_result = RC_Api::api('favourable', 'store_favourable_list', array('store_id' => $store_id));

$favourable_list = array();
if (!empty($favourable_result)) {
$favourable_list = array();
foreach ($favourable_result as $val) {
if ($val['act_range'] == '0') {
$favourable_list[] = array('name' => $val['act_name'], 'type' => $val['act_type'] == '1' ? 'price_reduction' : 'price_discount', 'type_label' => $val['act_type'] == '1' ? __('满减') : __('满折'));
Expand All @@ -249,8 +250,11 @@ public static function show()
$favourable_list[] = array('name' => $val['act_name'], 'type' => $val['act_type'] == '1' ? 'price_reduction' : 'price_discount', 'type_label' => $val['act_type'] == '1' ? __('满减') : __('满折'));
break;
case 3:
$favourable_list[] = array('name' => $val['act_name'], 'type' => $val['act_type'] == '1' ? 'price_reduction' : 'price_discount', 'type_label' => $val['act_type'] == '1' ? __('满减') : __('满折'));
break;
//优惠活动范围为指定商品时
if (in_array($goods_id, $act_range_ext)) {
$favourable_list[] = array('name' => $val['act_name'], 'type' => $val['act_type'] == '1' ? 'price_reduction' : 'price_discount', 'type_label' => $val['act_type'] == '1' ? __('满减') : __('满折'));
break;
}
default:
break;
}
Expand Down Expand Up @@ -280,15 +284,8 @@ public static function show()
$cat_str = pc_function::get_cat_str($goods_info['cat_id'], $level);
$goods_info['cat_html'] = pc_function::get_cat_html($cat_str);

$sale_num = RC_DB::table('order_goods as og')
->leftJoin('order_info as oi', RC_DB::raw('oi.order_id'), '=', RC_DB::raw('og.order_id'))
->where(RC_DB::raw('oi.store_id'), $store_id)
->whereIn(RC_DB::raw('oi.order_status'), array(OS_CONFIRMED, OS_SPLITED))
->where(RC_DB::raw('oi.shipping_status'), SS_RECEIVED)
->whereIn(RC_DB::raw('oi.pay_status'), array(PS_PAYED, PS_PAYING))
->select(RC_DB::raw('SUM(og.goods_number) AS goods_num'))
->first();
$goods_info['order_amount'] = !empty($sale_num['goods_num']) ? $sale_num['goods_num'] : 0;

$goods_info['sales_volume'] = !empty($goods_info['sales_volume']) ? $goods_info['sales_volume'] : 0;

$check_spec_url = RC_Uri::url('goods/index/check_spec');
ecjia_front::$controller->assign('check_spec_url', $check_spec_url);
Expand Down
2 changes: 1 addition & 1 deletion content/themes/ecjia-pc/goods_show.dwt.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
</div>

{/if}
<p class="sold_out"><span>{t domain="ecjia-pc"}已售{/t}</span><span class="sales">{$goods_info.order_amount}</span></p>
<p class="sold_out"><span>{t domain="ecjia-pc"}已售{/t}</span><span class="sales">{$goods_info.sales_volume}</span></p>
<!-- {foreach from=$goods_info.specification item=value key=key} -->
{if $value.attr_type eq 1}
<span class="standard">{$value.name}</span>
Expand Down

0 comments on commit b2c21fb

Please sign in to comment.