diff --git a/website/ops/oscommerce/DuneProductRules.php b/website/ops/oscommerce/DuneProductRules.php index e7270fbf..8f6b8e95 100644 --- a/website/ops/oscommerce/DuneProductRules.php +++ b/website/ops/oscommerce/DuneProductRules.php @@ -20,8 +20,10 @@ final class DuneProductRules { $listed=isset($_POST['listqty'][$id]) || isset($_POST['listid'][$id]); if (!$single && !$listed) continue; $value=$single?($_POST['attr_text'][$row['option_id']]??null):($_POST['listattr_text'][$id][$row['option_id']]??null); - try { self::preferredName($value); } - catch(\InvalidArgumentException $e) { self::reject(422,$e->getMessage()); } + if((int)$row['option_id']>0){ + try { self::preferredName($value); } + catch(\InvalidArgumentException $e) { self::reject(422,$e->getMessage()); } + } if($row['preview_only']) self::reject(409,'Collection preview: ordering is currently unavailable.'); } } diff --git a/website/ops/oscommerce/DuneShopController.php b/website/ops/oscommerce/DuneShopController.php index 9899c358..dd8a4228 100644 --- a/website/ops/oscommerce/DuneShopController.php +++ b/website/ops/oscommerce/DuneShopController.php @@ -6,8 +6,8 @@ final class DuneShopController extends Sceleton { public function actionIndex() { $this->view->title='DuneRealms Shop'; $rows=Yii::$app->db->createCommand("SELECT p.products_id,p.products_price,p.products_tax_class_id,pd.products_name,pd.products_description_short,d.kind FROM products p JOIN platforms_products pp ON pp.products_id=p.products_id AND pp.platform_id=7 JOIN products_description pd ON pd.products_id=p.products_id AND pd.language_id=1 AND pd.platform_id=7 LEFT JOIN dune_catalog_import d ON d.products_id=p.products_id WHERE p.products_status=1 ORDER BY p.products_date_added DESC,p.products_id DESC")->queryAll(); - $saleIds=Yii::$app->db->createCommand("SELECT DISTINCT products_id FROM specials WHERE status=1 AND (start_date IS NULL OR start_date='0000-00-00 00:00:00' OR start_date<=NOW()) AND (expires_date IS NULL OR expires_date='0000-00-00 00:00:00' OR expires_date>NOW())")->queryColumn(); - $featuredIds=Yii::$app->db->createCommand("SELECT DISTINCT products_id FROM featured WHERE status=1 AND (start_date IS NULL OR start_date='0000-00-00 00:00:00' OR start_date<=NOW()) AND (expires_date IS NULL OR expires_date='0000-00-00 00:00:00' OR expires_date>NOW())")->queryColumn(); + $saleIds=Yii::$app->db->createCommand("SELECT DISTINCT products_id FROM specials WHERE EXISTS(SELECT 1 FROM products active JOIN platforms_products pp ON pp.products_id=active.products_id AND pp.platform_id=7 WHERE active.products_id=specials.products_id AND active.products_status=1 AND specials.specials_new_products_priceNOW())")->queryColumn(); + $featuredIds=Yii::$app->db->createCommand("SELECT DISTINCT products_id FROM featured WHERE EXISTS(SELECT 1 FROM products active JOIN platforms_products pp ON pp.products_id=active.products_id AND pp.platform_id=7 WHERE active.products_id=featured.products_id AND active.products_status=1) AND status=1 AND (start_date IS NULL OR start_date='0000-00-00 00:00:00' OR start_date<=NOW()) AND (expires_date IS NULL OR expires_date='0000-00-00 00:00:00' OR expires_date>NOW())")->queryColumn(); $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
'; diff --git a/website/ops/oscommerce/README.md b/website/ops/oscommerce/README.md index 966a273c..429eee37 100644 --- a/website/ops/oscommerce/README.md +++ b/website/ops/oscommerce/README.md @@ -12,3 +12,18 @@ Frontend account linking uses the existing API with a dedicated oscommerce SSO c PHP-FPM pool and TLS vhost are separate from Azuriom. Installer paths, .git, configuration, SQL and downloads are denied at the web server. No credentials belong in this directory. Backend theme proposal: Tabler (https://tabler.io), MIT licensed. This requires an adapter; it has not been installed over the native backend. + + +## Catalogue and storefront update + +The portal now embeds `/catalog/dune-shop?currency=EUR`. `DuneShopController.php` belongs in `lib/frontend/controllers/`; `dune-shop-cards.css` is served at the app root and linked by the portal publisher's native layout adapter. + +`import-shop-catalog.py` imports the 12 original sash products and the four mapped donor packages from the preserved Azuriom schema. `dune_catalog_import` records source package IDs and prevents duplicates. The user's existing Aerdrecht product is retained as product 76, including its artwork. Donor manufacturer is DuneRealms; existing rank delivery mappings are recorded, but this importer never grants ranks. + +Sashes are made to order with unlimited stock, a required preferred embroidery name, and standard/silver (+EUR50)/gold (+EUR75) SIDE edging. These options do not alter the bottom cord/fringe. Prices use the installation's current 20% tax setup and source EUR display prices; review real tax and shipping configuration before enabling checkout. All imported products remain previews: no purchasing or fulfillment is enabled. + +`DuneProductRules.php` belongs in `lib/frontend/components/`; `install-sash-rules.py` hooks validation into native cart handling. `finish-catalog-edging.py` and `final-shop-settings.py` complete native option/stock setup. These are controlled, existing-installation migrations, not automatic scripts to run against an arbitrary osCommerce database. + +Shop customers map by central UUID. Verified contact email and username are synchronized after central sign-in; passwords are never retrieved, exposed or copied. Missing verified addresses retain a non-deliverable internal placeholder until a contact email is verified. Email collisions require support rather than silently merging customers. Native customer registration and password pages redirect to central sign-in, including currency-prefixed routes. Native backend roles remain untouched. + +The shared menu and badge publisher strips legacy unmarked controllers before appending the current one. Regression coverage checks both publication idempotence and a single controller/observer. diff --git a/website/ops/oscommerce/dune-shop-cards.css b/website/ops/oscommerce/dune-shop-cards.css index fc80cc0d..c04c2e76 100644 --- a/website/ops/oscommerce/dune-shop-cards.css +++ b/website/ops/oscommerce/dune-shop-cards.css @@ -28,3 +28,5 @@ html,body{height:auto!important;min-height:0!important}.main-content{min-height: .dune-store-welcome{display:flex;align-items:center;justify-content:space-between;gap:28px;border:1px solid #9a8349;border-radius:16px;padding:40px;margin:0 auto 24px;background:linear-gradient(100deg,#0b261aec,#173c2cc7),url('https://www.dunerealms.com/assets/sietch.webp') center/cover;box-shadow:0 12px 30px #0003}.dune-store-welcome small{color:#ceb36e;letter-spacing:.16em;font-size:11px}.dune-store-welcome h1{font-size:clamp(28px,3vw,43px);line-height:1.15;margin:14px 0!important;max-width:600px}.dune-store-welcome p{font-size:15px;line-height:1.7;color:#ccd9c4;max-width:570px;margin-bottom:24px}.dune-store-welcome>img{width:155px;height:155px;object-fit:contain;filter:drop-shadow(0 8px 18px #0008)}.dune-store-button{display:inline-flex!important;align-items:center;justify-content:center;padding:11px 18px;border:1px solid #b79a53;border-radius:8px;background:linear-gradient(#385b39,#23422c);color:#f5e1ad!important;font-size:13px;font-weight:600;text-decoration:none!important;box-shadow:0 4px 12px #0003}.dune-store-button:hover{background:#416345;transform:translateY(-1px)} .dune-store-categories{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px;margin-bottom:34px}.dune-store-categories>a{display:flex;align-items:center;gap:16px;padding:22px;border:1px solid #6e7046;border-radius:12px;background:linear-gradient(130deg,#21412e,#112b20);text-decoration:none!important;transition:border-color .15s,transform .15s}.dune-store-categories>a:hover{border-color:#d4b369;transform:translateY(-2px)}.dune-store-categories img{width:58px;height:58px;object-fit:contain}.dune-store-categories h2{font-size:17px!important;margin:0 0 6px!important}.dune-store-categories p{margin:0;color:#afc2aa;font-size:12px;line-height:1.5}.dune-store-categories span{margin-left:auto;color:#dfc37f;font-size:20px}.dune-store-section{margin:0 0 32px;border:1px solid #486143;border-radius:13px;padding:24px;background:#102a20}.dune-store-section>header{display:flex;align-items:center;justify-content:space-between;gap:18px;margin-bottom:22px;padding-bottom:16px;border-bottom:1px solid #425b40}.dune-store-section h2{font-size:23px!important;margin:0 0 7px!important}.dune-store-section header p{margin:0;color:#aabea5;font-size:12px}.dune-store-section header>a{font-size:12px;color:#d9be7b!important;white-space:nowrap}.dune-store-products{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:20px}.dune-store-products article{display:flex;flex-direction:column;align-items:center;text-align:center;border:1px solid #536a47;border-radius:11px;background:linear-gradient(145deg,#1b3b29,#0c251b);padding:18px;box-sizing:border-box}.dune-store-product-art{display:flex;align-items:center;justify-content:center;width:100%;height:230px;margin-bottom:16px;background:radial-gradient(ellipse,#2f5033,transparent 72%)}.dune-store-product-art img{display:block!important;height:220px!important;max-height:220px!important;max-width:100%!important;width:auto!important;object-fit:contain}.dune-store-products small{font-size:9px;letter-spacing:.12em;color:#b8a66e}.dune-store-products h3{font-size:16px!important;line-height:1.45;margin:10px 0!important}.dune-store-products h3 a{color:#e6d5a3!important;text-decoration:none}.dune-store-price{font-size:23px;font-weight:700;color:#f1d28a;margin:auto 0 16px;padding-top:8px}.dune-store-products .dune-store-button{width:100%;box-sizing:border-box}.dune-store-empty{border:1px dashed #566849;border-radius:9px;padding:26px;color:#afc1a5;text-align:center;font-size:13px;background:#183223}.dune-store-preview{border-left:3px solid #b99850;border-radius:9px;background:#243c28;padding:20px 24px;color:#cad5ba;font-size:13px;line-height:1.7}.dune-store-preview strong{color:#e1c785}.dune-store-preview p{margin:6px 0 0} @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} diff --git a/website/ops/oscommerce/final-shop-settings.py b/website/ops/oscommerce/final-shop-settings.py new file mode 100644 index 00000000..2e05337b --- /dev/null +++ b/website/ops/oscommerce/final-shop-settings.py @@ -0,0 +1,31 @@ +from pathlib import Path +import subprocess,shutil,re +app=Path('/home/dunerealms/apps/oscommerce');repo=Path('/home/dunerealms/oscommerce-integration/website') +sql="""INSERT INTO products_stock_indication(sort_order,is_default,stock_code,allow_out_of_stock_checkout,allow_out_of_stock_add_to_cart,allow_in_stock_notify,display_price_options) +SELECT 10,0,'made-to-order',0,0,0,0 WHERE NOT EXISTS(SELECT 1 FROM products_stock_indication WHERE stock_code='made-to-order'); +INSERT IGNORE INTO products_stock_indication_text(stock_indication_id,language_id,stock_indication_text,stock_indication_short_text) +SELECT stock_indication_id,1,'Made to order','Made to order' FROM products_stock_indication WHERE stock_code='made-to-order'; +UPDATE products p JOIN dune_catalog_import d ON d.products_id=p.products_id AND d.kind='sash' SET p.stock_indication_id=(SELECT stock_indication_id FROM products_stock_indication WHERE stock_code='made-to-order' LIMIT 1),p.manual_stock_unlimited=1; +INSERT IGNORE INTO dune_product_requirements SELECT products_id,0,1 FROM dune_catalog_import WHERE kind='rank'; +UPDATE meta_tags SET meta_tags_value='The collection' WHERE meta_tags_key='HEAD_H1_TAG_PRODUCTS_ALL' AND language_id=1 AND platform_id=7; +UPDATE meta_tags SET meta_tags_value='New arrivals' WHERE meta_tags_key='HEAD_H1_TAG_WHATS_NEW' AND language_id=1 AND platform_id=7; +UPDATE meta_tags SET meta_tags_value='Featured products' WHERE meta_tags_key='HEAD_H1_TAG_FEATURED' AND language_id=1 AND platform_id=7; +""" +subprocess.run(['mysql','dunerealms_oscommerce'],input=sql,text=True,check=True,capture_output=True) +# Use a visible label for native selectable options as well as the custom-name field. +p=app/'lib/frontend/themes/basic/boxes/product/attributes/select.tpl';s=p.read_text() +needle=' 0)}{$item.title|escape:'html'}{/if}\n