예제 #1
0
 public function index($cat_id = '', $urlFilter = null, $orderBy = 0, $tab = null, $page = 1, $cat_type = null, $view = null)
 {
     $tab = intval($tab);
     $urlFilter = $this->RemoveXSS($urlFilter);
     // 20130204 Andrew 俱乐部专区功能,俱乐部专区只能俱乐部访问
     $goods_cat = $this->app->model('goods_cat')->dump($cat_id);
     if ($goods_cat['cat_name'] == '俱乐部专区') {
         $custom_user = kernel::single('custom_member')->get_custom_user(helper::current_account_id());
         if ((!$custom_user['club'] || !$custom_user['vip']) && !$custom_user['leader']) {
             $back_url = $this->gen_url(array('app' => 'b2c', 'ctl' => 'site', 'act' => 'index'));
             $this->splash('failed', $back_url, app::get('b2c')->_('本页需要认证俱乐部才能进入'));
         }
     }
     // 20130204 End
     $urlFilter = htmlspecialchars(urldecode($urlFilter));
     $_GET['scontent'] = htmlspecialchars($_GET['scontent']);
     if (!empty($urlFilter) && $urlFilter != $_GET['scontent']) {
         $urlFilter .= '_' . $_GET['scontent'];
     } else {
         $urlFilter = $_GET['scontent'];
     }
     $virCatObj =& $this->app->model('goods_virtual_cat');
     if ($cat_type) {
         $vcatid = $cat_type;
         $oSearch =& $this->app->model('search');
         /** 颗粒缓存商品虚拟分类 **/
         if (!cachemgr::get('goods_virtual_cat_' . intval($vcatid), $vcat)) {
             cachemgr::co_start();
             $vcat = $virCatObj->getList('cat_id,cat_path,virtual_cat_id,filter,virtual_cat_name as cat_name', array('virtual_cat_id' => intval($vcatid)));
             cachemgr::set('goods_virtual_cat_' . intval($vcatid), $vcat, cachemgr::co_end());
         }
         $vcat = current($vcat);
         $vcatFilters = $virCatObj->_mkFilter($vcat['filter']);
         $vcatFilters = $virCatObj->getFilter($vcatFilters);
         $old_cat_id = $cat_id;
         $old_urlFilter = $urlFilter;
         $cat_id = $cat_id ? $cat_id . implode(",", $vcatFilters['cat_id']) : implode(",", $vcatFilters['cat_id']);
         $urlFilter = $urlFilter ? $urlFilter : $oSearch->encode($vcatFilters);
     }
     $page = $page > 1 ? intval($page) : 1;
     if ($cat_id == '_ANY_') {
         unset($cat_id);
     }
     if ($cat_id) {
         $cat_id = explode(",", $cat_id);
         foreach ($cat_id as $k => $v) {
             if ($v) {
                 $cat_id[$k] = intval($v);
             }
         }
         $this->id = implode(",", $cat_id);
     } else {
         $cat_id = array('');
         $this->id = '';
     }
     $pageLimit = $this->app->getConf('gallery.display.listnum');
     $pageLimit = $pageLimit ? $pageLimit : 20;
     $this->pagedata['pdtPic'] = array('width' => 100, 'heigth' => 100);
     $productCat =& $this->app->model('goods_cat');
     $objGoods = $this->app->model('goods');
     $global_runtime_path = "";
     // ajx 这里添加对分类的判断,当分类不存在时不做缓存处理
     if (!cachemgr::get('global_runtime_path' . $this->id, $global_runtime_path)) {
         cachemgr::co_start();
         if ($cat_type) {
             $global_runtime_path = $virCatObj->getPath($cat_type, '');
         } else {
             $global_runtime_path = $productCat->getPath($cat_id[0], '');
         }
         cachemgr::set('global_runtime_path', $global_runtime_path, cachemgr::co_end());
     }
     /****ajx 以下是为了当搜索条件存在时 面包屑中显示 搜索条件 ***/
     if ($_GET['scontent'] && strlen($urlFilter) > 0) {
         $global_runtime_path = array(array('type' => 'goodsCat', 'title' => app::get('site')->_('首页'), 'link' => kernel::base_url(1)));
         $title_ = explode('_', $urlFilter);
         $title_arr = "";
         foreach ($title_ as $val_xin) {
             $title_xin = explode(',', $val_xin);
             if (count($title_xin) > 2) {
                 unset($title_xin[0]);
                 foreach ($title_xin as $xin_val) {
                     $title_arr[] = $xin_val;
                 }
             } else {
                 $title_arr[] = $title_xin[1];
             }
         }
         $title = implode(',', $title_arr);
         array_push($global_runtime_path, array('type' => 'goodsCat', 'title' => app::get('site')->_($title), 'link' => kernel::base_url(1)));
     }
     // ajx 以下是为了当无分类和搜索条件时 显示所有商品
     if (count($global_runtime_path) < 2) {
         $global_runtime_path = array(array('type' => 'goodsCat', 'title' => app::get('site')->_('首页'), 'link' => kernel::base_url(1)), array('type' => 'goodsCat', 'title' => app::get('site')->_('所有商品'), 'link' => kernel::base_url(1)));
     }
     $GLOBALS['runtime']['path'] = $global_runtime_path;
     if ($cat_id[0]) {
         if (!cachemgr::get('goods_cat_' . $cat_id[0], $this->cat_result)) {
             cachemgr::co_start();
             $this->cat_result = $productCat->getList('cat_name,gallery_setting,type_id', array('cat_id|in' => $cat_id), 0, 1);
             cachemgr::set('goods_cat_' . $cat_id[0], $this->cat_result, cachemgr::co_end());
         }
         $type_filter['type_id'] = $this->cat_result[0]['type_id'];
     }
     if (isset($this->cat_result[0]['gallery_setting']['gallery_template']) && $this->cat_result[0]['gallery_setting']['gallery_template']) {
         $this->set_tmpl_file($this->cat_result[0]['gallery_setting']['gallery_template']);
         //添加模板
     }
     if (empty($view)) {
         $view = $this->app->getConf('gallery.default_view') ? $this->app->getConf('gallery.default_view') : 'index';
     }
     if (!cachemgr::get('goods_cat_childnode_' . $cat_id[0], $this->pagedata['childnode'])) {
         cachemgr::co_start();
         $this->pagedata['childnode'] = $productCat->getCatParentById($cat_id, $view);
         cachemgr::set('goods_cat_childnode_' . $cat_id[0], $this->pagedata['childnode'], cachemgr::co_end());
     }
     $cat = kernel::service('b2c_site_goods_list_viewer_apps')->get_view($cat_id, $view, $type_filter['type_id'], $cat_type);
     $args = array($cat_type ? $old_cat_id : $this->id, $cat_type ? $old_urlFilter : urlencode($urlFilter), $orderBy, $tab, $page, $cat_type, $view);
     $this->pagedata['args'] = $args;
     $this->pagedata['args1'] = $args[1];
     $args[1] = null;
     $this->pagedata['args2'] = $args;
     if ($this->app->getConf('system.seo.noindex_catalog')) {
         $this->header .= '<meta name="robots" content="noindex,noarchive,follow" />';
     }
     $searchtools =& $this->app->model('search');
     $path = array();
     $propargs = $searchtools->decode($urlFilter, $path, $cat);
     if (is_array($propargs)) {
         foreach ($propargs as $rk => $rv) {
             $pos = strpos($rk, 'p_');
             if ($pos === 0) {
                 $propz[$rk] = $rv[0];
                 $rk = substr($rk, 2);
                 $proparg[$rk] = $rv;
                 $prot[] = $rk;
             }
         }
     }
     if (isset($propargs['name'])) {
         $GLOBALS['runtime']['search_key'] = $propargs['name'][0];
     }
     $this->pagedata['prot'] = $prot;
     $filter = $propargs;
     if (is_array($filter)) {
         $filter = array_merge(array('cat_id' => $cat_id, 'marketable' => 'true'), $filter);
         if (($filter['cat_id'][0] === '' || $filter['cat_id'][0] === null) && !isset($filter['cat_id'][1])) {
             unset($filter['cat_id']);
         }
         if (($filter['brand_id'][0] === '' || $filter['brand_id'][0] === null) && !isset($filter['brand_id'][1])) {
             unset($filter['brand_id']);
         }
     } else {
         $filter = array('cat_id' => $cat_id, 'marketable' => 'true');
     }
     //--------获取类型关联的规格
     $type_id = $type_filter['type_id'];
     $gType =& $this->app->model('goods_type');
     if (!cachemgr::get('goods_type_' . $type_id, $SpecList)) {
         cachemgr::co_start();
         $SpecList = $gType->getSpec($type_id, 1);
         //获取关联的规格
         cachemgr::set('goods_type_' . $type_id, $SpecList, cachemgr::co_end());
     }
     if ($SpecList) {
         $this->spec_goods = $SpecList[1];
     }
     $oGoodsTypeSpec = $this->app->model('goods_type_spec');
     if (!cachemgr::get('goods_type_spec' . $type_id, $type_spec)) {
         cachemgr::co_start();
         $type_spec = $oGoodsTypeSpec->get_type_spec($type_id);
         cachemgr::set('goods_type_spec' . $type_id, $type_spec, cachemgr::co_end());
     }
     $filter['cat_id'] = $cat_id;
     $filter['goods_type'] = 'normal';
     $filter['marketable'] = 'true';
     //-----查找当前类别子类别的关联类型ID
     if ($urlFilter) {
         if ($vcat['type_id']) {
             //$filter['type_id']=$vcat['type_id'];
             $filter['type_id'] = null;
         }
     }
     //--------
     foreach ($path as $p) {
         $arg = unserialize(serialize($this->pagedata['args']));
         $arg[1] = $p['str'];
         $title = array();
         if ($p['type'] == 'brand_id') {
             $brand = array();
             foreach ($cat['brand'] as $b) {
                 $brand[$b['brand_id']] = $b['brand_name'];
             }
             foreach ($p['data'] as $i) {
                 $title[] = $brand[$i];
                 $tip = __("品牌");
             }
             unset($brand);
         } elseif (substr($p['type'], 0, 2) == 's_') {
             $spec = array();
             foreach ($p['data'] as $spk => $spv) {
                 $tmp = explode(",", $spv);
                 $tip = $SpecList[$tmp[0]]['name'];
                 $title[] = $SpecList[$tmp[0]]['spec_value'][$tmp[1]]['spec_value'];
                 $g['pdt_desc'] = $SpecList[$tmp[0]]['spec_value'][$tmp[1]]['spec_value'];
                 /*前台搜索商品规格筛选,所要获取的pdt_desc*/
             }
         }
         $curSpec[$tmp[0]] = $tmp[1];
     }
     $this->pagedata['tabs'] = $cat['tabs'];
     $this->pagedata['cat_id'] = implode(",", $cat_id);
     $views = $cat['setting']['list_tpl'];
     foreach ($views as $key => $val) {
         $this->pagedata['views'][$key] = array($cat_type ? $old_cat_id : $this->id, '', $orderBy, $tab, $page, $cat_type, $val);
     }
     if ($cat['tabs'][$tab]) {
         parse_str($cat['tabs'][$tab]['filter'], $_filter);
         $filter = array_merge($filter, $_filter);
     }
     if (isset($this->pagedata['orderBy'][$orderBy])) {
         $orderby = $this->pagedata['orderBy'][$orderBy]['sql'];
     }
     $selector = array();
     $search = array();
     /***********************/
     if ($SpecList) {
         if ($curSpec) {
             $curSpecKey = array_keys($curSpec);
         }
         foreach ($SpecList as $spk => $spv) {
             $selected = 0;
             if ($curSpecKey && in_array($spk, $curSpecKey)) {
                 $spv['spec_value'][$curSpec[$spk]]['selected'] = true;
                 $selected = 1;
             }
             if ($spv['spec_style'] == "select") {
                 //下拉
                 $SpecSelList[$spk] = $spv;
                 if ($selected) {
                     $SpecSelList[$spk]['selected'] = true;
                 }
             } elseif ($spv['spec_style'] == "flat") {
                 $SpecFlatList[$spk] = $spv;
                 if ($selected) {
                     $SpecFlatList[$spk]['selected'] = true;
                 }
             }
         }
     }
     $this->pagedata['SpecFlatList'] = $SpecFlatList;
     foreach ($SpecFlatList as $sk => $sv) {
         if (strpos($sv['name'], '颜色') !== false) {
             foreach ($sv['spec_value'] as $ssk => $ssv) {
                 $this->pagedata['allcolor'] = $sk;
             }
         }
     }
     $this->pagedata['specimagewidth'] = $this->app->getConf('spec.image.width');
     $this->pagedata['specimageheight'] = $this->app->getConf('spec.image.height');
     $this->pagedata['orderBy'] = $objGoods->orderBy();
     //排序方式
     if (empty($orderBy)) {
         $orderBy = 1;
     }
     if (!isset($this->pagedata['orderBy'][$orderBy])) {
         $this->_response->set_http_response_code(404);
     } else {
         $orderby = $this->pagedata['orderBy'][$orderBy]['sql'];
     }
     $selector['ordernum'] = $cat['ordernum'];
     if (app::get('base')->getConf('server.search_server.search_goods')) {
         $searchApp = search_core::instance('search_goods');
         $sfilter['filter'] = $filter;
         $sfilter['from'] = $pageLimit * ($page - 1);
         //分页
         $sfilter['to'] = $pageLimit;
         $sfilter['order'] = $orderby;
         $sfilter['scount'] = count($cat['props']);
     }
     $res = false;
     //初始化
     if (is_object($searchApp)) {
         $sphinxstart = true;
         $queryRes = $searchApp->query($sfilter);
         if ($queryRes) {
             $res = $searchApp->commit();
             $nprop = $res['prop'];
             //属性搜索
             $cbrand = $res['brand'];
             $rfilter['goods_id'] = $res['result'];
             if (is_array($res['result'])) {
                 $count = $res['total'];
                 $search_data = $objGoods->getList('*', $rfilter);
                 foreach ($search_data as $tmp_data) {
                     $tmp_search_data[$tmp_data['goods_id']] = $tmp_data;
                 }
                 foreach ($res['result'] as $v) {
                     if (!isset($tmp_search_data[$v])) {
                         continue;
                     }
                     $aProduct[] = $tmp_search_data[$v];
                     //产品
                 }
                 unset($search_data);
                 unset($tmp_search_data);
             } else {
                 $count = 0;
                 $aProduct = array();
             }
         }
     }
     if ($res === false) {
         if (isset($filter['tag'][0]) && !$filter['tag'][0]) {
             unset($filter['tag']);
         }
         $tmp_filter['str_where'] = $objGoods->_filter($filter);
         $aProduct = $objGoods->getList('*', $tmp_filter, $pageLimit * ($page - 1), $pageLimit, $orderby);
         $count = $objGoods->count($tmp_filter);
     }
     /************************/
     if (is_array($cat['brand'])) {
         if ($sphinxstart) {
             $bCount = $cbrand;
         } else {
             $bCount = $objGoods->countBrandGoods($tmp_filter, $cat['brand']);
         }
         foreach ($cat['brand'] as $bk => $bv) {
             if (is_array($filter['brand_id'])) {
                 $bid = array_flip($filter['brand_id']);
             }
             $brand = array('name' => app::get('b2c')->_('品牌'), 'value' => $bid);
             $brandArray[$bv['brand_id']] = $bv['brand_name'];
         }
         foreach ((array) $bCount as $sk => $sv) {
             if (isset($brandArray[$bCount[$sk]['brand_id']])) {
                 $tmpOp[$bCount[$sk]['brand_id']] = $brandArray[$bCount[$sk]['brand_id']] . "<span class='num'>(" . $bCount[$sk]['_count'] . ")</span>";
             }
         }
         $brand['options'] = $tmpOp;
         $selector['brand_id'] = $brand;
     }
     $goods_relate = array();
     if (!is_array($cat_id) && $cat_id || $cat_id[0] || $cat_type) {
         //$goods_relate = $aProduct;
         $goods_relate = $objGoods->getList("p_1,p_2,p_3,p_4,p_5,p_6,p_7,p_8,p_9,p_10,p_11,p_12,p_13,p_14,p_15,p_16,p_17,p_18,p_19,p_20", $filter, 0, 100);
     }
     foreach ((array) $cat['props'] as $prop_id => $prop) {
         if ($prop['search'] == 'select') {
             if (count($prop['options']) > 0) {
                 $prop['value'] = $filter['p_' . $prop_id][0];
                 $searchSelect[$prop_id] = $prop;
             }
         } elseif ($prop['search'] == 'input') {
             $prop['value'] = $filter['p_' . $prop_id][0];
             $searchInput[$prop_id] = $prop;
         } elseif ($prop['search'] == 'nav') {
             if (is_array($filter['brand_id']) && isset($filter['p_' . $prop_id])) {
                 $prop['value'] = array_flip($filter['p_' . $prop_id]);
             }
             $plugadd = array();
             if (is_array($goods_relate)) {
                 foreach ($goods_relate as $k => $v) {
                     if ($v["p_" . $prop_id] != null) {
                         if ($plugadd[$v["p_" . $prop_id]]) {
                             $plugadd[$v["p_" . $prop_id]] = $plugadd[$v["p_" . $prop_id]] + 1;
                         } else {
                             $plugadd[$v["p_" . $prop_id]] = 1;
                         }
                     }
                     $aFilter['goods_id'][] = $v['goods_id'];
                     //当前的商品结果集
                 }
             }
             $navselector = 0;
             if (is_array($prop['options'])) {
                 foreach ($prop['options'] as $q => $e) {
                     if ($plugadd[$q]) {
                         $prop['options'][$q] = $prop['options'][$q] . "<span class='num'>(" . $plugadd[$q] . ")</span>";
                         if (!$navselector) {
                             $navselector = 1;
                         }
                     } else {
                         unset($prop['options'][$q]);
                     }
                 }
             }
             $selector[$prop_id] = $prop;
         }
     }
     if ($navselector) {
         $nsvcount = 0;
         $noshow = 0;
         foreach ($selector as $sk => $sv) {
             if ($sv['value']) {
                 $nsvcount++;
             }
             if (is_numeric($sk) && !$sv['show']) {
                 $noshow++;
             }
         }
         if ($nsvcount == intval(count($selector) - $noshow)) {
             $navselector = 0;
         }
     }
     foreach ((array) $cat['spec'] as $spec_id => $spec_name) {
         $sId['spec_id'][] = $spec_id;
     }
     $cat['ordernum'] = $cat['ordernum'] ? $cat['ordernum'] : array('' => 2);
     if ($cat['ordernum']) {
         if ($selector) {
             foreach ($selector as $key => $val) {
                 if (!in_array($key, $cat['ordernum']) && $val) {
                     $selectorExd[$key] = $val;
                 }
             }
         }
     }
     if (is_array($aProduct)) {
         foreach ($aProduct as $apk => $apv) {
             $rfilter[] = $apv['goods_id'];
         }
     }
     if (is_object(kernel::service('propselect.prop_search'))) {
         $dprop = kernel::service('propselect.prop_search')->getProps($filter, $propz, $prot, $dprop, $searchSelect);
     }
     $this->pagedata['dprop'] = $dprop;
     $this->pagedata['nprop'] = $nprop;
     //对商品进行预处理
     $this->pagedata['mask_webslice'] = $this->app->getConf('system.ui.webslice') ? ' hslice' : null;
     $this->pagedata['searchInput'] =& $searchInput;
     $this->pagedata['selectorExd'] = $selectorExd;
     $this->cat_id = $cat_id;
     $this->_plugins['function']['selector'] = array(&$this, '_selector');
     $this->pagedata['pager'] = array('current' => $page, 'total' => ceil($count / $pageLimit), 'link' => $this->gen_url(array('app' => 'b2c', 'ctl' => 'site_gallery', 'full' => 1, 'act' => 'index', 'args' => array($cat_type ? $old_cat_id : implode(',', $cat_id), '', $orderBy, $tab, $tmp = time(), $cat_type, $view))) . '?scontent=' . urlencode($p['str']), 'token' => $tmp);
     if ($page != 1 && $page > $this->pagedata['pager']['total']) {
         $this->_response->set_http_response_code(404);
     }
     if (!$count) {
         $this->pagedata['emtpy_info'] = kernel::single('site_errorpage_get')->getConf('errorpage.search');
     }
     $this->pagedata['searchtotal'] = $count;
     $aData = $this->get_current_member();
     if (is_array($aProduct) && count($aProduct) > 0) {
         $objProduct = $this->app->model('products');
         if ($this->app->getConf('site.show_mark_price') == 'true') {
             $setting['mktprice'] = $this->app->getConf('site.show_mark_price');
             if (isset($aProduct)) {
                 foreach ($aProduct as $pk => $pv) {
                     if (empty($aProduct[$pk]['mktprice'])) {
                         $aProduct[$pk]['mktprice'] = $objProduct->getRealMkt($pv['price']);
                     }
                 }
             }
         } else {
             $setting['mktprice'] = 0;
         }
         $setting['saveprice'] = $this->app->getConf('site.save_price');
         $setting['buytarget'] = $this->app->getConf('site.buy.target');
         $this->pagedata['setting'] = $setting;
         //spec_desc
         $this->site_member_lv_id = $aData['member_lv'];
         $oGoodsLv =& $this->app->model('goods_lv_price');
         $oMlv =& $this->app->model('member_lv');
         if ($this->site_member_lv_id) {
             $mlv = $oMlv->getList('dis_count', array('member_lv_id' => $this->site_member_lv_id));
         }
         $tmpGoods = array();
         $tmp_goods_ids = array_map('current', $aProduct);
         /** 获取所有商品对应的货品 **/
         $tmp_products = $objProduct->getList('product_id, spec_info, price,mktprice, freez, store,   marketable, goods_id', array('goods_id|in' => $tmp_goods_ids, 'marketable' => 'true'));
         $tmp_products = utils::array_change_key($tmp_products, 'goods_id', 1);
         /** 促销处理 **/
         $aProduct['goods_ids'] = $tmp_goods_ids;
         $aPromotion_price = kernel::single('b2c_goods_promotion_price')->process($aProduct);
         unset($aProduct['goods_ids']);
         foreach ($aProduct as $key => &$val) {
             $db = kernel::database();
             $tvPrice = array();
             //$temp = $objProduct->getList('mktprice,product_id, spec_info, price, freez, store,   marketable, goods_id',array('goods_id'=>$val['goods_id'],'marketable'=>'true'));
             $temp = $tmp_products[$val['goods_id']];
             $priceArea = array();
             $mktpriceArea = array();
             foreach ($tmp_products[$val['goods_id']] as $tpv) {
                 $tvPrice[] = $tpv['price'];
                 $priceArea[] = $tpv['price'];
                 //销售价区域
                 if ($tpv['mktprice'] == '' || $tpv['mktprice'] == null) {
                     $mktpriceArea[] = $objProduct->getRealMkt($tpv['mktprice']);
                 } else {
                     $mktpriceArea[] = $tpv['mktprice'];
                 }
             }
             if ($this->app->getConf('site.show_mark_price') == "true" && count($priceArea) > 1) {
                 //列表页价格区间@lujy
                 $minprice = min($priceArea);
                 $maxprice = max($priceArea);
                 if ($minprice != $maxprice) {
                     $val['minprice'] = $minprice;
                     $val['maxprice'] = $maxprice;
                 }
             }
             if ($this->app->getConf('site.show_mark_price') == "true" && count($mktpriceArea) > 1) {
                 //列表也市场价区间
                 $mktminprice = min($mktpriceArea);
                 $mktmaxprice = max($mktpriceArea);
                 if ($mktminprice != $mktmaxprice) {
                     $val['minmktprice'] = $mktminprice;
                     $val['maxmktprice'] = $mktmaxprice;
                 }
             }
             $val['price'] = min($tvPrice);
             $val['mktprice'] = max($mktpriceArea);
             if ($mlv) {
                 $tmpGoods = array();
                 foreach ($oGoodsLv->getList('product_id,price', array('goods_id' => $val['goods_id'], 'level_id' => $this->site_member_lv_id)) as $k => $v) {
                     $tmpGoods[$v['product_id']] = $v['price'];
                 }
                 foreach ($temp as &$tv) {
                     $tv['price'] = isset($tmpGoods[$tv['product_id']]) ? $tmpGoods[$tv['product_id']] : $mlv[0]['dis_count'] * $tv['price'];
                 }
                 $val['price'] = isset($tmpGoods[$tv['product_id']]) ? $tmpGoods[$tv['product_id']] : $mlv[0]['dis_count'] * $val['price'];
             }
             if ($aPromotion_price[$val['goods_id']]) {
                 $promotion_price = $aPromotion_price[$val['goods_id']];
                 if ($promotion_price['price']) {
                     $val['timebuyprice'] = $promotion_price['price'];
                 } else {
                     $val['timebuyprice'] = $val['price'];
                 }
                 $val['show_button'] = $promotion_price['show_button'];
                 $val['timebuy_over'] = $promotion_price['timebuy_over'];
             }
             $val['spec_desc_info'] = $temp;
             $aProduct[$key]['product_id'] = $temp[0]['product_id'];
         }
         // add here by liuyong
         // show tag on goods image
         foreach (kernel::servicelist('tags_special.add') as $services) {
             if (is_object($services)) {
                 if (method_exists($services, 'add')) {
                     $services->add($rfilter, $aProduct);
                 }
             }
         }
         // end of add
         // 获取商品评分和频率
         $objPoint = $this->app->model('comment_goods_point');
         $salesGoods = $this->app->model('goods_promotion_ref');
         foreach ($aProduct as $k => $v) {
             $aProduct[$k]['goods_point'] = $objPoint->get_single_point($v['goods_id']);
             $aProduct[$k]['total_point_nums'] = $objPoint->get_point_nums($v['goods_id']);
             //获取促销商品折扣图片
             $aProduct[$k]['salse_description'] = $db->select("SELECT gpr.`goods_id`,gpr.`description`,srg.`image` FROM `sdb_b2c_goods_promotion_ref` as gpr\n                                                                left join sdb_b2c_sales_rule_goods as srg on gpr.rule_id = srg.rule_id\n                                                                WHERE gpr.`goods_id`=" . $v['goods_id'] . "");
             //                $aProduct[$k]['salse_description'] = $salesGoods->getList('goods_id,description,image', array('goods_id' => $v['goods_id']));
         }
         $this->pagedata['products'] =& $aProduct;
     }
     if (!$aData['member_id']) {
         $this->pagedata['login'] = '******';
     }
     if ($SpecSelList) {
         $this->pagedata['SpecSelList'] = $SpecSelList;
     }
     if ($searchSelect) {
         $this->pagedata['searchSelect'] =& $searchSelect;
     }
     $this->pagedata['curView'] = $view;
     $this->pagedata['selector'] =& $selector;
     $this->pagedata['cat_type'] = $cat_type;
     if ($GLOBALS['search_array'] && is_array($GLOBALS['search_array'])) {
         $this->pagedata['search_array'] = implode("+", $GLOBALS['search_array']);
     }
     $this->pagedata['_PDT_LST_TPL'] = $cat['tpl'];
     $this->pagedata['filter'] = $filter;
     unset($filter['name']);
     $this->pagedata['bfilter'] = $filter;
     $this->set_tmpl('gallery');
     $this->pagedata['gallery_display'] = $this->app->getConf('gallery.display.grid.colnum');
     $this->pagedata['show_cat'] = $this->app->getConf('site.cat.select');
     if ($count < $this->pagedata['gallery_display']) {
         $this->pagedata['gwidth'] = $count * (100 / $this->pagedata['gallery_display']);
     } else {
         $this->pagedata['gwidth'] = 100;
     }
     $this->pagedata['property_select'] = $this->app->getConf('site.property.select');
     $imageDefault = app::get('image')->getConf('image.set');
     $this->pagedata['image_set'] = $imageDefault;
     $this->pagedata['defaultImage'] = $imageDefault['S']['default_image'];
     $this->pagedata['proparg'] = $proparg;
     /** 获取商品表相关meta **/
     if ($cat_id) {
         $obj_meta_register = app::get('dbeav')->model('meta_register');
         $arr_meta_register = $obj_meta_register->getList('*', array('tbl_name' => $productCat->table_name(1), 'col_name' => 'seo_info'));
         if (!$arr_meta_register) {
             $productCat->cat_meta_register();
         }
         $meta_desc = $arr_meta_register[0]['col_desc'];
         $col_type = $arr_meta_register[0]['col_type'];
         $obj_meta_value = app::get('dbeav')->model('meta_value_' . $col_type);
         $seo_info = $obj_meta_value->select($arr_meta_register[0]['mr_id'], $cat_id);
         if (is_array($seo_info) && count($seo_info) == 1) {
             $seo_info = $seo_info[$cat_id[0]];
         } elseif (is_string($seo_info)) {
             $seo_info = unserialize($seo_info[$cat_id[0]]);
         } elseif (!$seo_info) {
             $seo_info = "";
         }
     }
     if (!empty($seo_info['seo_info']['seo_title']) || !empty($seo_info['seo_info']['seo_keywords']) || !empty($seo_info['seo_info']['seo_description'])) {
         $this->title = $seo_info['seo_info']['seo_title'];
         $this->keywords = $seo_info['seo_info']['seo_keywords'];
         $this->description = $seo_info['seo_info']['seo_description'];
     } else {
         $this->setSeo('site_gallery', 'index', $this->prepareSeoData($this->pagedata));
     }
     $this->page('site/gallery/index.html');
 }
