diff --git a/console/controllers/SiteMapController.php b/console/controllers/SiteMapController.php index c2014a4..ce36756 100644 --- a/console/controllers/SiteMapController.php +++ b/console/controllers/SiteMapController.php @@ -28,7 +28,7 @@ class SiteMapController extends Controller private $count = 1; - public function checkFilter($category, $filter){ + public function checkFilter($category, $filter) { $productModel = new ProductFrontendSearch(); $productProvider = $productModel->search($category, $filter); if(!empty($productProvider->models)){ @@ -38,7 +38,7 @@ class SiteMapController extends Controller } } - public function getAddStatic(){ + public function getAddStatic() { return [ 'http://www.rukzachok.com.ua', 'http://www.rukzachok.com.ua/catalog' @@ -52,22 +52,21 @@ class SiteMapController extends Controller public function getSeoLinks() { return Seo::find()->where(['meta' => ''])->all(); - } - public function getStaticPages(){ + public function getStaticPages() { return Page::find()->all(); } - public function getCategories(){ - return Category::find()->all(); + public function getCategories() { + return Category::find()->where(['meta_robots' => ''])->all(); } - public function getArticles(){ + public function getArticles() { return Articles::find()->all(); } - public function getBrands($category){ + public function getBrands($category) { return $category->brands; } @@ -76,14 +75,13 @@ class SiteMapController extends Controller * @param $category Category; * @return mixed */ - - public function getFilters($category){ + public function getFilters($category) { return $category->getActiveFilters()->all(); } - public function checkUrl($url){ + public function checkUrl($url) { if (preg_match('/filters:[^=]+=[^=]+;[^=]+=[^=]+/', $url)) { $reverse_url = preg_replace('/filters:([^=]+=[^=]+);([^=]+=[^=]+)/', 'filters:$2;$1', $url); @@ -97,7 +95,7 @@ class SiteMapController extends Controller } } - public function createRow( $url, $priority, &$content ){ + public function createRow( $url, $priority, &$content ) { if($this->checkUrl($url)){ print $this->count++ . "\n"; $content .= '' . @@ -160,7 +158,7 @@ class SiteMapController extends Controller } - foreach($this->getCategories() as $category){ + foreach($this->getCategories() as $category) { foreach ($this->getBrands($category) as $brand) { if($this->checkFilter($category, ['brands' => [$brand->brand_id]])){ $url = Url::to(['catalog/category', 'category' => $category, 'filters' => ['brands' => [$brand->alias]]]) ; @@ -170,7 +168,7 @@ class SiteMapController extends Controller } - foreach($this->getCategories() as $category){ + foreach($this->getCategories() as $category) { foreach ($this->getFilters($category) as $filter) { if($this->checkFilter($category, [$filter['group_alias'] => [$filter['option_alias']]])){ $url = Url::to(['catalog/category', 'category' => $category, 'filters' => [$filter['group_alias'] => [$filter['option_alias']]] ]); @@ -180,7 +178,7 @@ class SiteMapController extends Controller } } - foreach($this->getSeoLinks() as $link){ + foreach($this->getSeoLinks() as $link) { $url = Yii::$app->urlManager->baseUrl.$link->url; $this->createRow($url , 0.7, $content); @@ -188,7 +186,7 @@ class SiteMapController extends Controller - foreach($this->getCategories() as $category){ + foreach($this->getCategories() as $category) { foreach ($this->getFilters($category) as $filter1) { foreach ($this->getFilters($category) as $filter2) { if($this->checkFilter($category, [$filter1['group_alias'] => [$filter1['option_alias']],$filter2['group_alias'] => [$filter2['option_alias']]] )){ -- libgit2 0.21.4