Commit 92f7771e4e622fb79a18934eccf48162e1589a25
1 parent
6edfb8da
hide "open-delivery-modal hidden_modal"
Showing
1 changed file
with
11 additions
and
8 deletions
Show diff stats
src/lib/common.php
... | ... | @@ -1314,17 +1314,20 @@ namespace |
1314 | 1314 | } |
1315 | 1315 | |
1316 | 1316 | public function containsPromoCode($promo_code, $item) { |
1317 | - $group_ids = $this->parseArray($promo_code['group_ids']); | |
1318 | - /*$catalog_ids = $this->parseArray($promo_code['catalog_ids']);*/ | |
1317 | + if(isset($promo_code['group_ids'])){ | |
1318 | + $group_ids = $this->parseArray($promo_code['group_ids']); | |
1319 | + /*$catalog_ids = $this->parseArray($promo_code['catalog_ids']);*/ | |
1319 | 1320 | |
1320 | - if(!empty($group_ids) && in_array($item['id'], $group_ids)) | |
1321 | - return true; | |
1321 | + if(!empty($group_ids) && in_array($item['id'], $group_ids)) | |
1322 | + return true; | |
1323 | + | |
1324 | + /*$catalog_tree = $this->getDi()->get('models')->getCatalog()->getCatalogWithTree($item['catalog']); | |
1325 | + $path = $this->parseArray($catalog_tree[0]['path']); | |
1322 | 1326 | |
1323 | - /*$catalog_tree = $this->getDi()->get('models')->getCatalog()->getCatalogWithTree($item['catalog']); | |
1324 | - $path = $this->parseArray($catalog_tree[0]['path']); | |
1327 | + if(!empty($catalog_ids) && !empty(array_intersect($path, $catalog_ids))) | |
1328 | + return true;*/ | |
1329 | + } | |
1325 | 1330 | |
1326 | - if(!empty($catalog_ids) && !empty(array_intersect($path, $catalog_ids))) | |
1327 | - return true;*/ | |
1328 | 1331 | |
1329 | 1332 | return false; |
1330 | 1333 | } | ... | ... |