예제 #2
0
파일: order.php 프로젝트: syjzwjj/quyeba
 public function index($order_id, $selecttype = false)
 {
     $objOrder =& $this->app->model('orders');
     $sdf = $objOrder->dump($order_id);
     //用于omniture
     $subsdf = array('order_objects' => array('*'), 'order_pmt' => array('*'));
     $sdf2 = $objOrder->dump($order_id, '*', $subsdf);
     //var_dump($sdf2['order_pmt'][0]['pmt_amount']);
     foreach ($sdf2['order_objects'] as $key => $value) {
         //var_dump($value);
         $price2 = $value['price'];
         if ($sdf2['order_pmt'][0]['pmt_amount']) {
             $price2 = $value['price'] - $sdf2['order_pmt'][0]['pmt_amount'];
             //$price2是折后价格  pmt_amount优惠价格
             //var_dump($price2);
         }
         $order_products_id[] = $value['goods_id'] . ';' . $value['quantity'] . ';' . $value['price'] . ';event24=' . $price2;
     }
     $this->pagedata['order_products_id'] = ';' . implode(',;', $order_products_id);
     $this->pagedata['order_event24'] = "purchase,event24";
     // 校验订单的会员有效性.
     $is_verified = $this->_check_verify_member($sdf['member_id']) ? $this->_check_verify_member($sdf['member_id']) : false;
     // 校验订单的有效性.
     if ($_COOKIE['ST_ShopEx-Order-Buy'] != md5($this->app->getConf('certificate.token') . $order_id) && !$is_verified) {
         $this->begin();
         $this->end(false, app::get('b2c')->_('订单无效!'), $this->gen_url(array('app' => 'site', 'ctl' => 'default', 'act' => 'index')));
     }
     if (!$sdf) {
         $this->_response->set_http_response_code(404);
         $this->_response->set_body(app::get('b2c')->_('订单号:') . $order_id . app::get('b2c')->_('不存在!'));
         return;
     }
     $sdf['cur_money'] = $this->objMath->number_minus(array($sdf['cur_amount'], $sdf['payed']));
     $this->pagedata['order'] = $sdf;
     if ($selecttype) {
         $selecttype = 1;
     } else {
         $selecttype = 0;
     }
     $this->pagedata['order']['selecttype'] = $selecttype;
     $opayment = app::get('ectools')->model('payment_cfgs');
     $this->pagedata['payments'] = $opayment->getListByCode($sdf['currency']);
     $system_money_decimals = $this->app->getConf('system.money.decimals');
     $system_money_operation_carryset = $this->app->getConf('system.money.operation.carryset');
     foreach ($this->pagedata['payments'] as $key => &$arrPayments) {
         if (!$sdf['member_id']) {
             if (trim($arrPayments['app_id']) == 'deposit') {
                 unset($this->pagedata['payments'][$key]);
                 continue;
             }
         }
         if ($arrPayments['app_id'] == $this->pagedata['order']['payinfo']['pay_app_id']) {
             $this->pagedata['order']['payinfo']['pay_name'] = $arrPayments['app_name'];
             $this->pagedata['order']['payinfo']['pay_des'] = $arrPayments['app_des'];
             $arrPayments['cur_money'] = $this->objMath->formatNumber($this->pagedata['order']['cur_money'], $system_money_decimals, $system_money_operation_carryset);
             $arrPayments['total_amount'] = $this->objMath->formatNumber($this->pagedata['order']['total_amount'], $system_money_decimals, $system_money_operation_carryset);
         } else {
             $arrPayments['cur_money'] = $this->pagedata['order']['cur_money'];
             $cur_discount = $this->objMath->number_multiple(array($sdf['discount'], $this->pagedata['order']['cur_rate']));
             if ($this->pagedata['order']['payinfo']['cost_payment'] > 0) {
                 if ($this->pagedata['order']['cur_money'] > 0) {
                     $cost_payments_rate = $this->objMath->number_div(array($arrPayments['cur_money'], $this->objMath->number_plus(array($this->pagedata['order']['cur_money'], $this->pagedata['order']['payed']))));
                 } else {
                     $cost_payments_rate = 0;
                 }
                 $cost_payment = $this->objMath->number_multiple(array($this->objMath->number_multiple(array($this->pagedata['order']['payinfo']['cost_payment'], $this->pagedata['order']['cur_rate'])), $cost_payments_rate));
                 $arrPayments['cur_money'] = $this->objMath->number_minus(array($arrPayments['cur_money'], $cur_discount));
                 $arrPayments['cur_money'] = $this->objMath->number_minus(array($arrPayments['cur_money'], $cost_payment));
                 $arrPayments['cur_money'] = $this->objMath->number_plus(array($arrPayments['cur_money'], $this->objMath->number_multiple(array($arrPayments['cur_money'], $arrPayments['pay_fee']))));
                 $arrPayments['cur_money'] = $this->objMath->number_plus(array($arrPayments['cur_money'], $cur_discount));
             } else {
                 $arrPayments['cur_money'] = $this->objMath->number_minus(array($arrPayments['cur_money'], $cur_discount));
                 $cost_payment = $this->objMath->number_multiple(array($arrPayments['cur_money'], $arrPayments['pay_fee']));
                 $arrPayments['cur_money'] = $this->objMath->number_plus(array($arrPayments['cur_money'], $cost_payment));
                 $arrPayments['cur_money'] = $this->objMath->number_plus(array($arrPayments['cur_money'], $cur_discount));
             }
             $arrPayments['total_amount'] = $this->objMath->formatNumber($this->objMath->number_div(array($arrPayments['cur_money'], $this->pagedata['order']['cur_rate'])), $system_money_decimals, $system_money_operation_carryset);
             $arrPayments['cur_money'] = $this->objMath->formatNumber($arrPayments['cur_money'], $system_money_decimals, $system_money_operation_carryset);
         }
     }
     if ($this->pagedata['order']['payinfo']['pay_app_id'] == '-1') {
         $this->pagedata['order']['payinfo']['pay_name'] = app::get('b2c')->_('货到付款');
     }
     $objCur = app::get('ectools')->model('currency');
     $aCur = $objCur->getFormat($this->pagedata['order']['currency']);
     $this->pagedata['order']['cur_def'] = $aCur['sign'];
     $this->pagedata['return_url'] = $this->gen_url(array('app' => 'b2c', 'ctl' => 'site_paycenter', 'act' => 'result'));
     $this->pagedata['res_url'] = $this->app->res_url;
     $this->pagedata['form_action'] = $this->gen_url(array('app' => 'b2c', 'ctl' => 'site_paycenter', 'act' => 'dopayment', 'arg0' => 'order'));
     $obj_order_payment_html = kernel::servicelist('b2c.order.pay_html');
     $app_id = 'b2c';
     if ($obj_order_payment_html) {
         foreach ($obj_order_payment_html as $obj) {
             $obj->gen_data($this, $app_id);
         }
     }
     // 20121129 Andrew 谷歌跟踪代码
     $custom_uid = helper::get_custom_uid(helper::current_account_id());
     $this->pagedata['analytics'] = array();
     $this->pagedata['analytics']['google'] .= "_gaq.push(['_trackEvent', 'Ecomm', 'Ecomm-Order', '{$custom_uid}||{$order_id}||{$sdf['itemnum']}', {$sdf['cur_money']}]);\n";
     $this->pagedata['analytics']['mediav'] .= '_mvsite.$logOrder' . "('{$order_id}',{$sdf['cur_money']},'','','未确定','1');\n";
     // 20121129 End
     $this->set_tmpl('order_index');
     $this->page('site/order/index.html', false, $app_id);
 }
