CMXX - Highlights, samples
This commit is contained in:
4
cart.php
4
cart.php
@@ -182,11 +182,11 @@ $view .= '</tbody>
|
||||
|
||||
//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 .= '
|
||||
<div class="total">
|
||||
|
||||
@@ -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 {
|
||||
@@ -1407,3 +1406,53 @@ footer a:hover {
|
||||
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;
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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 ='<div class="content-wrapper">
|
||||
<div class="add_products">
|
||||
<h2>'.$h2_cart_suggestions.'</h2>
|
||||
<h2>'.($h2_cart_suggestions ?? 'Suggestions').'</h2>
|
||||
';
|
||||
|
||||
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 .='
|
||||
<div class="add_product">
|
||||
<a href="'.$additional_product_url.'" id="'.$additional_product['id'].'A" class="product">
|
||||
<img src="'.base_url.$additional_product['img'].'" id="'.$additional_product['id'].'" width="15%" height="" alt="'.$additional_product['name'].'">
|
||||
<a href="'.$additional_product_url.'" id="'.$additional_product['rowID'].'A" class="product">
|
||||
<img src="'.img_url.$additional_product['full_path'].'" id="'.$additional_product['rowID'].'" width="50" height="50" alt="'.$additional_product['productname'].'">
|
||||
</a>
|
||||
<form id="product-form" action="" method="post">
|
||||
<input type="hidden" name="add_product_id" value="'.$additional_product['id'].'">
|
||||
<input type="hidden" name="add_product_id" value="'.$additional_product['rowID'].'">
|
||||
<input type="hidden" name="add_product_price" value="'.$additional_product['price'].'">
|
||||
<input type="hidden" name="add_product_weight" value="'.$additional_product['weight'].'">
|
||||
<input type="hidden" name="add_product_weight" value="'.($additional_product['weight'] ?? 0).'">
|
||||
<input type="submit" name="accessoiries" value="+">
|
||||
</form>
|
||||
<a href="'.$additional_product_url.'" id="'.$additional_product['id'].'A" class="product">
|
||||
<span class="add_name">'.$additional_product['name'].'</span>
|
||||
<a href="'.$additional_product_url.'" id="'.$additional_product['rowID'].'A" class="product">
|
||||
<span class="add_name">'.$additional_product['productname'].'</span>
|
||||
<span class="add_price"> '.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();
|
||||
//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 ='<div class="content-wrapper">
|
||||
<h2 style="font-weight:normal;">'.$h2_cart_samples.'</h2>
|
||||
<h2 style="font-weight:normal;">'.($h2_cart_samples ?? 'Samples').'</h2>
|
||||
<div class="add_sample_button"><button id="slideLeft" class="scrollButton" type="button"><</button></div>
|
||||
<div id="add_samples_container" class="add_samples">
|
||||
|
||||
';
|
||||
|
||||
foreach ($additional_products as $additional_product){
|
||||
if (!empty($additional_product['img']) && file_exists($additional_product['img'])){
|
||||
if (!empty($additional_product['full_path'])){
|
||||
|
||||
//Pricing override for samples
|
||||
if (sample_pricing_override){
|
||||
@@ -390,29 +388,29 @@ function getSamples($pdo, $categoryID){
|
||||
}
|
||||
|
||||
$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 .='
|
||||
<div class="add_sample">
|
||||
<img src="'.base_url.$additional_product['img'].'" id="'.$additional_product['id'].'" width="50" height="50" alt="'.$additional_product['name'].'">
|
||||
<img src="'.img_url.$additional_product['full_path'].'" id="'.$additional_product['rowID'].'" width="50" height="50" alt="'.$additional_product['productname'].'">
|
||||
<form id="product-form" action="" method="post">
|
||||
<input type="hidden" name="add_product_id" value="'.$additional_product['id'].'">
|
||||
<input type="hidden" name="add_product_price" value="'.$additional_product['price'].'">
|
||||
<input type="hidden" name="add_product_weight" value="'.$additional_product['weight'].'">
|
||||
<input type="submit" name="samples" value="+">
|
||||
</form>
|
||||
<a href="'.$additional_product_url.'" id="'.$additional_product['id'].'A" class="product">
|
||||
<span class="add_name">'.$additional_product['name'].'</span>';
|
||||
if ($additional_product['price'] > 0){
|
||||
$output .='
|
||||
<span class="add_price"> '.currency_code.'.'.number_format($additional_product['price'],2).'
|
||||
';
|
||||
}
|
||||
if ($additional_product['rrp'] > 0){
|
||||
$output .='
|
||||
<span class="add_rrp">'.currency_code.''.number_format($additional_product['rrp'],2).'</span>
|
||||
<input type="hidden" name="add_product_id" value="'.$additional_product['rowID'].'">
|
||||
<input type="hidden" name="add_product_price" value="'.$additional_product['price'].'">
|
||||
<input type="hidden" name="add_product_weight" value="'.($additional_product['weight'] ?? 0).'">
|
||||
<input type="submit" name="samples" value="+">
|
||||
</form>
|
||||
<a href="'.$additional_product_url.'" id="'.$additional_product['rowID'].'A" class="product">
|
||||
<span class="add_name">'.$additional_product['productname'].'</span>';
|
||||
if ($additional_product['price'] > 0){
|
||||
$output .='
|
||||
<span class="add_price"> '.currency_code.'.'.number_format($additional_product['price'],2).'
|
||||
';
|
||||
}
|
||||
}
|
||||
if ($additional_product['rrp'] > 0){
|
||||
$output .='
|
||||
<span class="add_rrp">'.currency_code.''.number_format($additional_product['rrp'],2).'</span>
|
||||
';
|
||||
}
|
||||
$output .='
|
||||
</a>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user