@php
if($sliders->category_id != 0 && $sliders->child == 0){
$item = App\Category::where('id',$sliders->category_id)->first();
}elseif ($sliders->child != 0 && $sliders->grand_id == 0) {
$item = App\Subcategory::where('id',$sliders->child)->first();
}elseif($sliders->category_id != 0 && $sliders->child != 0 && $sliders->grand_id !=0) {
$item = App\Grandcategory::where('id',$sliders->grand_id)->first();
}
$price_array = array();
@endphp
@foreach($item->products as $old)
@foreach($old->subvariants as $orivar)
@if($price_login == 0 || Auth::check())
@php
$convert_price = 0;
$show_price = 0;
$commision_setting = App\CommissionSetting::first();
if($commision_setting->type == "flat"){
$commission_amount = $commision_setting->rate;
if($commision_setting->p_type == 'f'){
$totalprice = $old->vender_price+$orivar->price+$commission_amount;
$totalsaleprice = $old->vender_offer_price + $orivar->price + $commission_amount;
if($old->vender_offer_price == 0){
$totalprice;
array_push($price_array, $totalprice);
}else{
$totalsaleprice;
$convert_price = $totalsaleprice==''?$totalprice:$totalsaleprice;
$show_price = $totalprice;
array_push($price_array, $totalsaleprice);
}
}else{
$totalprice = ($old->vender_price+$orivar->price)*$commission_amount;
$totalsaleprice = ($old->vender_offer_price+$orivar->price)*$commission_amount;
$buyerprice = ($old->vender_price+$orivar->price)+($totalprice/100);
$buyersaleprice = ($old->vender_offer_price+$orivar->price)+($totalsaleprice/100);
if($old->vender_offer_price ==0){
$bprice = round($buyerprice,2);
array_push($price_array, $bprice);
}else{
$bsprice = round($buyersaleprice,2);
$convert_price = $buyersaleprice==''?$buyerprice:$buyersaleprice;
$show_price = $buyerprice;
array_push($price_array, $bsprice);
}
}
}else{
$comm = App\Commission::where('category_id',$old->category_id)->first();
if(isset($comm)){
if($comm->type=='f'){
$price = $old->vender_price + $comm->rate+$orivar->price;
$offer = $old->vender_offer_price + $comm->rate+$orivar->price;
$convert_price = $offer==''?$price:$offer;
$show_price = $price;
if($old->vender_offer_price == 0){
array_push($price_array, $price);
}else{
array_push($price_array, $offer);
}
}
else{
$commission_amount = $comm->rate;
$totalprice = ($old->vender_price+$orivar->price)*$commission_amount;
$totalsaleprice = ($old->vender_offer_price+$orivar->price)*$commission_amount;
$buyerprice = ($old->vender_price+$orivar->price)+($totalprice/100);
$buyersaleprice = ($old->vender_offer_price+$orivar->price)+($totalsaleprice/100);
if($old->vender_offer_price ==0){
$bprice = round($buyerprice,2);
array_push($price_array, $bprice);
}else{
$bsprice = round($buyersaleprice,2);
$convert_price = $buyersaleprice==''?$buyerprice:$buyersaleprice;
$show_price = round($buyerprice,2);
array_push($price_array, $bsprice);
}
}
}
}
@endphp
@endif
@endforeach
@endforeach
@if($price_login == 0 || Auth::check())
@endif
@if($sliders->category_id != 0 && $sliders->child == 0)
{{ url('shop?category='.$sliders->category_id.'&start='.$startp*$conversion_rate.'&end='.$endp*$conversion_rate) }}
@elseif($sliders->child != 0 && $sliders->grand_id == 0)
{{ url('shop?category='.$sliders->category_id.'&sid='.$sliders->child.'&start='.$startp*$conversion_rate.'&end='.$endp*$conversion_rate) }}
{{ url('shop?category='.$sliders->category_id.'&sid='.$sliders->child.'&chid='.$sliders->grand_id.'&start='.$startp*$conversion_rate.'&end='.$endp*$conversion_rate) }}
@endif