예제 #3
0
 public function result($payment_id)
 {
     $app_ectools = app::get('ectools');
     $oPayment = $app_ectools->model('payments');
     $subsdf = array('orders' => array('*'));
     $sdf_payment = $oPayment->dump($payment_id, '*', $subsdf);
     if ($sdf_payment['orders']) {
         // 得到订单日志
         $objOrderlog = $this->app->model('order_log');
         foreach ($sdf_payment['orders'] as $order_id => $arrOrderbills) {
             $orderlog = $objOrderlog->get_latest_orderlist($arrOrderbills['rel_id'], $arrOrderbills['pay_object'], $arrOrderbills['bill_type']);
             $arrOrderlogs[$orderlog['log_id']] = $orderlog;
         }
         $this->pagedata['payment'] =& $sdf_payment;
         $this->pagedata['payment']['order_id'] = $order_id;
         $this->pagedata['orderlog'] = $arrOrderlogs;
     }
     $this->pagedata['pay_succ'] = $app_ectools->getConf('site.paycenter.pay_succ');
     $this->pagedata['pay_failure'] = $app_ectools->getConf('site.paycenter.pay_failure');
     $this->pagedata['send_immediately'] = app::get('b2c')->getConf('site.order.send_type');
     $this->pagedata['base_path'] = kernel::base_url() . '/';
     $this->pagedata['payment_id'] = $payment_id;
     // 20121129 Andrew 谷歌跟踪
     $custom_uid = helper::get_custom_uid(helper::current_account_id());
     $objOrders = $this->app->model('orders');
     $arrOrders = $objOrders->dump($order_id, '*');
     $objItems = $this->app->model('order_items');
     $arrItems = $objItems->getList('*', array('order_id' => $order_id));
     $this->pagedata['analytics'] = array();
     $this->pagedata['analytics']['google'] .= "_gaq.push(['_addTrans', '{$order_id}', 'quyeba', '{$sdf_payment['cur_money']}', '{$arrOrders['cost_tax']}', '{$arrOrders['shipping']['shipping_name']}', '{$arrOrders['consignee']['area']}', '{$arrOrders['consignee']['addr']}']);\n";
     foreach ($arrItems as $item) {
         $this->pagedata['analytics']['google'] .= "_gaq.push(['_addItem', '{$order_id}', '{$item['bn']}', '{$item['name']}', '', '{$item['price']}', '{$item['nums']}']);\n";
         //$this->pagedata['products_pay'] .= "{$item['goods_id']}; {$item['nums']};{$item['price']}; event27={$arrOrders['payed']}, ";
     }
     $this->pagedata['analytics']['google'] .= "_gaq.push(['_trackTrans']);\n";
     $this->pagedata['analytics']['google'] .= "_gaq.push(['_trackEvent', 'Ecomm', 'Ecomm-Payment', '{$custom_uid}||{$order_id}', {$sdf_payment['cur_money']}]);\n";
     // 20121129 End
     $this->page('site/paycenter/result_' . $sdf_payment['pay_type'] . '.html');
 }
