@php $title = $data->title; $args = []; $routeParams = []; $url = route('web.products'); $category_mode = false; $categories = []; if ($data->list_type == 'collection') { if ($data->collection_id && ($collection = $helper->getProductCollection(['id' => $data->collection_id]))) { if (!$title) { $title = $collection->name; } $args = $collection->getProductParams(); $args['@limit'] = $data->limit && $data->limit > 0 ? $data->limit : 4; $routeParams = $collection->urlParams; // $url.="?collection=" . $data->collection_id; } } else { $args['@limit'] = $data->limit && $data->limit > 0 ? $data->limit : 4; $args['@sorttype'] = $data->sorttype(1); $routeParams['sorttype'] = $data->sorttype(1); // $url.="?sorttype=" . $data->sorttype(1); if ($data->match_label && $data->match_label != 'none' && $data->labels) { $args[$data->match_label == 'all' ? '@matchAllLabel' : '@hasAnyLabel'] = $data->labels; $routeParams['labels'] = implode(',', $data->labels); } if ($data->match_tag && $data->match_tag != 'none' && $data->tags) { $args[$data->match_tag == 'all' ? '@matchAllTag' : '@hasAnyTag'] = $data->tags; $routeParams['labels'] = implode(',', $data->labels); // $url.="&match_tags=" .implode(',', $data->tags); } if ($data->categories) { $args['@anyCategories'] = $data->categories; $routeParams['categories'] = implode(',', $data->categories); } } if ($args) { $args = array_merge($args, [ '@withPromoAvailable' => true, '@withLabels' => function($query){$query->with('localeContent');}, '@withOption' => true, '@withGallery' => true, '@withCategory' => [ '@withLocaleContent' => true ], ]); $url = route('web.products', $routeParams); } @endphp