Beispiel #1
0
        $_SESSION['pin_yin'] = $region['pin_yin'];
        $sql = 'select * from ' . $GLOBALS['ecs']->table('suppliers') . ' where city = ' . $region_id;
        $regions = $GLOBALS['db']->getall($sql);
        $smarty->assign('regions', $regions);
        $smarty->assign('regions_count', count($regions));
        $supplier_best_goods = get_recommend_goods_by_suppliers_id('best', 0, $region_id);
        if (!$supplier_best_goods) {
            $supplier_best_goods = get_cat_best_goods_4(0);
        }
        $smarty->assign('supplier_best_goods', $supplier_best_goods);
    }
} else {
    $_SESSION['region_id'] = 0;
    $_SESSION['region_name'] = '全国站';
    $_SESSION['pin_yin'] = 'china';
    $supplier_best_goods = get_cat_best_goods_4(0);
    $smarty->assign('supplier_best_goods', $supplier_best_goods);
}
function get_recommend_goods_by_suppliers_id($type = '', $cat_id = 0, $region_id = 0)
{
    $brand_where = $region_id > 0 ? ' AND g.suppliers_id in (select suppliers_id from ' . $GLOBALS['ecs']->table('suppliers') . ' where city = ' . $region_id . ') ' : '';
    $price_where = $min > 0 ? " AND g.shop_price >= {$min} " : '';
    $price_where .= $max > 0 ? " AND g.shop_price <= {$max} " : '';
    $sql = 'SELECT g.goods_id, g.goods_name, g.goods_name_style,g.goods_sn,  g.market_price, g.shop_price AS org_price, g.promote_price,g.seller_note, ' . "IFNULL(mp.user_price, g.shop_price * '{$_SESSION['discount']}') AS shop_price, " . '(select AVG(r.comment_rank) from ' . $GLOBALS['ecs']->table('comment') . ' as r where r.id_value = g.goods_id AND r.comment_type = 0 AND r.parent_id = 0 AND r.status = 1) AS comment_rank, ' . '(select IFNULL(sum(og.goods_number), 0) from ' . $GLOBALS['ecs']->table('order_goods') . ' as og where og.goods_id = g.goods_id) AS sell_number, ' . 'promote_start_date, promote_end_date, g.goods_brief, g.goods_thumb, goods_img, b.brand_name,b.brand_id,b.brand_logo ' . '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 ' . $brand_where . $price_where . $ext;
    $num = 0;
    $type2lib = array('best' => 'recommend_best', 'new' => 'recommend_new', 'hot' => 'recommend_hot', 'promote' => 'recommend_promotion');
    if ($cat_num == 0) {
        $num = get_library_number($type2lib[$type]);
    } else {
        $num = $cat_num;
    }
Beispiel #2
0
    
  </div>
</div>
<div class="w clearfix group_area mt10">
<?php 
if ($this->_var['package_goods_list'] || $this->_var['fittings']) {
    ?>
<div id="JS_goods_group_left" class="Left group_l">
<?php 
    if ($this->_var['package_goods_list']) {
        ?>
  <div id="JS_goods_order_similar" class="similar mt10 none">
    <h2 class="group_title">人气推荐</h2>
    <ul id="JS_similar_order" class="tab_body" style="height:235px">
	<?php 
        $_from = get_cat_best_goods_4($GLOBALS[smarty]->_var[goods][cat_id]);
        if (!is_array($_from) && !is_object($_from)) {
            settype($_from, 'array');
        }
        $this->push_vars('', 'goods_item');
        $this->_foreach['best_goods'] = array('total' => count($_from), 'iteration' => 0);
        if ($this->_foreach['best_goods']['total'] > 0) {
            foreach ($_from as $this->_var['goods_item']) {
                $this->_foreach['best_goods']['iteration']++;
                ?>
      <li <?php 
                if ($this->_foreach['best_goods']['iteration'] == 1) {
                    ?>
class="first"<?php 
                }
                ?>