From d85923c299125aaf87199292a326051ab004a3e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CVeLiTi=E2=80=9D?= <“info@veliti.nl”> Date: Thu, 13 Feb 2025 12:01:53 +0100 Subject: [PATCH] CMXX - Highlights, samples --- cart.php | 4 +- custom/css/style.css | 53 +++++++++++++++++++++++++- custom/settings/config.php | 11 +----- functions.php | 78 +++++++++++++++++++------------------- 4 files changed, 93 insertions(+), 53 deletions(-) diff --git a/cart.php b/cart.php index eaf4afe..8330425 100644 --- a/cart.php +++ b/cart.php @@ -182,11 +182,11 @@ $view .= ' //SUGGESTIONS if (!empty($products_in_cart) && !empty(category_id_checkout_suggestions)){ - $view .= getAccessoiries($pdo,category_id_checkout_suggestions); + $view .= getAccessoiries($clientsecret,category_id_checkout_suggestions); } // SAMPLES if (!empty($products_in_cart) && !empty(category_id_checkout_samples)){ - $view .= getSamples($pdo,category_id_checkout_samples); + $view .= getSamples($clientsecret,category_id_checkout_samples); } $view .= '
diff --git a/custom/css/style.css b/custom/css/style.css index adc341d..921efec 100644 --- a/custom/css/style.css +++ b/custom/css/style.css @@ -1363,6 +1363,7 @@ footer a:hover { padding: 10px; text-align: center; mix-blend-mode: multiply; + width: min-content; } .add_product a{ @@ -1374,8 +1375,6 @@ footer a:hover { color: #555555; text-align: center; font-size: 10px; - max-width: 130px; - word-wrap: break-word; } .add_price { @@ -1406,4 +1405,54 @@ footer a:hover { max-width: 50%; text-align: left; margin: 40px; +} + + +.add_samples{ + overflow-x: scroll; + overflow-y: hidden; + white-space: nowrap; + width:60%; + display: inline-block; + vertical-align: middle; +} + +.add_sample{ + width:fit-content; + display: inline-block; + padding: 10px; + text-align: center; + mix-blend-mode: multiply; +} + +.add_sample input[type='submit']{ + border-radius: 90px; + background-color: green; + color: #fff; + border: none; + position: relative; + top: -15px; + left: 20px; + z-index: 999; +} + +.add_sample a{ + text-decoration: none; +} + +.add_sample_button{ + vertical-align: middle; + display: inline-block; +} + +.scrollButton{ + text-decoration: none; + background: #2e38462b; + border: 0; + color: #FFFFFF; + padding: 11px 5px; + font-size: 14px; + font-weight: 500; + border-radius: 4px; + cursor: pointer; } \ No newline at end of file diff --git a/custom/settings/config.php b/custom/settings/config.php index bd44f8d..9d83d45 100644 --- a/custom/settings/config.php +++ b/custom/settings/config.php @@ -35,24 +35,17 @@ define('banner_btn_2','Stay@MorvalWatches'); /* Detailed settings */ // Homepage highlightedproducts -define('highlighted_product_range_1','Thomas I'); define('category_id_highlighted_products_1','6'); // Homepage highlightedproducts -define('highlighted_product_range_2','Thomas II'); define('category_id_highlighted_products_2','7'); -//Homepage show options in carrousel -define('show_options_carrousel',false); -//Truncate productname on carrousel -define('product_truncate_text','Thomas-I'); -define('product_truncate','1'); //Show small images from configuration define('show_option_images',false); // Default category_id for suggestions -define('category_id_checkout_suggestions','3'); +define('category_id_checkout_suggestions','7'); // Default category_id for giftcard define('giftcard_id',''); // Default category_id for samples -define('category_id_checkout_samples',''); +define('category_id_checkout_samples','7'); // Default samples define('sample_pricing_override',false); // Default samples diff --git a/functions.php b/functions.php index 9b9ea7a..1216410 100644 --- a/functions.php +++ b/functions.php @@ -314,39 +314,38 @@ function format_bytes($bytes) { } -function getAccessoiries($pdo, $categoryID){ +function getAccessoiries($clientsecret, $categoryID){ include './custom/translations/translations_'.strtoupper(language_code).'.php'; - $stmt = $pdo->prepare('SELECT p.*, (SELECT m.full_path FROM products_media pm JOIN media m ON m.id = pm.media_id WHERE pm.product_id = p.id ORDER BY pm.position ASC LIMIT 1) AS img FROM products p JOIN products_categories pc ON pc.category_id = :category_id AND pc.product_id = p.id JOIN categories c ON c.id = pc.category_id WHERE p.status = 1'); - $stmt->bindValue(':category_id', $categoryID, PDO::PARAM_INT); - $stmt->execute(); + //GET CATALOG DATA + $additional_products = ioAPIv2('/v2/catalog/category='.$categoryID,'',$clientsecret); + $additional_products = json_decode($additional_products,true); - $additional_products = $stmt->fetchAll(PDO::FETCH_ASSOC); $output ='
-

'.$h2_cart_suggestions.'

+

'.($h2_cart_suggestions ?? 'Suggestions').'

'; foreach ($additional_products as $additional_product){ - if (!empty($additional_product['img']) && file_exists($additional_product['img'])){ + if (!empty($additional_product['full_path'])){ $url_contents = 'index.php?page=product&id='; - $url_contents .= $additional_product['url_slug'] ? $additional_product['url_slug'] : $additional_product['id']; + $url_contents .= $additional_product['url_slug'] ? $additional_product['url_slug'] : $additional_product['rowID']; $additional_product_url = url($url_contents); $output .='
- - '.$additional_product['name'].' + + '.$additional_product['productname'].'
- + - +
- - '.$additional_product['name'].' + + '.$additional_product['productname'].' '.currency_code.'.'.number_format($additional_product['price'],2).' '; if ($additional_product['rrp'] > 0){ @@ -365,24 +364,23 @@ function getAccessoiries($pdo, $categoryID){ return $output; } -function getSamples($pdo, $categoryID){ +function getSamples($clientsecret, $categoryID){ include './custom/translations/translations_'.strtoupper(language_code).'.php'; - $stmt = $pdo->prepare('SELECT p.*, (SELECT m.full_path FROM products_media pm JOIN media m ON m.id = pm.media_id WHERE pm.product_id = p.id ORDER BY pm.position ASC LIMIT 1) AS img FROM products p JOIN products_categories pc ON pc.category_id = :category_id AND pc.product_id = p.id JOIN categories c ON c.id = pc.category_id WHERE p.status = 1'); - $stmt->bindValue(':category_id', $categoryID, PDO::PARAM_INT); - $stmt->execute(); - - $additional_products = $stmt->fetchAll(PDO::FETCH_ASSOC); + //GET CATALOG DATA + $additional_products = ioAPIv2('/v2/catalog/category='.$categoryID,'',$clientsecret); + $additional_products = json_decode($additional_products,true); + $output ='