@if(!empty($sampling) )
@endif
@if(!empty($upcoming) )
@endif
@if(!empty($new_arrival))
@endif
@if(!empty($repeatArticle))
@endif
@if(!empty($clearence) )
@endif
@foreach($category as $cat)
@php
$section= \App\Section::where('is_active',1)->where('id',$cat->id)->Where('parent_id','!=',0)->first();
if(empty($section))
{
continue;
}
$articleList = \App\Article::where('category_id', $cat->id)->OrWhere('oc_wh_products.sub_category_id', $cat->id)
->where('oc_wh_products.is_active', '=', 1)->get()->pluck('code')->toArray();
if (($key = array_search($pos_id, $partyStore)) !== false) {
$wareStock = \App\WarehouseProduct::where('warehouse_id',$warehouse->id);
}else{
$wareStock = \App\WarehouseProduct_1::where('warehouse_id',1);
}
$warticles = $wareStock->distinct('article')->whereIn('brand_id',explode(',',$brand_active))->whereIn('article',$articleList)
->where('qty','>',0)->get()->pluck('article')->toArray();
if(empty($warticles)){
continue;
}
$mainImage = '';
$product = \DB::table('oc_wh_products')->Join('oc_wh_product_images', 'oc_wh_products.id', '=', 'oc_wh_product_images.product_id')
->where('category_id', $cat->id)
->OrWhere('oc_wh_products.sub_category_id', $cat->id)
->where('oc_wh_products.is_active', '=', 1)
->whereIn('oc_wh_products.code',$warticles)
->whereIn('sort_order', [0, 1])
->orderBy('oc_wh_products.id','DESC')
->first();
if (!empty($product))
{
if (!empty($product->imgname))
{
$mainImage = asset('uploads/articles/photos/thumbnail' . $product->imgname);
}
}
$mainImage = empty($mainImage) ? asset('placeholder.png') : $mainImage;
@endphp
@if(!empty($product))
@endif
@endforeach