예제 #4
0
파일: product.php 프로젝트: syjzwjj/quyeba
 public function index()
 {
     $db = kernel::database();
     $objProduct =& $this->app->model('products');
     //获取参数
     $_getParams = $this->_request->get_params();
     $gid = $_getParams[0];
     $specImg = $_getParams[1];
     $spec_id = $_getParams[2];
     $this->id = $gid;
     $this->customer_template_id = $gid;
     $objGoods =& $this->app->model('goods');
     $GLOBALS['runtime']['path'] = $objGoods->getPath($gid, '');
     //当前登陆用户信息
     $siteMember = $this->get_current_member();
     //当前登陆用户等级
     $this->site_member_lv_id = $siteMember['member_lv'];
     $this->pagedata['this_member_lv_id'] = $this->site_member_lv_id;
     //商品基本信息 goods表获取
     $aGoods_list = $objGoods->getList("goods_id,name,english_title,bn,price,cost,mktprice,marketable,store,notify_num,score,weight,unit,brief,image_default_id,udfimg,thumbnail_pic,small_pic,big_pic,min_buy,package_scale,package_unit,package_use,score_setting,nostore_sell,goods_setting,disabled,spec_desc,adjunct,p_1,p_2,p_3,p_4,p_5,p_6,p_7,p_8,p_9,p_10,p_11,p_12,p_13,p_14,p_15,p_16,p_17,p_18,p_19,p_20,p_21,p_22,p_23,p_24,p_25,p_26,p_27,p_28,p_29,p_30,p_31,p_32,p_33,p_34,p_35,p_36,p_37,p_38,p_39,p_40,p_41,p_42,p_43,p_44,p_45,p_46,p_47,p_48,p_49,p_50,brand_id,type_id,cat_id,seo_info", array('goods_id' => $gid));
     // 20130204 Andrew 俱乐部专区功能,俱乐部专区只能俱乐部访问
     $goods_cat = $this->app->model('goods_cat')->dump($aGoods_list[0]['cat_id']);
     if ($goods_cat['cat_name'] == '俱乐部专区') {
         $custom_user = kernel::single('custom_member')->get_custom_user(helper::current_account_id());
         if ((!$custom_user['club'] || !$custom_user['vip']) && !$custom_user['leader']) {
             $back_url = $this->gen_url(array('app' => 'b2c', 'ctl' => 'site', 'act' => 'index'));
             $this->splash('failed', $back_url, app::get('b2c')->_('本页需要认证俱乐部才能进入'));
         }
     }
     // 20130204 End
     //获取促销商品折扣图片
     $sgoods_image = $db->select("SELECT gpr.`goods_id`,gpr.`description`,srg.`image` FROM `sdb_b2c_goods_promotion_ref` as gpr\n                                                          left join sdb_b2c_sales_rule_goods as srg on gpr.rule_id = srg.rule_id\n                                                          WHERE gpr.`goods_id`=" . $aGoods_list[0]['goods_id'] . "");
     $this->pagedata['simage'] = $sgoods_image;
     //显示商品折扣价
     if ($_COOKIE['S']['CART_TOTAL_PRICE']) {
         $this->pagedata['username'] = $_COOKIE["SHOPEX_LOGIN_NAME"];
         $this->pagedata['save_login_name'] = true;
     }
     //获取详细的商品数据(包含货品,品牌,规格,类型,图片)
     $list2dump = kernel::single("b2c_goods_list2dump");
     $aGoods = $list2dump->get_goods($aGoods_list[0], $this->site_member_lv_id);
     if (!$aGoods || $aGoods === false || !$aGoods['product']) {
         $this->_response->clean_all_headers()->set_http_response_code('404')->send_headers();
         echo '无效商品!<br>可能是商品未上架';
         exit;
     }
     //反序列化商品配件信息
     if (!is_array($aGoods['adjunct'])) {
         $aGoods['adjunct'] = unserialize($aGoods['adjunct']);
         $adjunct_goods_num = 0;
         foreach ($aGoods['adjunct'] as $goods_adjunct_key => $goods_adjunct_value) {
             if ($goods_adjunct_value['items']['product_id']) {
                 $adjunct_goods_num += count($goods_adjunct_value['items']['product_id']);
             }
         }
         $this->pagedata['adjunctGoodsNum'] = $adjunct_goods_num;
         //配件的商品数量
         $this->pagedata['adjunctNum'] = count($aGoods['adjunct']);
         //配件组的数量
     }
     //设置模板
     if ($aGoods['goods_setting']['goods_template']) {
         $this->set_tmpl_file($aGoods['goods_setting']['goods_template']);
         //添加模板
     }
     $this->set_tmpl('product');
     if (is_array($aGoods['spec'])) {
         foreach ($aGoods['spec'] as $sv) {
             $specValue[] = $sv['spec_name'];
         }
     }
     $this->pagedata['specShowItems'] = $specValue;
     //计算商品冻结总数
     $aGoods['freez'] = 0;
     if (count($aGoods['product'])) {
         foreach ($aGoods['product'] as $pdk => $pdv) {
             if ($pdv['freez']) {
                 $aGoods['freez'] += $pdv['freez'];
             }
         }
     }
     //======商品会员价======
     if ($aGoods['product']) {
         //如果商品有货品处理价格
         $priceArea = array();
         if ($siteMember['member_lv']) {
             $mlv = $siteMember['member_lv'];
         } else {
             $level =& $this->app->model('member_lv');
             $mlv = $level->get_default_lv();
         }
         if ($mlv) {
             foreach ($aGoods['product'] as $gpk => &$gpv) {
                 $currentPriceArea[] = $gpv['price']['price']['current_price'];
                 //销售价区域
                 $priceArea[] = $gpv['price']['price']['price'];
                 //销售价区域
                 if ($gpv['price']['mktprice']['price'] == '' || $gpv['price']['mktprice']['price'] == null) {
                     $mktpriceArea[] = $objProduct->getRealMkt($gpv['price']['mktprice']['price']);
                 } else {
                     $mktpriceArea[] = $gpv['price']['mktprice']['price'];
                     //市场价区域
                 }
             }
             if (count($currentPriceArea) > 1) {
                 $aGoods['current_price'] = min($currentPriceArea);
             }
             if (count($priceArea) > 1) {
                 $minprice = min($priceArea);
                 $maxprice = max($priceArea);
                 if ($minprice != $maxprice) {
                     $aGoods['minprice'] = $minprice;
                     $aGoods['maxprice'] = $maxprice;
                 }
             }
             if ($this->app->getConf('site.show_mark_price') == "true" && count($mktpriceArea) > 1) {
                 $mktminprice = min($mktpriceArea);
                 $mktmaxprice = max($mktpriceArea);
                 if ($mktminprice != $mktmaxprice) {
                     $aGoods['minmktprice'] = $mktminprice;
                     $aGoods['maxmktprice'] = $mktmaxprice;
                 }
             }
         }
     }
     //======商品会员价 end======
     if (!$siteMember['member_id']) {
         $this->pagedata['login'] = '******';
     }
     //分配商品冻结库存总数
     $this->pagedata['goods']['product_freez'] = $aGoods['freez'];
     //当前用户使用货币相关信息
     $cur = app::get('ectools')->model('currency');
     $cur_info = $_COOKIE["S"]["CUR"] ? $cur->getcur($_COOKIE["S"]["CUR"]) : $cur->getFormat();
     if ($cur_info['cur_sign']) {
         $cur_info['sign'] = $cur_info['cur_sign'];
     }
     $ret = array('decimals' => $this->app->getConf('system.money.decimals'), 'dec_point' => $this->app->getConf('system.money.dec_point'), 'thousands_sep' => $this->app->getConf('system.money.thousands_sep'), 'fonttend_decimal_type' => $this->app->getConf('system.money.operation.carryset'), 'fonttend_decimal_remain' => $this->app->getConf('system.money.decimals'), 'sign' => $cur_info['sign']);
     if (isset($cur_info['cur_default']) && $cur_info['cur_default'] === "false") {
         $ret['cur_rate'] = $cur_info['cur_rate'];
     }
     unset($cur_info);
     $this->pagedata['goods']['setting']['score'] = $this->app->getConf('site.get_policy.method');
     $this->pagedata['money_format'] = json_encode($ret);
     $this->pagedata['goodsbndisplay'] = $this->app->getConf('goodsbn.display.switch');
     $this->pagedata['goodsBnShow'] = $this->app->getConf('goodsbn.display.switch');
     //配置数据
     $setting['buytarget'] = $this->app->getConf('site.buy.target');
     $setting['saveprice'] = $this->app->getConf('site.save_price');
     $setting['mktprice'] = $this->app->getConf('site.show_mark_price');
     $aGoods['setting'] = $setting;
     $this->pagedata['goods']['images'] = $aGoods['images'];
     $this->pagedata['spec_default_pic'] = $this->app->getConf('spec.default.pic');
     $tTitle = (empty($aGoods['seo']['seo_title']) ? $aGoods['name'] : $aGoods['seo']['seo_title']) . (empty($aCat['cat_name']) ? "" : " - " . $aCat['cat_name']);
     if (empty($this->title)) {
         $this->title = $tTitle;
     }
     $this->setSeo('site_product', 'index', $this->prepareSeoData(array('goods' => $aGoods)));
     if (is_string($aGoods['seo_info'])) {
         $aGoods['seo_info'] = unserialize($aGoods['seo_info']);
     }
     if ($aGoods['seo_info']['seo_title']) {
         $this->title = $aGoods['seo_info']['seo_title'];
     }
     if ($aGoods['seo_info']['seo_keywords']) {
         $this->keywords = $aGoods['seo_info']['seo_keywords'];
     }
     if ($aGoods['seo_info']['seo_description']) {
         $this->description = $aGoods['seo_info']['seo_description'];
     }
     $setting['acomment']['switch']['ask'] = $this->app->getConf('comment.switch.ask');
     $setting['acomment']['switch']['discuss'] = $this->app->getConf('comment.switch.discuss');
     $this->pagedata['setting'] = $setting;
     /**** start 商品评分 ****/
     $objPoint = $this->app->model('comment_goods_point');
     $goods_point_status = app::get('b2c')->getConf('goods.point.status');
     $this->pagedata['point_status'] = $goods_point_status ? $goods_point_status : 'on';
     $this->pagedata['goods_point'] = $objPoint->get_single_point($gid);
     $this->pagedata['total_point_nums'] = $objPoint->get_point_nums($gid);
     /**** end 商品评分 ****/
     //商品折扣价 @author by charect
     $goodsPr = $this->app->model('goods_promotion_ref');
     $goodsSp = $db->select("SELECT g.`mktprice`,gpr.`goods_id`,gpr.action_solution FROM `sdb_b2c_goods_promotion_ref` AS gpr LEFT JOIN sdb_b2c_sales_rule_goods AS srg ON gpr.rule_id = srg.rule_id \n                                    LEFT JOIN sdb_b2c_goods AS g ON gpr.`goods_id` = g.`goods_id`\n                                                                WHERE gpr.`goods_id`=" . $gid . "");
     $goodsSprice = unserialize($goodsSp['0']['action_solution']);
     $zhekou = $goodsSprice['b2c_promotion_solutions_topercent']['percent'] / 100;
     $goodsSaleprice = $goodsSp['0']['mktprice'] * $zhekou;
     $this->pagedata['salesprice'] = $goodsSaleprice;
     $imageDefault = app::get('image')->getConf('image.set');
     $this->pagedata['image_set'] = $imageDefault;
     $this->pagedata['defaultImage'] = $imageDefault['S']['default_image'];
     //相关商品数量统计
     $aGoods['goodslink'] = $objGoods->getLinkListNums($gid);
     $this->pagedata['goodshtml']['pic'] = kernel::single('b2c_goods_detail_pic')->show($gid, $aGoods);
     $this->pagedata['goodshtml']['store'] = kernel::single('b2c_goods_detail_store')->show($gid, $aGoods);
     $this->pagedata['goodshtml']['mlv_price'] = kernel::single('b2c_goods_detail_mlvprice')->show($gid, $aGoods, $siteMember);
     $this->pagedata['goodshtml']['promotion_info'] = kernel::single('b2c_goods_detail_promotion')->show($gid, $siteMember);
     $this->pagedata['async_request_list'] = json_encode($this->get_body_async_url($aGoods));
     //计算商品冻结总数
     $aGoods['freez'] = 0;
     if (count($aGoods['product'])) {
         foreach ($aGoods['product'] as $pdk => $pdv) {
             if ($pdv['freez']) {
                 $aGoods['freez'] += $pdv['freez'];
             }
         }
     }
     //分配商品冻结库存总数
     $this->pagedata['goods']['product_freez'] = $aGoods['freez'];
     //页面基本信息  servicelist  edit by jiaolei
     $this->pagedata['info_page_list'] = $this->_get_servicelist_by('b2c_products_index_info');
     ///按钮  servicelist edit by jiaolei
     $this->pagedata['btn_page_list'] = $this->_get_servicelist_by('b2c_products_index_btn');
     // 商品详情页添加项埋点
     foreach (kernel::servicelist('goods_description_add_section') as $services) {
         if (is_object($services)) {
             if (method_exists($services, 'addSection')) {
                 $services->addSection($this, $this->pagedata['goods']);
             }
         }
     }
     $this->page('site/product/index.html');
 }