@foreach ($styles as $style)
@php
$args = [];
$routeParams = [];
if($style->collection_id && $collection = $helper->getProductCollection(['id' => $style->collection_id])){
$routeParams = $collection->urlParams;
$args = $collection->getProductParams();
}
// $args['@limit'] = $style->limit && $style->limit > 0 ? $style->limit : 4;
if($style->isComponentData){
$args['@limit'] = $style->limit && $style->limit > 0 ? $style->limit : 8;
if($style->sorttype){
$args['@sorttype'] = $style->sorttype;
$routeParams['sorttype'] = $style->sorttype;
}
if($style->categories){
$args['@categories'] = $style->categories;
$routeParams['categories'] = is_array($style->categories)?implode(',', $style->categories):'';
}
if($style->match_label && $style->match_label != 'none' && $style->labels){
$routeParams[$style->match_label == 'all' ? 'match_labels' : 'has_label'] = is_array($style->labels)?implode(',', $style->labels):'';
$args[$style->match_label == 'all' ? '@matchAllLabel' : '@hasAnyLabel'] = $style->labels;
// $args["p.p"] = 0;
}
if($style->match_tag && $style->match_tag != 'none' && $style->tags){
$routeParams[$style->match_tag == 'all' ? 'match_tags' : 'has_tag'] = is_array($style->tags)?implode(',', $style->tags):"";
$args[$style->match_tag == 'all' ? '@matchAllTag' : '@hasAnyTag'] = $style->tags;
}
}else{
$args['@limit'] = $style->limit && $style->limit > 0 ? $style->limit : 8;
$args['@style'] = $style->id;
$routeParams['style'] = $style->id;
}
$args = array_merge($args, [
'@with' => ['promoAvailable'],
'@withReviews' => true,
'@withOption' => true,
'@withCategory' => true,
'@withGallery' => true,
]);
@endphp
@php
$products = $helper->getProducts($args);
@endphp
{{-- @include($_template.'products.slides', [
'products' => $products,
'use_header' => true,
'use_thubnail_slide' => true,
'title' => 'Phong cách "' . ($style->name?$style->name:$style->title) . '"',
'seemore' => route('web.products', $routeParams),
'slide_class' => 'style-product-slide',
'block_class' => 'd-none d-md-block',
'slide_thumbnail_class' => 'style-thumbnail-slide'
]) --}}
@include($_template.'products.list', [
'products' => $products,
'use_header' => true,
'use_thubnail_slide' => true,
'title' => 'Phong cách "' . ($style->name?$style->name:$style->title) . '"',
'list_class' => '',
// 'use_thubnail_slide' => true
])
@endforeach