Commit a54d86cf1186d038dd3602f2b5d3a713ff8f3849
1 parent
4ec7f039
sitemapcontroller check reverse filters
Showing
1 changed file
with
11 additions
and
6 deletions
Show diff stats
console/controllers/SiteMapController.php
| ... | ... | @@ -31,11 +31,11 @@ class SiteMapController extends Controller |
| 31 | 31 | public function checkFilter($category, $filter){ |
| 32 | 32 | $productModel = new ProductFrontendSearch(); |
| 33 | 33 | $productProvider = $productModel->search($category, $filter); |
| 34 | - if(!empty($productProvider->models)){ | |
| 34 | + if(!empty($productProvider->models)){ | |
| 35 | 35 | return true; |
| 36 | - } else { | |
| 36 | + } else { | |
| 37 | 37 | return false; |
| 38 | - } | |
| 38 | + } | |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | public function getAddStatic(){ |
| ... | ... | @@ -84,11 +84,16 @@ class SiteMapController extends Controller |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | public function checkUrl($url){ |
| 87 | - if(!in_array($url, $this->urlList)){ | |
| 87 | + | |
| 88 | + if (preg_match('/filters:[^=]+=[^=]+;[^=]+=[^=]+/', $url)) { | |
| 89 | + $reverse_url = preg_replace('/filters:([^=]+=[^=]+);([^=]+=[^=]+)/', 'filters:$2;$1', $url); | |
| 90 | + } | |
| 91 | + | |
| 92 | + if(in_array($url, $this->urlList) || (isset($reverse_url) && in_array($url, $reverse_url))){ | |
| 93 | + return false; | |
| 94 | + } else { | |
| 88 | 95 | $this->urlList[] = $url; |
| 89 | 96 | return true; |
| 90 | - } else { | |
| 91 | - return false; | |
| 92 | 97 | } |
| 93 | 98 | } |
| 94 | 99 | ... | ... |