public function beforeRoute($f3) { parent::beforeRoute($f3); // do nothing //用于显示购物车里面有多少商品 global $smarty; //设置 SEO 信息 $smarty->assign('seo_title', bzf_get_option_value('seo_title')); $smarty->assign('seo_description', bzf_get_option_value('seo_description')); $smarty->assign('seo_keywords', bzf_get_option_value('seo_keywords')); // 记录用户从什么来源到达网站的 ReferHelper::setOrderRefer($f3); //设置 order_refer 信息 }
public function get($f3) { global $smarty; // 生成 smarty 的缓存 id $smartyCacheId = 'Ajax|Category'; // 开启并设置 smarty 缓存时间 enableSmartyCache(true, bzf_get_option_value('smarty_cache_time_ajax_category')); if ($smarty->isCached('ajax_category.tpl', $smartyCacheId)) { goto out_display; } // 取得商品分类树形结构 $goodsCategoryService = new GoodsCategoryService(); $goodsCategoryTreeArray = $goodsCategoryService->fetchCategoryTreeArray(0); $smarty->assign('goodsCategoryTreeArray', $goodsCategoryTreeArray); out_display: $f3->expire(600); // 让客户端缓存 10 分钟 $smarty->display('ajax_category.tpl', $smartyCacheId); }
public function get($f3) { global $smarty; // 首先做参数合法性验证 $validator = new Validator($f3->get('GET')); $article_id = $validator->required('文章id不能为空')->digits('文章id非法')->min(1, true, '文章id非法')->validate('article_id'); if (!$this->validate($validator)) { goto out_fail; } // 生成 smarty 的缓存 id $smartyCacheId = 'Article|' . $article_id . '|View'; // 开启并设置 smarty 缓存时间 enableSmartyCache(true, bzf_get_option_value('smarty_cache_time_article_view')); if ($smarty->isCached('article_view.tpl', $smartyCacheId)) { goto out_display; } // 查询文章信息 $articleService = new ArticleBasicService(); $articleInfo = $articleService->loadArticleById($article_id); // 文章不存在,退出 if ($articleInfo->isEmpty() || !$articleInfo->is_open) { $this->addFlashMessage('文章 [' . $article_id . '] 不存在'); goto out_fail; } // 设置文章页面的 SEO 信息 $smarty->assign('seo_title', $articleInfo['title'] . ',' . $f3->get('sysConfig[site_name]')); $smarty->assign('seo_description', $articleInfo['description']); $smarty->assign('seo_keywords', $articleInfo['seo_keyword']); // 给模板赋值 $smarty->assign('articleInfo', $articleInfo); out_display: $smarty->display('article_view.tpl', $smartyCacheId); return; out_fail: // 失败从这里返回 RouteHelper::reRoute($this, '/'); // 返回首页 }
public function get($f3) { global $smarty; // 生成 smarty 的缓存 id $smartyCacheId = 'Shop|Index'; // 开启并设置 smarty 缓存时间 enableSmartyCache(true, bzf_get_option_value('smarty_cache_time_shop_index')); if ($smarty->isCached('shop_index.tpl', $smartyCacheId)) { goto out_display; } // 滑动图片广告 $shop_index_adv_slider = json_decode(bzf_get_option_value('shop_index_adv_slider'), true); if (!empty($shop_index_adv_slider)) { $smarty->assign('shop_index_adv_slider', $shop_index_adv_slider); } // 今日新品 $recommandGoodsArray = SearchHelper::search(SearchHelper::Module_Goods, $this->searchFieldSelector, $this->searchExtraCondArray, array(array('goods_id', 'desc')), 0, 40); if (!empty($recommandGoodsArray)) { $smarty->assign('recommandGoodsArray', $recommandGoodsArray); } // 广告 advBlock $shop_index_advblock_json_data = json_decode(bzf_get_option_value('shop_index_advblock_json_data'), true); if (!empty($shop_index_advblock_json_data)) { // 生成随机的 id 号给 html 使用 foreach ($shop_index_advblock_json_data as &$advBlockObject) { $advBlockObject['id'] = Utils::generateRandomHtmlId(); foreach ($advBlockObject['advBlockImageArray'] as &$advBlockImage) { $advBlockImage['id'] = Utils::generateRandomHtmlId(); } } $smarty->assign('shop_index_advblock_json_data', $shop_index_advblock_json_data); } // 移动端对应的 URL,用于百度页面适配 $smarty->assign('currentPageMobileUrl', RouteHelper::makeShopSystemUrl(PluginHelper::SYSTEM_MOBILE, '/')); out_display: $smarty->assign('seo_title', $smarty->getTemplateVars('seo_title') . ',' . $f3->get('HOST')); $smarty->display('shop_index.tpl', $smartyCacheId); }
public function get($f3) { global $smarty; // 首先做参数合法性验证 $validator = new Validator($f3->get('GET')); $pageNo = $validator->digits('pageNo 参数非法')->min(0, true, 'pageNo 参数非法')->validate('pageNo'); // 搜索参数数组 $searchFormQuery = array(); $searchFormQuery['g.category_id'] = $validator->required('商品分类不能为空')->digits('分类id非法')->min(1, true, '分类id非法')->filter('ValidatorIntValue')->validate('category_id'); // 这里支持多品牌查询 $searchFormQuery['g.brand_id'] = array('=', $validator->validate('brand_id')); // 价格区间查询 $shopPriceMin = $validator->filter('ValidatorFloatValue')->validate('shop_price_min'); $shopPriceMin = null == $shopPriceMin ? null : Money::toStorage($shopPriceMin); $shopPriceMax = $validator->filter('ValidatorFloatValue')->validate('shop_price_max'); $shopPriceMax = null == $shopPriceMax ? null : Money::toStorage($shopPriceMax); $searchFormQuery['g.shop_price'] = array($shopPriceMin, $shopPriceMax); // 属性过滤 $filter = $validator->validate('filter'); // 排序 $orderBy = $validator->oneOf(array('', 'total_buy_number', 'shop_price', 'add_time'))->validate('orderBy'); $orderDir = $validator->oneOf(array('', 'asc', 'desc'))->validate('orderDir'); $orderByParam = array(); if (!empty($orderBy)) { $orderByParam = array(array($orderBy, $orderDir)); } //增加一些我们的缺省排序 $orderByParam[] = array('g.sort_order', 'desc'); $orderByParam[] = array('g.goods_id', 'desc'); // 参数验证 if (!$this->validate($validator) || empty($searchFormQuery)) { goto out_fail; } $pageNo = isset($pageNo) && $pageNo > 0 ? $pageNo : 0; $pageSize = 45; // 每页固定显示 45 个商品 // 生成 smarty 的缓存 id $smartyCacheId = 'Goods|Category|' . md5(json_encode($searchFormQuery) . json_encode($orderByParam) . '_' . $filter . '_' . $pageNo . '_' . $pageSize); // 开启并设置 smarty 缓存时间 enableSmartyCache(true, bzf_get_option_value('smarty_cache_time_goods_search')); if ($smarty->isCached('goods_category.tpl', $smartyCacheId)) { goto out_display; } $goodsCategoryService = new GoodsCategoryService(); $category = $goodsCategoryService->loadCategoryById($searchFormQuery['g.category_id'], 1800); if ($category->isEmpty()) { $this->addFlashMessage('分类[' . $searchFormQuery['category_id'] . ']不存在'); goto out_fail; } $smarty->assign('category', $category); $metaData = json_decode($category['meta_data'], true); $metaFilterArray = @$metaData['filterArray']; // 1. 我们需要在左侧显示分类层级结构 $goodsCategoryTreeArray = $goodsCategoryService->fetchCategoryTreeArray($category['parent_meta_id'], false, 1800); $smarty->assign('goodsCategoryTreeArray', $goodsCategoryTreeArray); /** * 构造 Filter 数组,结构如下 * * array( * '商品品牌' => array( * filterKey => 'brand_id' * filterValueArray => array( array(value=>'13', text=>'品牌1'), ...) * ), * '颜色' => array( * filterKey => 'filter', * filterValueArray => array( array(value=>'13', text=>'品牌1'), ...) * ) * ) * */ $goodsFilterArray = array(); // filter 查询在这个条件下进行 $goodsFilterQueryCond = array_merge($this->searchExtraCondArray, array(array('g.category_id', '=', $searchFormQuery['g.category_id']))); // 2. 商品品牌查询 $goodsBrandIdArray = SearchHelper::search(SearchHelper::Module_Goods, 'distinct(g.brand_id)', array_merge($goodsFilterQueryCond, array(array('g.brand_id > 0'))), null, 0, 0); $brandIdArray = array_map(function ($elem) { return $elem['brand_id']; }, $goodsBrandIdArray); if (!empty($brandIdArray)) { $goodsBrandService = new GoodsBrandService(); $goodsBrandArray = $goodsBrandService->fetchBrandArrayByIdArray(array_unique(array_values($brandIdArray))); $filterBrandArray = array(); foreach ($goodsBrandArray as $brand) { $filterBrandArray[] = array('value' => $brand['brand_id'], 'text' => $brand['brand_name']); } if (!empty($filterBrandArray)) { $goodsFilterArray['品牌'] = array('filterKey' => 'brand_id', 'filterValueArray' => $filterBrandArray); } } // 3. 查询属性过滤 if (!empty($metaFilterArray)) { $goodsTypeService = new GoodsTypeService(); foreach ($metaFilterArray as $filterItem) { $goodsTypeAttrItem = $goodsTypeService->loadGoodsTypeAttrItemById($filterItem['attrItemId']); if ($goodsTypeAttrItem->isEmpty()) { continue; } // 取得商品属性值列表 $goodsAttrItemValueArray = SearchHelper::search(SearchHelper::Module_GoodsAttrGoods, 'min(ga.goods_attr_id) as goods_attr_id, ga.attr_item_value', array_merge($goodsFilterQueryCond, array(array('ga.attr_item_id', '=', $filterItem['attrItemId']))), null, 0, 0, 'ga.attr_item_value'); if (!empty($goodsAttrItemValueArray)) { $filterValueArray = array(); foreach ($goodsAttrItemValueArray as $itemValue) { $filterValueArray[] = array('value' => $itemValue['goods_attr_id'], 'text' => $itemValue['attr_item_value']); } $goodsFilterArray[$goodsTypeAttrItem['meta_name']] = array('filterKey' => 'filter', 'filterValueArray' => $filterValueArray); } else { // 如果这个属性完全没有值(没有一个商品设过任何值),我们弄一个空的 $goodsFilterArray[$goodsTypeAttrItem['meta_name']] = array('filterKey' => 'filter', 'filterValueArray' => array()); } } } // 赋值给模板 if (!empty($goodsFilterArray)) { $smarty->assign('goodsFilterArray', $goodsFilterArray); } // 4. 商品查询 if (!empty($metaFilterArray)) { // 构造 attrItemId $metaFilterTypeIdArray = array(); foreach ($metaFilterArray as $metaFilterItem) { $metaFilterTypeIdArray[] = $metaFilterItem['attrItemId']; } // 构造 filter 参数,注意 filter 参数在 GoodsGoodsAttr 中具体解析 // 合并查询参数 $searchParamArray = array_merge(QueryBuilder::buildSearchParamArray($searchFormQuery), $this->searchExtraCondArray, array(array('ga.filter', implode('.', $metaFilterTypeIdArray), $filter))); } else { // 合并查询参数 $searchParamArray = array_merge(QueryBuilder::buildSearchParamArray($searchFormQuery), $this->searchExtraCondArray); } $totalCount = SearchHelper::count(SearchHelper::Module_GoodsGoodsAttr, $searchParamArray); if ($totalCount <= 0) { goto out_display; // 没有商品,直接显示 } // 页号可能是用户乱输入的,我们需要检查 if ($pageNo * $pageSize >= $totalCount) { goto out_fail; // 返回首页 } $goodsArray = SearchHelper::search(SearchHelper::Module_GoodsGoodsAttr, 'g.goods_id, g.cat_id, g.goods_sn, g.goods_name, g.brand_id, g.goods_number, g.market_price' . ', g.shop_price, g.suppliers_id, g.virtual_buy_number, g.user_buy_number, g.user_pay_number' . ', (g.virtual_buy_number + g.user_pay_number) as total_buy_number', $searchParamArray, $orderByParam, $pageNo * $pageSize, $pageSize); if (empty($goodsArray)) { goto out_display; } $smarty->assign('goodsArray', $goodsArray); $smarty->assign('totalCount', $totalCount); $smarty->assign('pageNo', $pageNo); $smarty->assign('pageSize', $pageSize); // SEO 考虑,网页标题加上分类的名称 $smarty->assign('seo_title', $category['meta_name'] . ',' . $smarty->getTemplateVars('seo_title')); out_display: // 滑动图片广告 $goods_search_adv_slider = json_decode(bzf_get_option_value('goods_search_adv_slider'), true); if (!empty($goods_search_adv_slider)) { $smarty->assign('goods_search_adv_slider', $goods_search_adv_slider); } $smarty->display('goods_category.tpl', $smartyCacheId); return; out_fail: // 失败从这里返回 RouteHelper::reRoute($this, '/'); // 返回首页 }
public function get($f3) { global $smarty; // 首先做参数合法性验证 $validator = new Validator($f3->get('GET')); $pageNo = $validator->digits('pageNo 参数非法')->min(0, true, 'pageNo 参数非法')->validate('pageNo'); // 搜索参数数组 $searchFormQuery = array(); $searchKeywords = $validator->validate('keywords'); $searchFormQuery['g.goods_name'] = $searchKeywords; // 这里支持多品牌查询 $searchFormQuery['g.brand_id'] = array('=', $validator->validate('brand_id')); // 价格区间查询 $shopPriceMin = $validator->filter('ValidatorFloatValue')->validate('shop_price_min'); $shopPriceMin = null == $shopPriceMin ? null : Money::toStorage($shopPriceMin); $shopPriceMax = $validator->filter('ValidatorFloatValue')->validate('shop_price_max'); $shopPriceMax = null == $shopPriceMax ? null : Money::toStorage($shopPriceMax); $searchFormQuery['g.shop_price'] = array($shopPriceMin, $shopPriceMax); // 排序 $orderBy = $validator->oneOf(array('', 'total_buy_number', 'shop_price', 'add_time'))->validate('orderBy'); $orderDir = $validator->oneOf(array('', 'asc', 'desc'))->validate('orderDir'); $orderByParam = array(); if (!empty($orderBy)) { $orderByParam = array(array($orderBy, $orderDir)); } //增加一些我们的缺省排序 $orderByParam[] = array('g.sort_order', 'desc'); $orderByParam[] = array('g.goods_id', 'desc'); // 参数验证 if (!$this->validate($validator) || empty($searchFormQuery)) { goto out_fail; } $pageNo = isset($pageNo) && $pageNo > 0 ? $pageNo : 0; $pageSize = 45; // 每页固定显示 45 个商品 // 生成 smarty 的缓存 id $smartyCacheId = 'Goods|Search|' . md5(json_encode($searchFormQuery) . json_encode($orderByParam) . '_' . $pageNo . '_' . $pageSize); // 开启并设置 smarty 缓存时间 enableSmartyCache(true, bzf_get_option_value('smarty_cache_time_goods_search')); if ($smarty->isCached('goods_search.tpl', $smartyCacheId)) { goto out_display; } $goodsCategoryService = new GoodsCategoryService(); // 1. 我们需要在左侧显示分类层级结构 $goodsCategoryTreeArray = $goodsCategoryService->fetchCategoryTreeArray(0, false, 1800); $smarty->assign('goodsCategoryTreeArray', $goodsCategoryTreeArray); /** * 构造 Filter 数组,结构如下 * * array( * '商品品牌' => array( * filterKey => 'brand_id' * filterValueArray => array( array(value=>'13', text=>'品牌1'), ...) * ), * '颜色' => array( * filterKey => 'filter', * filterValueArray => array( array(value=>'13', text=>'品牌1'), ...) * ) * ) * */ $goodsFilterArray = array(); // filter 查询在这个条件下进行 $goodsFilterQueryCond = array_merge(QueryBuilder::buildSearchParamArray(array('g.goods_name' => $searchKeywords)), $this->searchExtraCondArray); // 2. 商品品牌查询 $goodsBrandIdArray = SearchHelper::search(SearchHelper::Module_Goods, 'distinct(g.brand_id)', array_merge($goodsFilterQueryCond, array(array('g.brand_id > 0'))), null, 0, 0); $brandIdArray = array_map(function ($elem) { return $elem['brand_id']; }, $goodsBrandIdArray); if (!empty($brandIdArray)) { $goodsBrandService = new GoodsBrandService(); $goodsBrandArray = $goodsBrandService->fetchBrandArrayByIdArray(array_unique(array_values($brandIdArray))); $filterBrandArray = array(); foreach ($goodsBrandArray as $brand) { $filterBrandArray[] = array('value' => $brand['brand_id'], 'text' => $brand['brand_name']); } if (!empty($filterBrandArray)) { $goodsFilterArray['品牌'] = array('filterKey' => 'brand_id', 'filterValueArray' => $filterBrandArray); } } if (!empty($goodsFilterArray)) { $smarty->assign('goodsFilterArray', $goodsFilterArray); } // 3. 商品属性过滤 TODO: 等以后扩展,看看 Search 怎么做属性过滤 // 4. 商品查询 // 构造 filter 参数,注意 filter 参数在 GoodsGoodsAttr 中具体解析 // 合并查询参数 $searchParamArray = array_merge(QueryBuilder::buildSearchParamArray($searchFormQuery), $this->searchExtraCondArray); $totalCount = SearchHelper::count(SearchHelper::Module_GoodsGoodsAttr, $searchParamArray); if ($totalCount <= 0) { goto out_display; // 没有商品,直接显示 } // 页号可能是用户乱输入的,我们需要检查 if ($pageNo * $pageSize >= $totalCount) { goto out_fail; // 返回首页 } $goodsArray = SearchHelper::search(SearchHelper::Module_GoodsGoodsAttr, 'g.goods_id, g.cat_id, g.goods_sn, g.goods_name, g.brand_id, g.goods_number, g.market_price' . ', g.shop_price, g.suppliers_id, g.virtual_buy_number, g.user_buy_number, g.user_pay_number' . ', (g.virtual_buy_number + g.user_pay_number) as total_buy_number', $searchParamArray, $orderByParam, $pageNo * $pageSize, $pageSize); if (empty($goodsArray)) { goto out_display; } $smarty->assign('goodsArray', $goodsArray); $smarty->assign('totalCount', $totalCount); $smarty->assign('pageNo', $pageNo); $smarty->assign('pageSize', $pageSize); // SEO 考虑,网页标题加上分类的名称 $smarty->assign('seo_title', '商品搜索,' . $searchKeywords . ',' . $smarty->getTemplateVars('seo_title')); out_display: // 滑动图片广告 $goods_search_adv_slider = json_decode(bzf_get_option_value('goods_search_adv_slider'), true); if (!empty($goods_search_adv_slider)) { $smarty->assign('goods_search_adv_slider', $goods_search_adv_slider); } $smarty->display('goods_search.tpl', $smartyCacheId); return; out_fail: // 失败从这里返回 RouteHelper::reRoute($this, '/'); // 返回首页 }
public function get($f3) { global $smarty; // 首先做参数合法性验证 $validator = new Validator($f3->get('GET')); $goods_id = $validator->required('商品id不能为空')->digits('商品id非法')->min(1, true, '商品id非法')->validate('goods_id'); $pageNo = $validator->digits()->min(0)->validate('pageNo'); if (!$this->validate($validator)) { goto out_fail; } // 生成 smarty 的缓存 id $smartyCacheId = 'Goods|' . $goods_id . '|AjaxGoodsComment_' . $pageNo; // 开启并设置 smarty 缓存时间 enableSmartyCache(true, bzf_get_option_value('smarty_cache_time_goods_view')); if ($smarty->isCached('ajax_goodscomment.tpl', $smartyCacheId)) { goto out_display; } $this->preparePage($goods_id, $pageNo); out_display: $f3->expire(600); // 让客户端缓存 10 分钟 $smarty->display('ajax_goodscomment.tpl', $smartyCacheId); return; out_fail: // output nothing return; }
public function get($f3) { global $smarty; // 首先做参数合法性验证 $validator = new Validator($f3->get('GET')); $goods_id = $validator->required('商品id不能为空')->digits('商品id非法')->min(1, true, '商品id非法')->validate('goods_id'); if (!$this->validate($validator)) { goto out_fail; } // 生成 smarty 的缓存 id $smartyCacheId = 'Goods|' . $goods_id . '|View'; // 开启并设置 smarty 缓存时间 enableSmartyCache(true, bzf_get_option_value('smarty_cache_time_goods_view')); if ($smarty->isCached('goods_view.tpl', $smartyCacheId)) { goto out_display; } // 查询商品信息 $goodsBasicService = new GoodsBasicService(); $goodsInfo = $goodsBasicService->loadGoodsById($goods_id); // 商品不存在,退出 if ($goodsInfo->isEmpty() || !Utils::isTagExist(PluginHelper::SYSTEM_SHOP, $goodsInfo['system_tag_list'])) { $this->addFlashMessage('商品 [' . $goods_id . '] 不存在'); goto out_fail; } // 取得商品的分类层级 $goodsCategoryLevelArray = array(); $goodsCategoryService = new GoodsCategoryService(); $categoryLevel = 5; // 最多取 5 层分类 $currentCategoryId = $goodsInfo['cat_id']; for (; $categoryLevel > 0; $categoryLevel--) { $category = $goodsCategoryService->loadCategoryById($currentCategoryId, 1800); if ($category->isEmpty()) { break; } array_unshift($goodsCategoryLevelArray, $category); if ($category['parent_meta_id'] <= 0) { break; } $currentCategoryId = $category['parent_meta_id']; } // 取商品推广信息设置 $goodsPromote = $goodsBasicService->loadGoodsPromoteByGoodsId($goods_id); // 取商品图片集 $goodsGalleryArray = GoodsGalleryCache::getGoodsGallery($goods_id); foreach ($goodsGalleryArray as &$galleryItem) { $galleryItem['img_original'] = RouteHelper::makeImageUrl($galleryItem['img_original']); $galleryItem['img_url'] = RouteHelper::makeImageUrl($galleryItem['img_url']); $galleryItem['thumb_url'] = RouteHelper::makeImageUrl($galleryItem['thumb_url']); } unset($galleryItem); // 取相互关联的商品 $linkGoodsArray = $goodsBasicService->fetchLinkGoodsArray($goods_id); // 相同供货商的商品,一起购买只收一份邮费 $goodsSupplierService = new GoodsSupplierService(); // 取得供货商下面的商品总数,总数只缓存 10 分钟 $supplierTotalGoodsCount = $goodsSupplierService->countSupplierGoodsArray($goodsInfo['suppliers_id'], 600); // 随机挑选 10 个商品 $supplierGoodsSize = 10; $supplierGoodsOffset = $supplierTotalGoodsCount <= $supplierGoodsSize ? 0 : mt_rand(0, $supplierTotalGoodsCount - $supplierGoodsSize); $supplierGoodsArray = $goodsSupplierService->fetchSupplierGoodsArray($goodsInfo['suppliers_id'], $supplierGoodsOffset, $supplierGoodsSize); // 把自己去除掉 $supplierGoodsKeyExcludeArray = array(); foreach ($supplierGoodsArray as $supplierGoodsKey => $supplierGoodsItem) { if ($supplierGoodsItem['goods_id'] == $goods_id) { $supplierGoodsKeyExcludeArray[] = $supplierGoodsKey; } } foreach ($supplierGoodsKeyExcludeArray as $supplierGoodsKey) { unset($supplierGoodsArray[$supplierGoodsKey]); } // 设置商品页面的 SEO 信息 $smarty->assign('seo_title', $goodsInfo['seo_title'] . ',' . $f3->get('sysConfig[site_name]')); $smarty->assign('seo_description', $goodsInfo['seo_description']); $smarty->assign('seo_keywords', $goodsInfo['seo_keyword']); // 给模板赋值 $smarty->assign('goodsInfo', $goodsInfo); $smarty->assign('goodsPromote', $goodsPromote); // 商品购买选择的规格 if (!empty($goodsInfo['goods_spec'])) { $goodsSpecService = new GoodsSpecService(); $goodsSpecService->initWithJson($goodsInfo['goods_spec']); // 只显示有库存的商品规格 $goodsSpecData = $goodsSpecService->getBuyableData(); $smarty->assign($goodsSpecData); $smarty->assign('goodsSpecJson', json_encode($goodsSpecData)); } // 商品的类型属性 if ($goodsInfo['type_id'] > 0) { $goodsTypeService = new GoodsTypeService(); $goodsAttrTreeTable = $goodsTypeService->fetchGoodsAttrItemValueTreeTable($goodsInfo['goods_id'], $goodsInfo['type_id']); $smarty->assign('goodsAttrTreeTable', $goodsAttrTreeTable); } if (!empty($goodsCategoryLevelArray)) { $smarty->assign('goodsCategoryLevelArray', $goodsCategoryLevelArray); } if (!Utils::isEmpty($goodsGalleryArray)) { $smarty->assign('goodsGalleryArray', $goodsGalleryArray); } if (!Utils::isEmpty($linkGoodsArray)) { $smarty->assign('linkGoodsArray', $linkGoodsArray); } if (!Utils::isEmpty($supplierGoodsArray)) { $smarty->assign('supplierGoodsArray', $supplierGoodsArray); } // 滑动图片广告 $goods_view_adv_slider = json_decode(bzf_get_option_value('goods_view_adv_slider'), true); if (!empty($goods_view_adv_slider)) { $smarty->assign('goods_view_adv_slider', $goods_view_adv_slider); } // 移动端对应的 URL,用于百度页面适配 $smarty->assign('currentPageMobileUrl', RouteHelper::makeShopSystemUrl(PluginHelper::SYSTEM_MOBILE, '/Goods/View', array('goods_id' => $goods_id))); out_display: $smarty->display('goods_view.tpl', $smartyCacheId); return; out_fail: // 失败从这里返回 RouteHelper::reRoute($this, '/'); // 返回首页 }