';
foreach([['Sale','Current offers from the emporium',array_values(array_filter($rows,fn($r)=>in_array($r['products_id'],$saleIds))),'catalog/sales'],['Featured','Selected pieces from the realms',array_values(array_filter($rows,fn($r)=>in_array($r['products_id'],$featuredIds))),'catalog/featured-products'],['New arrivals','Recently added to the collection',array_slice($rows,0,6),'catalog/products-new']] as [$title,$sub,$items,$route]){
$sectionClass=$title==='Sale'?' dune-store-section--sale':($title==='Featured'?' dune-store-section--featured':'');
$out.='
'.($title==='Sale'?'SALE ':'').$title.'
'.$sub.'
View all ↗';
if(!$items)$out.=''.($title==='Sale'?'There are no active sale offers.':'Featured products have not been selected yet.').'
';
else{
$out.='';
foreach(array_slice($items,0,6) as $p){
$url=Html::encode(\yii\helpers\Url::to(['catalog/product','products_id'=>$p['products_id']]));
$image=Html::encode(\common\classes\Images::getImageUrl($p['products_id'],'Small',1));
$currencies=Yii::$container->get('currencies');$tax=\common\helpers\Tax::get_tax_rate($p['products_tax_class_id']);
$normal=\common\helpers\Product::get_products_price($p['products_id'],1,$p['products_price']);
$special=\common\helpers\Product::get_products_special_price($p['products_id'],1);
$price=$currencies->display_price($normal,$tax);
if($special!==false&&$special!==null&&(float)$special>=0&&(float)$special<(float)$normal){
$saving=(int)round((1-(float)$special/(float)$normal)*100);
$price='
'.$price.''.$currencies->display_price($special,$tax).'Save '.$saving.'%';
}
$out.='
'.($p['kind']==='sash'?'MADE TO ORDER':'CATALOGUE PREVIEW').''.$price.'
View details';
}
$out.='
';
}
$out.='';
}
$out.='