Skip to content

Commit

Permalink
fecmall后台开启和关闭分类显示,以及价格过滤,按钮不好用的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
fancyecommerce committed Nov 18, 2020
1 parent 015428d commit 6fbeb2c
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 2 deletions.
8 changes: 8 additions & 0 deletions app/appfront/modules/Catalog/block/category/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ protected function getFilterCategoryHtml($filter_category = '')
if (!$filter_category) {
$filter_category = $this->getFilterCategory();
}
if (!Yii::$service->category->isEnableFilterSubCategory()) {

return $str;
}
if (is_array($filter_category) && !empty($filter_category)) {
$str .= '<ul>';
foreach ($filter_category as $cate) {
Expand Down Expand Up @@ -330,6 +334,10 @@ protected function getRefineByInfo()
protected function getFilterPrice()
{
$filter = [];
if (!Yii::$service->category->isEnableFilterPrice()) {

return $filter;
}
//$priceInfo = Yii::$app->controller->module->params['category_query'];
$appName = Yii::$service->helper->getAppName();
$category_query_priceRange = Yii::$app->store->get($appName.'_catalog','category_query_priceRange');
Expand Down
8 changes: 8 additions & 0 deletions app/apphtml5/modules/Catalog/block/category/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ protected function getFilterCategoryHtml($filter_category = '')
if (!$filter_category) {
$filter_category = $this->getFilterCategory();
}
if (!Yii::$service->category->isEnableFilterSubCategory()) {

return $str;
}
if (is_array($filter_category) && !empty($filter_category)) {
$str .= '<ul>';
foreach ($filter_category as $cate) {
Expand Down Expand Up @@ -317,6 +321,10 @@ protected function getRefineByInfo()
protected function getFilterPrice()
{
$filter = [];
if (!Yii::$service->category->isEnableFilterPrice()) {

return $filter;
}
//$priceInfo = Yii::$app->controller->module->params['category_query'];
$appName = Yii::$service->helper->getAppName();
$category_query_priceRange = Yii::$app->store->get($appName.'_catalog','category_query_priceRange');
Expand Down
12 changes: 10 additions & 2 deletions app/appserver/modules/Catalog/controllers/CategoryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,10 @@ public function actionProduct()
protected function getFilterCategory()
{
$arr = [];
if (!Yii::$service->category->isEnableFilterSubCategory()) {

return $arr;
}
$category_id = $this->_primaryVal;
$parent_id = $this->_category['parent_id'];
$filter_category = Yii::$service->category->getFilterCategory($category_id, $parent_id);
Expand Down Expand Up @@ -442,10 +446,14 @@ protected function getFilterInfo()
*/
protected function getFilterPrice()
{
$symbol = Yii::$service->page->currency->getCurrentSymbol();

$currenctPriceFilter = Yii::$app->request->get('filterPrice');
$filter = [];
if (!Yii::$service->category->isEnableFilterPrice()) {

return $filter;
}
$symbol = Yii::$service->page->currency->getCurrentSymbol();
$currenctPriceFilter = Yii::$app->request->get('filterPrice');
//$priceInfo = Yii::$app->controller->module->params['category_query'];
$appName = Yii::$service->helper->getAppName();
$category_query_priceRange = Yii::$app->store->get($appName.'_catalog','category_query_priceRange');
Expand Down
42 changes: 42 additions & 0 deletions services/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -447,4 +447,46 @@ protected function getFilterArr($str)

return $arr;
}
/**
* 是否在分类产品列表页面,进行价格过滤
*/
public function isEnableFilterPrice()
{
$appName = Yii::$service->helper->getAppName();
$category_filter_price = Yii::$app->store->get($appName.'_catalog','category_filter_price');
if ($category_filter_price == Yii::$app->store->enable) {

return true;
}

return false;
}


/**
* 是否在分类产品列表页面,进行子分类显示
*/
public function isEnableFilterSubCategory()
{
$appName = Yii::$service->helper->getAppName();
$category_filter_category = Yii::$app->store->get($appName.'_catalog','category_filter_category');
if ($category_filter_category == Yii::$app->store->enable) {

return true;
}

return false;
}












}

0 comments on commit 6fbeb2c

Please sign in to comment.