diff --git a/website/ops/oscommerce/DuneShopController.php b/website/ops/oscommerce/DuneShopController.php index dd8a4228..53984aa1 100644 --- a/website/ops/oscommerce/DuneShopController.php +++ b/website/ops/oscommerce/DuneShopController.php @@ -11,23 +11,30 @@ final class DuneShopController extends Sceleton { $sashes=count(array_filter($rows,fn($r)=>$r['kind']==='sash'));$ranks=count(array_filter($rows,fn($r)=>$r['kind']==='rank')); $base=fn($route)=>Html::encode(\yii\helpers\Url::to([$route])); $out='
THE DUNEREALMS EMPORIUM

Carry a piece of the realms.

Ceremonial sashes, personal keepsakes and ways to support the community.

Browse the collection
'; - $tiles=[['Ceremonial sashes',$sashes.' designs · made to order','catalog/all-products','nav-clan-v2.webp','sash'],['Donor ranks',$ranks.' ways to support the realms','catalog/all-products','nav-account-v2.webp','rank'],['Sale',count($saleIds)?'Explore current offers':'No sales active right now','catalog/sales','nav-exchange-v2.webp','']]; + $tiles=[['Sale',count($saleIds)?'Explore current offers':'No sales active right now','catalog/sales','nav-exchange-v2.webp',''],['Ceremonial sashes',$sashes.' designs · made to order','catalog/all-products','nav-clan-v2.webp','sash'],['Donor ranks',$ranks.' ways to support the realms','catalog/all-products','nav-account-v2.webp','rank']]; $out.=''; - foreach([['New arrivals','Recently added to the collection',array_slice($rows,0,6),'catalog/products-new'],['Featured','Selected pieces from the realms',array_values(array_filter($rows,fn($r)=>in_array($r['products_id'],$featuredIds))),'catalog/featured-products'],['Sale','Current offers from the emporium',array_values(array_filter($rows,fn($r)=>in_array($r['products_id'],$saleIds))),'catalog/sales']] as [$title,$sub,$items,$route]){ - $out.='

'.$title.'

'.$sub.'

View all ↗
'; + 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]){ + $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)); - $price=Yii::$container->get('currencies')->display_price(\common\helpers\Product::get_products_price($p['products_id'],1,$p['products_price']),\common\helpers\Tax::get_tax_rate($p['products_tax_class_id'])); + $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.=''; } $out.='
'; diff --git a/website/ops/oscommerce/dune-shop-cards.css b/website/ops/oscommerce/dune-shop-cards.css index c04c2e76..6e18c31a 100644 --- a/website/ops/oscommerce/dune-shop-cards.css +++ b/website/ops/oscommerce/dune-shop-cards.css @@ -30,3 +30,5 @@ html,body{height:auto!important;min-height:0!important}.main-content{min-height: @media(min-width:1500px){.dune-store-products{grid-template-columns:repeat(4,minmax(0,1fr))}}@media(max-width:900px){.dune-store-categories{grid-template-columns:1fr}.dune-store-products{grid-template-columns:repeat(2,minmax(0,1fr))}.dune-store-welcome{padding:28px}.dune-store-welcome>img{width:110px;height:110px}}@media(max-width:550px){.dune-store-welcome{padding:24px;gap:12px}.dune-store-welcome>img{display:none}.dune-store-products{grid-template-columns:1fr}.dune-store-section{padding:18px}.dune-store-section>header{align-items:flex-start}.dune-store-product-art{height:210px}.dune-store-product-art img{height:200px!important}.header-middle>.block{flex-wrap:wrap!important;justify-content:center!important}.header-middle .w-search{flex-basis:100%!important}} /* Catalogue navigation, filtering and pagination share the framed dev-alpha system. */ #box-110903{padding:0!important;background:transparent!important}#box-110904{padding:20px!important;border:1px solid #6b7048!important;border-radius:12px!important;background:linear-gradient(145deg,#1a3b2b,#10291f)!important;box-sizing:border-box!important}#box-110904 h2,#box-110904 h3,#box-110904 .title,.leftCategories .title{color:#e5ce8e!important;font-size:16px!important;font-weight:600!important}.leftCategories ul{list-style:none!important;padding:0!important}.leftCategories a,.w-categories a,.w-menu-simple a{display:block;padding:10px 12px!important;border-radius:7px;color:#d5dfca!important;font-size:13px!important;text-decoration:none!important}.leftCategories a:hover,.w-categories a:hover,.w-menu-simple a:hover{background:#2c4c34!important;color:#f3dd9d!important}.w-catalog-sorting,.w-catalog-items-on-page,.w-catalog-listing-look,.w-catalog-compare-button{padding:10px 12px!important;background:#112b20!important;border:1px solid #4f6544!important;border-radius:8px!important;color:#bfcfb5!important;font-size:12px!important;box-sizing:border-box!important}.w-catalog-sorting select,.w-catalog-items-on-page select{padding:8px 10px!important;border:1px solid #8b7b4b!important;border-radius:7px!important;min-height:36px!important;background:#0b2119!important;color:#eadbb2!important}.w-catalog-counts-items{padding:12px 0!important;font-size:12px!important;color:#aabfa4!important}.w-catalog-paging a,.w-catalog-paging span{border-color:#687146!important;border-radius:6px!important;color:#dfca90!important;background:#163223!important}.w-catalog-paging .active,.w-catalog-paging .current{background:#355237!important;border-color:#bea058!important;color:#fff0c4!important}.w-catalog-listing-look a{color:#e1cb8e!important}.products-listing .item-nav,.products-listing .compare label{color:#bfccb3!important;background:#10291f!important}.products-listing .view-button{min-width:85px!important}.products-listing .instock,.products-listing .in-stock{color:#b6d6ad!important;font-size:12px!important}.w-catalog-b2b-add-button{display:none!important}.w-catalog-title h1{color:#eed99e!important;padding:4px 0!important}.main-content .filter-box,.main-content .filters{border:1px solid #4b6241!important;border-radius:9px!important;padding:14px!important;background:#102b20!important;color:#d3dec7!important}.main-content input[type=checkbox]{accent-color:#b59a53!important}.products-listing .item{transition:border-color .15s,box-shadow .15s}.products-listing .item:hover{border-color:#c5a75c!important;box-shadow:0 10px 28px #0004!important} +/* Active promotions get a restrained commercial sale treatment. */ +.dune-store-category--sale{background:linear-gradient(125deg,#542e2a,#292d21)!important;border-color:#b08855!important}.dune-store-category--sale>span{font-size:10px!important;letter-spacing:.1em!important;background:#a24636;border:1px solid #ce8f63;border-radius:5px;padding:6px 8px;color:#fff0cb!important}.dune-store-section--sale{background:linear-gradient(120deg,#38281f,#172e21 65%)!important;border-color:#b08a53!important;border-top:3px solid #b77949!important;box-shadow:0 8px 24px #0003}.dune-store-section--sale>header{border-color:#805b40!important}.dune-store-sale-label{display:inline-block;vertical-align:middle;font-size:10px;line-height:1.2;letter-spacing:.1em;background:#a54737;color:#fff1cf;padding:6px 9px;border:1px solid #d48b60;border-radius:5px;margin-right:8px}.dune-store-section--sale article{border-color:#8c7147!important;background:linear-gradient(145deg,#302f20,#10271b)!important}.dune-store-price del{display:block;color:#a9b3a1;font-size:13px;font-weight:400;margin-bottom:5px}.dune-store-price strong{display:block;color:#f3d28a!important}.dune-store-saving{display:inline-block;font-size:10px;font-weight:600;letter-spacing:.025em;background:#8f3d2e;color:#ffe6b3;border:1px solid #bd7850;border-radius:4px;padding:4px 7px;margin-top:8px}