Merge branch 'master' of gitlab.antadis.net:dev-antadis/chocolatdemariage

This commit is contained in:
Nolwenn 2017-08-29 15:25:33 +02:00
commit 43c982dff8
8 changed files with 353 additions and 303 deletions

View File

@ -911,20 +911,38 @@ class Cart extends CartCore
$products_total[$id_tax_rules_group.'_'.$id_address] = 0; $products_total[$id_tax_rules_group.'_'.$id_address] = 0;
} }
// Configurator impact
$flatrate = true;
$impact = 0;
if ($product['id_configurator'] != 0) {
$impact = Product::getConfiguratorSelectedPriceTotal($product['id_product'], $product['id_configurator']);
}
switch ($ps_round_type) { switch ($ps_round_type) {
case Order::ROUND_TOTAL: case Order::ROUND_TOTAL:
$products_total[$id_tax_rules_group.'_'.$id_address] += $price * (int)$product['cart_quantity']; $product_price = $price * (int)$product['cart_quantity'];
if ($product['id_configurator'] != 0 && $flatrate == true) {
$product_price+= $impact;
}
$products_total[$id_tax_rules_group.'_'.$id_address] += $product_price;
break; break;
case Order::ROUND_LINE: case Order::ROUND_LINE:
$product_price = $price * $product['cart_quantity']; $product_price = $price * $product['cart_quantity'];
if ($product['id_configurator'] != 0 && $flatrate == true) {
$product_price+= $impact;
}
$products_total[$id_tax_rules_group] += Tools::ps_round($product_price, $compute_precision); $products_total[$id_tax_rules_group] += Tools::ps_round($product_price, $compute_precision);
break; break;
case Order::ROUND_ITEM: case Order::ROUND_ITEM:
default: default:
$product_price = /*$with_taxes ? $tax_calculator->addTaxes($price) : */$price; $product_price = $price;
$products_total[$id_tax_rules_group] += Tools::ps_round($product_price, $compute_precision) * (int)$product['cart_quantity']; $product_price = Tools::ps_round($product_price, $compute_precision) * (int)$product['cart_quantity'];
if ($product['id_configurator'] != 0 && $flatrate == true) {
$product_price+= $impact;
}
$products_total[$id_tax_rules_group] += $product_price;
break; break;
} }
} }

View File

@ -35,32 +35,13 @@ class Product extends ProductCore
return $priceImpact; return $priceImpact;
} }
/** public static function getConfiguratorSelectedPriceTotal($id_product, $id_configurator)
* Price calculation / Get product price {
* $sql = 'SELECT SUM(cs.`price`) FROM `'._DB_PREFIX_.'configurator_storage` cs
* @param int $id_shop Shop id WHERE cs.`id_product`='.(int)$id_product.' AND cs.`id_configurator`='.(int)$id_configurator;
* @param int $id_product Product id return Db::getInstance()->getValue($sql);
* @param int $id_product_attribute Product attribute id }
* @param int $id_country Country id
* @param int $id_state State id
* @param string $zipcode
* @param int $id_currency Currency id
* @param int $id_group Group id
* @param int $quantity Quantity Required for Specific prices : quantity discount application
* @param bool $use_tax with (1) or without (0) tax
* @param int $decimals Number of decimals returned
* @param bool $only_reduc Returns only the reduction amount
* @param bool $use_reduc Set if the returned amount will include reduction
* @param bool $with_ecotax insert ecotax in price output.
* @param null $specific_price If a specific price applies regarding the previous parameters,
* this variable is filled with the corresponding SpecificPrice object
* @param bool $use_group_reduction
* @param int $id_customer
* @param bool $use_customer_price
* @param int $id_cart
* @param int $real_quantity
* @return float Product price
**/
public static function priceCalculation($id_shop, $id_product, $id_product_attribute, $id_country, $id_state, $zipcode, $id_currency, public static function priceCalculation($id_shop, $id_product, $id_product_attribute, $id_country, $id_state, $zipcode, $id_currency,
$id_group, $quantity, $use_tax, $decimals, $only_reduc, $use_reduc, $with_ecotax, &$specific_price, $use_group_reduction, $id_group, $quantity, $use_tax, $decimals, $only_reduc, $use_reduc, $with_ecotax, &$specific_price, $use_group_reduction,
$id_customer = 0, $use_customer_price = true, $id_cart = 0, $real_quantity = 0, $id_configurator = null) $id_customer = 0, $use_customer_price = true, $id_cart = 0, $real_quantity = 0, $id_configurator = null)
@ -283,9 +264,6 @@ class Product extends ProductCore
return self::$_prices[$cache_id]; return self::$_prices[$cache_id];
} }
/**
* Override product price
*/
public static function getPriceStatic($id_product, $usetax = true, $id_product_attribute = null, $decimals = 6, $divisor = null, public static function getPriceStatic($id_product, $usetax = true, $id_product_attribute = null, $decimals = 6, $divisor = null,
$only_reduc = false, $usereduc = true, $quantity = 1, $force_associated_tax = false, $id_customer = null, $id_cart = null, $only_reduc = false, $usereduc = true, $quantity = 1, $force_associated_tax = false, $id_customer = null, $id_cart = null,
$id_address = null, &$specific_price_output = null, $with_ecotax = true, $use_group_reduction = true, Context $context = null, $id_address = null, &$specific_price_output = null, $with_ecotax = true, $use_group_reduction = true, Context $context = null,

View File

@ -5,6 +5,8 @@ class ProductController extends ProductControllerCore
protected $impactPrice; protected $impactPrice;
protected $productWithImpactPrice;
public function init() public function init()
{ {
parent::init(); parent::init();
@ -43,16 +45,22 @@ class ProductController extends ProductControllerCore
$impact = $this->product->getConfiguratorImpactPrice($this->optValues); $impact = $this->product->getConfiguratorImpactPrice($this->optValues);
} }
$this->impactPrice = $productPrice + $impact; $this->impactPrice = $impact;
// We want total price
$productPrice = $productPrice * $qty;
$this->productPriceWithImpact = $productPrice + $impact;
} }
} }
public function postProcess() public function postProcess()
{ {
if ($this->ajax && Tools::getValue('impactprice', 0)) { if ($this->ajax && Tools::getValue('impactprice', 0)) {
$qty = Tools::getValue('qty', 1);
$return = array( $return = array(
'priceDisplay' => Tools::displayPrice($this->impactPrice), 'priceUnitDisplay' => Tools::displayPrice($this->product->getPrice(true, null, 6, null, false, true, $qty)),
'price' => $this->impactPrice, 'priceDisplay' => Tools::displayPrice($this->productPriceWithImpact),
'price' => $this->productPriceWithImpact,
); );
die(Tools::jsonEncode($return)); die(Tools::jsonEncode($return));
} }

View File

@ -600,8 +600,6 @@ class Cart extends CartCore
$products = $this->getProducts($refresh); $products = $this->getProducts($refresh);
foreach ($products as $key => &$product) { foreach ($products as $key => &$product) {
$null = null; $null = null;
$product['price_without_quantity_discount'] = Product::getPriceStatic( $product['price_without_quantity_discount'] = Product::getPriceStatic(
$product['id_product'], $product['id_product'],
@ -900,20 +898,38 @@ class Cart extends CartCore
$products_total[$id_tax_rules_group.'_'.$id_address] = 0; $products_total[$id_tax_rules_group.'_'.$id_address] = 0;
} }
// Configurator impact
$flatrate = true;
$impact = 0;
if ($product['id_configurator'] != 0) {
$impact = Product::getConfiguratorSelectedPriceTotal($product['id_product'], $product['id_configurator']);
}
switch ($ps_round_type) { switch ($ps_round_type) {
case Order::ROUND_TOTAL: case Order::ROUND_TOTAL:
$products_total[$id_tax_rules_group.'_'.$id_address] += $price * (int)$product['cart_quantity']; $product_price = $price * (int)$product['cart_quantity'];
if ($product['id_configurator'] != 0 && $flatrate == true) {
$product_price+= $impact;
}
$products_total[$id_tax_rules_group.'_'.$id_address] += $product_price;
break; break;
case Order::ROUND_LINE: case Order::ROUND_LINE:
$product_price = $price * $product['cart_quantity']; $product_price = $price * $product['cart_quantity'];
if ($product['id_configurator'] != 0 && $flatrate == true) {
$product_price+= $impact;
}
$products_total[$id_tax_rules_group] += Tools::ps_round($product_price, $compute_precision); $products_total[$id_tax_rules_group] += Tools::ps_round($product_price, $compute_precision);
break; break;
case Order::ROUND_ITEM: case Order::ROUND_ITEM:
default: default:
$product_price = $price; $product_price = $price;
$products_total[$id_tax_rules_group] += Tools::ps_round($product_price, $compute_precision) * (int)$product['cart_quantity']; $product_price = Tools::ps_round($product_price, $compute_precision) * (int)$product['cart_quantity'];
if ($product['id_configurator'] != 0 && $flatrate == true) {
$product_price+= $impact;
}
$products_total[$id_tax_rules_group] += $product_price;
break; break;
} }
} }

View File

@ -125,19 +125,6 @@ class Product extends ProductCore
), ),
); );
/* /*
* module: antadisconfigurator * module: antadisconfigurator
* date: 2017-06-27 12:10:06 * date: 2017-06-27 12:10:06
@ -158,9 +145,9 @@ class Product extends ProductCore
} }
} }
$sql = 'SELECT pcoi.price FROM `'._DB_PREFIX_.'product_configurator_opt_impact` pcoi $sql = 'SELECT pcoi.`price` FROM `'._DB_PREFIX_.'product_configurator_opt_impact` pcoi
WHERE id_product = '.$this->id.' WHERE pcoi.`id_product` = '.$this->id.'
AND id_configurator_opt IN('.join(',', $optId).')'; AND pcoi.`id_configurator`_opt IN('.join(',', $optId).')';
$result = Db::getInstance()->executeS($sql); $result = Db::getInstance()->executeS($sql);
if (count($result) > 0) { if (count($result) > 0) {
foreach ($result as $item) { foreach ($result as $item) {
@ -172,6 +159,12 @@ class Product extends ProductCore
return $priceImpact; return $priceImpact;
} }
public static function getConfiguratorSelectedPriceTotal($id_product, $id_configurator)
{
$sql = 'SELECT SUM(cs.`price`) FROM `'._DB_PREFIX_.'configurator_storage` cs
WHERE cs.`id_product`='.(int)$id_product.' AND cs.`id_configurator`='.(int)$id_configurator;
return Db::getInstance()->getValue($sql);
}
/* /*
* module: antadisconfigurator * module: antadisconfigurator
@ -317,7 +310,8 @@ class Product extends ProductCore
$price += $ecotax; $price += $ecotax;
} }
} }
if ($id_configurator != null) { $flatrate = true;
if ($id_configurator != null && $flatrate == false) {
$sql = 'SELECT price FROM `'._DB_PREFIX_.'configurator_storage` WHERE id_configurator = '.(int)$id_configurator. $sql = 'SELECT price FROM `'._DB_PREFIX_.'configurator_storage` WHERE id_configurator = '.(int)$id_configurator.
' AND id_product = '.(int)$id_product; ' AND id_product = '.(int)$id_product;
$priceResult = Db::getInstance()->executeS($sql); $priceResult = Db::getInstance()->executeS($sql);

View File

@ -15,6 +15,13 @@ class ProductController extends ProductControllerCore
*/ */
protected $impactPrice; protected $impactPrice;
/*
* module: antadisconfigurator
* date: 2017-06-27 12:10:07
* version: 0.1
*/
protected $productPriceWithImpact;
/* /*
* module: antadisconfigurator * module: antadisconfigurator
* date: 2017-06-27 12:10:07 * date: 2017-06-27 12:10:07
@ -24,7 +31,7 @@ class ProductController extends ProductControllerCore
{ {
parent::init(); parent::init();
if (Tools::getValue('ajax') && Tools::getValue('action') == 'getProductInfo'){ if (Tools::getValue('ajax') && Tools::getValue('action') == 'getProductInfo') {
$this->ajaxProcessGetProductInfo(); $this->ajaxProcessGetProductInfo();
} }
@ -62,10 +69,11 @@ class ProductController extends ProductControllerCore
$impact = $this->product->getConfiguratorImpactPrice($this->optValues); $impact = $this->product->getConfiguratorImpactPrice($this->optValues);
} }
$this->impactPrice = $impact;
// We want total price // We want total price
$productPrice = $productPrice * $qty; $productPrice = $productPrice * $qty;
$this->productPriceWithImpact = $productPrice + $impact;
$this->impactPrice = $productPrice + $impact;
} }
} }
@ -80,8 +88,8 @@ class ProductController extends ProductControllerCore
$qty = Tools::getValue('qty', 1); $qty = Tools::getValue('qty', 1);
$return = array( $return = array(
'priceUnitDisplay' => Tools::displayPrice($this->product->getPrice(true, null, 6, null, false, true, $qty)), 'priceUnitDisplay' => Tools::displayPrice($this->product->getPrice(true, null, 6, null, false, true, $qty)),
'priceDisplay' => Tools::displayPrice($this->impactPrice), 'priceDisplay' => Tools::displayPrice($this->productPriceWithImpact),
'price' => $this->impactPrice, 'price' => $this->productPriceWithImpact,
); );
die(Tools::jsonEncode($return)); die(Tools::jsonEncode($return));
} }
@ -101,6 +109,23 @@ class ProductController extends ProductControllerCore
$this->addCSS(_THEME_CSS_DIR_.'tools/lightgallery.css'); $this->addCSS(_THEME_CSS_DIR_.'tools/lightgallery.css');
} }
public function initContent()
{
parent::initContent();
$impact = 0;
if (($id_configurator = Tools::getValue('id_configurator', 0)) != 0) {
// Product Info
if (Validate::isLoadedObject($this->product)) {
$qty = Tools::getValue('qty', 1);
$productPrice = $this->product->getPrice(true, null, 6, null, false, true, $qty);
}
$impact = Product::getConfiguratorSelectedPriceTotal($this->product->id, $id_configurator);
}
$this->context->smarty->assign('impactPrice', $impact);
}
public function ajaxProcessGetProductInfo() public function ajaxProcessGetProductInfo()
{ {
$context = Context::getContext(); $context = Context::getContext();

View File

@ -5,254 +5,257 @@
{/if} {/if}
<main class="product-main configurator"> <main class="product-main configurator">
<section itemscope itemtype="http://schema.org/Product" {if $content_only}class="frame"{else}class="container-big bg-green"{/if}> <section itemscope itemtype="http://schema.org/Product" {if $content_only}class="frame"{else}class="container-big bg-green"{/if}>
<header class="page-heading"> <header class="page-heading">
{include file="$tpl_dir./breadcrumb.tpl"} {include file="$tpl_dir./breadcrumb.tpl"}
<div class="ctn"> <div class="ctn">
<h1 class="title-arrow"><span>{$product->name|escape:'html':'UTF-8'}</span></h1> <h1 class="title-arrow"><span>{$product->name|escape:'html':'UTF-8'}</span></h1>
<div class="subtitle">{l s='Choisissez vos options et personnalisez votre produit afin dobtenir les détails et tarifs et un produit unique !'}</div> <div class="subtitle">{l s='Choisissez vos options et personnalisez votre produit afin dobtenir les détails et tarifs et un produit unique !'}</div>
<div class="title-drop">{l s='Découvrez des exemples de ce produit mis en situation'}</div> <div class="title-drop">{l s='Découvrez des exemples de ce produit mis en situation'}</div>
<a href="#images-suggestion-config" class="btn btn3 scrollto" data-offset="170">{l s='Je veux voir'}</a> <a href="#images-suggestion-config" class="btn btn3 scrollto" data-offset="170">{l s='Je veux voir'}</a>
</div> </div>
{if isset($confirmation) && $confirmation} {if isset($confirmation) && $confirmation}
<p class="confirmation"> <p class="confirmation">
{$confirmation} {$confirmation}
</p> </p>
{/if} {/if}
</header> </header>
<div class="content container"> <div class="content container">
<div class="bg"> <div class="bg">
<div class="row"> <div class="row">
<!-- Images--> <!-- Images-->
<div id="image-block" class="md6 xxs12 {if $noSimulator}noSimulator{/if}"> <div id="image-block" class="md6 xxs12 {if $noSimulator}noSimulator{/if}">
{if $noSimulator} {if $noSimulator}
{if $have_image} {if $have_image}
<span id="view_full_size"> <span id="view_full_size">
{if $jqZoomEnabled && $have_image && !$content_only} {if $jqZoomEnabled && $have_image && !$content_only}
<a class="jqzoom" title="{if !empty($cover.legend)}{$cover.legend|escape:'html':'UTF-8'}{else}{$product->name|escape:'html':'UTF-8'}{/if}" rel="gal1" href="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'thickbox_default')|escape:'html':'UTF-8'}"> <a class="jqzoom" title="{if !empty($cover.legend)}{$cover.legend|escape:'html':'UTF-8'}{else}{$product->name|escape:'html':'UTF-8'}{/if}" rel="gal1" href="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'thickbox_default')|escape:'html':'UTF-8'}">
<img itemprop="image" src="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'large_default')|escape:'html':'UTF-8'}" title="{if !empty($cover.legend)}{$cover.legend|escape:'html':'UTF-8'}{else}{$product->name|escape:'html':'UTF-8'}{/if}" alt="{if !empty($cover.legend)}{$cover.legend|escape:'html':'UTF-8'}{else}{$product->name|escape:'html':'UTF-8'}{/if}"/> <img itemprop="image" src="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'large_default')|escape:'html':'UTF-8'}" title="{if !empty($cover.legend)}{$cover.legend|escape:'html':'UTF-8'}{else}{$product->name|escape:'html':'UTF-8'}{/if}" alt="{if !empty($cover.legend)}{$cover.legend|escape:'html':'UTF-8'}{else}{$product->name|escape:'html':'UTF-8'}{/if}"/>
</a> </a>
{else}
<img id="bigpic" itemprop="image" src="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'large_default')|escape:'html':'UTF-8'}" title="{if !empty($cover.legend)}{$cover.legend|escape:'html':'UTF-8'}{else}{$product->name|escape:'html':'UTF-8'}{/if}" alt="{if !empty($cover.legend)}{$cover.legend|escape:'html':'UTF-8'}{else}{$product->name|escape:'html':'UTF-8'}{/if}" width="{$largeSize.width}" height="{$largeSize.height}"/>
{/if}
</span>
{else} {else}
<span id="view_full_size"> <img id="bigpic" itemprop="image" src="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'large_default')|escape:'html':'UTF-8'}" title="{if !empty($cover.legend)}{$cover.legend|escape:'html':'UTF-8'}{else}{$product->name|escape:'html':'UTF-8'}{/if}" alt="{if !empty($cover.legend)}{$cover.legend|escape:'html':'UTF-8'}{else}{$product->name|escape:'html':'UTF-8'}{/if}" width="{$largeSize.width}" height="{$largeSize.height}"/>
<img itemprop="image" src="{$img_prod_dir}{$lang_iso}-default-large_default.jpg" id="bigpic" alt="" title="{$product->name|escape:'html':'UTF-8'}" width="{$largeSize.width}" height="{$largeSize.height}"/>
</span>
{/if} {/if}
{/if} </span>
{hook h='displayProductBloc' mod='antadissimulator'} {else}
</div> <span id="view_full_size">
<!-- Add to cart--> <img itemprop="image" src="{$img_prod_dir}{$lang_iso}-default-large_default.jpg" id="bigpic" alt="" title="{$product->name|escape:'html':'UTF-8'}" width="{$largeSize.width}" height="{$largeSize.height}"/>
<form method="post" class="md6 xxs12" id="buy_block" {if $PS_CATALOG_MODE && !isset($groups) && $product->quantity > 0} class="hidden"{/if} action="{$link->getPageLink('cart')|escape:'html':'UTF-8'}" > </span>
<!-- Infos produits --> {/if}
<div class="row"> {/if}
<div id="main-info" class="lg6 md12 sm6 xxs12"> {hook h='displayProductBloc' mod='antadissimulator'}
{hook h='displayNotes'} </div>
{hook h='displayProductForm' mod='antadisconfigurator'} <!-- Add to cart-->
<form method="post" class="md6 xxs12" id="buy_block" {if $PS_CATALOG_MODE && !isset($groups) && $product->quantity > 0} class="hidden"{/if} action="{$link->getPageLink('cart')|escape:'html':'UTF-8'}" >
<!-- Infos produits -->
<div class="row">
<div id="main-info" class="lg6 md12 sm6 xxs12">
{hook h='displayNotes'}
{hook h='displayProductForm' mod='antadisconfigurator'}
<!-- Description --> <!-- Description -->
{*{if $product->description_short || $packItems|@count > 0} {*{if $product->description_short || $packItems|@count > 0}
{if $product->description_short} {if $product->description_short}
<div class="resume" itemprop="description"> <div class="resume" itemprop="description">
{$product->description_short} {$product->description_short}
</div> </div>
{/if} {/if}
{/if}*} {/if}*}
{if isset($HOOK_PRODUCT_ACTIONS) && $HOOK_PRODUCT_ACTIONS}{$HOOK_PRODUCT_ACTIONS}{/if} {if isset($HOOK_PRODUCT_ACTIONS) && $HOOK_PRODUCT_ACTIONS}{$HOOK_PRODUCT_ACTIONS}{/if}
</div> </div>
<div id="product-actions" class="lg6 md12 xxs12"> <div id="product-actions" class="lg6 md12 xxs12">
<div class="bg-pink-dark clearfix"> <div class="bg-pink-dark clearfix">
<!-- Quantité --> <!-- Quantité -->
<div id="quantity" class="clear invisible no-print"> <div id="quantity" class="clear invisible no-print">
{if !$PS_CATALOG_MODE} {if !$PS_CATALOG_MODE}
<label for="quantity_wanted">{l s='Quantité'}</label> <label for="quantity_wanted">{l s='Quantité'}</label>
<div id="quantity_wanted_p"{if (!$allow_oosp && $product->quantity <= 0) || !$product->available_for_order || $PS_CATALOG_MODE} style="display: none;"{/if}> <div id="quantity_wanted_p"{if (!$allow_oosp && $product->quantity <= 0) || !$product->available_for_order || $PS_CATALOG_MODE} style="display: none;"{/if}>
<div class="valign-middle form-group"> <div class="valign-middle form-group">
<div class="qtyInputs {if $quantity_discounts|@count > 0}spectific-btn{/if}"> <div class="qtyInputs {if $quantity_discounts|@count > 0}spectific-btn{/if}">
{* Configurator + quantity_discounts => gestion des quantités par palier *} {* Configurator + quantity_discounts => gestion des quantités par palier *}
{if $quantity_discounts|@count > 0} {if $quantity_discounts|@count > 0}
{if $product->minimal_quantity == 0} {if $product->minimal_quantity == 0}
<span>{l s='Quantité(s) non définie sur le produit'}</span> <span>{l s='Quantité(s) non définie sur le produit'}</span>
{else} {else}
<select name="qty" id="quantity_wanted" class="custom-input form-control" data-url="./?controller=product&impactprice=1&ajax=1"> <select name="qty" id="quantity_wanted" class="custom-input form-control" data-url="./?controller=product&impactprice=1&ajax=1">
<option value="{$product->minimal_quantity}"{if isset($quantityBackup) && $quantityBackup==$product->minimal_quantity} selected{/if}>{$product->minimal_quantity}</option> <option value="{$product->minimal_quantity}"{if isset($quantityBackup) && $quantityBackup==$product->minimal_quantity} selected{/if}>{$product->minimal_quantity}</option>
{foreach from=$quantity_discounts key=k item=qty} {foreach from=$quantity_discounts key=k item=qty}
<option value="{$qty.quantity}"{if isset($quantityBackup) && $quantityBackup==$qty.quantity} selected{/if}>{$qty.quantity}</option> <option value="{$qty.quantity}"{if isset($quantityBackup) && $quantityBackup==$qty.quantity} selected{/if}>{$qty.quantity}</option>
{/foreach} {/foreach}
</select> </select>
{/if} {/if}
{else} {else}
<a href="#" data-field-qty="qty" class="product_quantity_down"> <a href="#" data-field-qty="qty" class="product_quantity_down">
<i class="icon icon-minus"></i> <i class="icon icon-minus"></i>
</a> </a>
<input type="text" name="qty" id="quantity_wanted" class="form-control" value="{if isset($quantityBackup)}{$quantityBackup|intval}{else}{if $product->minimal_quantity > 1}{$product->minimal_quantity}{else}1{/if}{/if}" /> <input type="text" name="qty" id="quantity_wanted" class="form-control" value="{if isset($quantityBackup)}{$quantityBackup|intval}{else}{if $product->minimal_quantity > 1}{$product->minimal_quantity}{else}1{/if}{/if}" />
<a href="#" data-field-qty="qty" class="product_quantity_up"> <a href="#" data-field-qty="qty" class="product_quantity_up">
<i class="icon icon-plus"></i> <i class="icon icon-plus"></i>
</a> </a>
{/if} {/if}
</div> </div>
</div> </div>
<!-- minimal quantity wanted --> <!-- minimal quantity wanted -->
<p id="minimal_quantity_wanted_p"{if $product->minimal_quantity <= 1 || !$product->available_for_order || $PS_CATALOG_MODE} style="display: none;"{/if}> <p id="minimal_quantity_wanted_p"{if $product->minimal_quantity <= 1 || !$product->available_for_order || $PS_CATALOG_MODE} style="display: none;"{/if}>
{l s='The minimum purchase order quantity for the product is'} <b id="minimal_quantity_label">{$product->minimal_quantity}</b> {l s='The minimum purchase order quantity for the product is'} <b id="minimal_quantity_label">{$product->minimal_quantity}</b>
</p> </p>
</div> </div>
{/if} {/if}
</div> </div>
{if $percentReduction > 0} {if $percentReduction > 0}
<span class="product-reduction">-<span>{$percentReduction}</span><sup>%</sup></span> <span class="product-reduction">-<span>{$percentReduction}</span><sup>%</sup></span>
{/if} {/if}
<p class="hidden"> <p class="hidden">
<input type="hidden" name="token" value="{$static_token}" /> <input type="hidden" name="token" value="{$static_token}" />
<input type="hidden" name="id_product" value="{$product->id|intval}" id="product_page_product_id" /> <input type="hidden" name="id_product" value="{$product->id|intval}" id="product_page_product_id" />
<input type="hidden" name="add" value="1" /> <input type="hidden" name="add" value="1" />
<input type="hidden" name="id_product_attribute" id="idCombination" value="" /> <input type="hidden" name="id_product_attribute" id="idCombination" value="" />
</p> </p>
<!-- availability or doesntExist --> <!-- availability or doesntExist -->
<p id="availability_statut" {if ($product->quantity <= 0 && !$product->available_later && $allow_oosp) || ($product->quantity > 0 && !$product->available_now) || !$product->available_for_order || $PS_CATALOG_MODE} style="display: none;"{/if}> <p id="availability_statut" {if ($product->quantity <= 0 && !$product->available_later && $allow_oosp) || ($product->quantity > 0 && !$product->available_now) || !$product->available_for_order || $PS_CATALOG_MODE} style="display: none;"{/if}>
{if $product->quantity <= 0} {if $product->quantity <= 0}
{if $PS_STOCK_MANAGEMENT && $allow_oosp} {if $PS_STOCK_MANAGEMENT && $allow_oosp}
{$product->available_later} {$product->available_later}
{else} {else}
<span id="availability_value" class="label-warning">{l s='Hors stock'}</span> <span id="availability_value" class="label-warning">{l s='Hors stock'}</span>
{/if} {/if}
{elseif $PS_STOCK_MANAGEMENT} {elseif $PS_STOCK_MANAGEMENT}
<span id="availability_value">{$product->available_now}</span> <span id="availability_value">{$product->available_now}</span>
{/if} {/if}
</span> </span>
</p> </p>
<!-- Attributs produits --> <!-- Attributs produits -->
<div class="product_attributes clearfix"> <div class="product_attributes clearfix">
<!-- Prix --> {if $impactPrice > 0}
{if $product->show_price && !isset($restricted_country_mode) && !$PS_CATALOG_MODE} <div class="hidden">Options sélectionnés: {displayPrice price=$impactPrice}</div>
<div class="price"> {/if}
<p itemprop="offers" itemscope itemtype="http://schema.org/Offer"> <!-- Prix -->
{if $product->quantity > 0}<link itemprop="availability" href="http://schema.org/InStock"/>{/if} {if $product->show_price && !isset($restricted_country_mode) && !$PS_CATALOG_MODE}
{if $priceDisplay >= 0 && $priceDisplay <= 2} <div class="price">
{if $quantity_discounts|@count > 0} <p itemprop="offers" itemscope itemtype="http://schema.org/Offer">
{if isset($quantityBackup)} {if $product->quantity > 0}<link itemprop="availability" href="http://schema.org/InStock"/>{/if}
{assign var=quantityTotal value=$quantityBackup} {if $priceDisplay >= 0 && $priceDisplay <= 2}
{else} {if $quantity_discounts|@count > 0}
{assign var=quantityTotal value=$product->minimal_quantity} {if isset($quantityBackup)}
{/if} {assign var=quantityTotal value=$quantityBackup}
<span id="our_price_display" class="current-price" itemprop="price">{convertPrice price=$productPrice*$quantityTotal}</span> {else}
<small style="display:none;" id="unit_price_display">{convertPrice price=$productPrice}</small> {assign var=quantityTotal value=$product->minimal_quantity}
<span class="old-price"{if (!$product->specificPrice || !$product->specificPrice.reduction) && $group_reduction == 0} class="hidden"{/if}> {/if}
{if $percentReduction > 0} <span id="our_price_display" class="current-price" itemprop="price">{convertPrice price=$productPrice*$quantityTotal+$impactPrice}</span>
{l s='au lieu de '}<span class="barre">{if $productPriceWithoutReduction > $productPrice}{convertPrice price=$productPriceWithoutReduction*$quantityTotal}{/if}</span> <small style="display:none;" id="unit_price_display">{convertPrice price=$productPrice}</small>
{/if} <span class="old-price"{if (!$product->specificPrice || !$product->specificPrice.reduction) && $group_reduction == 0} class="hidden"{/if}>
</span> {if $percentReduction > 0}
{else} {l s='au lieu de '}<span class="barre">{if $productPriceWithoutReduction > $productPrice}{convertPrice price=$productPriceWithoutReduction*$quantityTotal}{/if}</span>
<span id="our_price_display" class="current-price" itemprop="price">{convertPrice price=$productPrice}</span> {/if}
<span class="old-price"{if (!$product->specificPrice || !$product->specificPrice.reduction) && $group_reduction == 0} class="hidden"{/if}> </span>
{if $percentReduction > 0} {else}
{l s='au lieu de '}<span class="barre">{if $productPriceWithoutReduction > $productPrice}{convertPrice price=$productPriceWithoutReduction}{/if}</span> <span id="our_price_display" class="current-price" itemprop="price">{convertPrice price=$productPrice}</span>
{/if} <span class="old-price"{if (!$product->specificPrice || !$product->specificPrice.reduction) && $group_reduction == 0} class="hidden"{/if}>
</span> {if $percentReduction > 0}
{/if} {l s='au lieu de '}<span class="barre">{if $productPriceWithoutReduction > $productPrice}{convertPrice price=$productPriceWithoutReduction}{/if}</span>
<meta itemprop="priceCurrency" content="{$currency->iso_code}" /> {/if}
{hook h="displayProductPriceBlock" product=$product type="price"} </span>
{/if} {/if}
</p> <meta itemprop="priceCurrency" content="{$currency->iso_code}" />
</div> <!-- end prices --> {hook h="displayProductPriceBlock" product=$product type="price"}
{/if}
{if $packItems|@count && $productPrice < $product->getNoPackPrice()} </p>
<div class="pack-price">{l s='Price of products purchased separately : '}{convertPrice price=$product->getNoPackPrice()}</div> </div> <!-- end prices -->
{/if}
{if $packItems|@count && $productPrice < $product->getNoPackPrice()}
{if !empty($product->unity) && $product->unit_price_ratio > 0.000000} <div class="pack-price">{l s='Price of products purchased separately : '}{convertPrice price=$product->getNoPackPrice()}</div>
{math equation="pprice / punit_price" pprice=$productPrice punit_price=$product->unit_price_ratio assign=unit_price} {/if}
<p class="unit-price"><span id="unit_price_display">{convertPrice price=$unit_price}</span> {l s='per'} {$product->unity|escape:'html':'UTF-8'}</p>
{hook h="displayProductPriceBlock" product=$product type="unit_price"} {if !empty($product->unity) && $product->unit_price_ratio > 0.000000}
{/if} {math equation="pprice / punit_price" pprice=$productPrice punit_price=$product->unit_price_ratio assign=unit_price}
{/if} <p class="unit-price"><span id="unit_price_display">{convertPrice price=$unit_price}</span> {l s='per'} {$product->unity|escape:'html':'UTF-8'}</p>
{hook h="displayProductPriceBlock" product=$product type="unit_price"}
{/if}
<!-- Attributs --> {/if}
{if isset($groups)}
<div id="attributes" class="clear">
{foreach from=$groups key=id_attribute_group item=group} <!-- Attributs -->
{if $group.attributes|@count} {if isset($groups)}
<fieldset> <div id="attributes" class="clear">
<label>{$group.name|escape:'html':'UTF-8'}&nbsp;</label> {foreach from=$groups key=id_attribute_group item=group}
{assign var="groupName" value="group_$id_attribute_group"} {if $group.attributes|@count}
<div class="attribute_list"> <fieldset>
{if ($group.group_type == 'select')} <label>{$group.name|escape:'html':'UTF-8'}&nbsp;</label>
<select name="{$groupName}" id="group_{$id_attribute_group|intval}" class="custom-input form-control attribute_select no-print"> {assign var="groupName" value="group_$id_attribute_group"}
{foreach from=$group.attributes key=id_attribute item=group_attribute} <div class="attribute_list">
<option value="{$id_attribute|intval}"{if (isset($smarty.get.$groupName) && $smarty.get.$groupName|intval == $id_attribute) || $group.default == $id_attribute} selected="selected"{/if} title="{$group_attribute|escape:'html':'UTF-8'}">{$group_attribute|escape:'html':'UTF-8'}</option> {if ($group.group_type == 'select')}
{/foreach} <select name="{$groupName}" id="group_{$id_attribute_group|intval}" class="custom-input form-control attribute_select no-print">
</select> {foreach from=$group.attributes key=id_attribute item=group_attribute}
{elseif ($group.group_type == 'color')} <option value="{$id_attribute|intval}"{if (isset($smarty.get.$groupName) && $smarty.get.$groupName|intval == $id_attribute) || $group.default == $id_attribute} selected="selected"{/if} title="{$group_attribute|escape:'html':'UTF-8'}">{$group_attribute|escape:'html':'UTF-8'}</option>
<ul class="color"> {/foreach}
{assign var="default_colorpicker" value=""} </select>
{foreach from=$group.attributes key=id_attribute item=group_attribute} {elseif ($group.group_type == 'color')}
{assign var='img_color_exists' value=file_exists($col_img_dir|cat:$id_attribute|cat:'.jpg')} <ul class="color">
<li{if $group.default == $id_attribute} class="selected"{/if}> {assign var="default_colorpicker" value=""}
<a href="{$link->getProductLink($product)|escape:'html':'UTF-8'}" id="color_{$id_attribute|intval}" name="{$colors.$id_attribute.name|escape:'html':'UTF-8'}" class="color_pick{if ($group.default == $id_attribute)} selected{/if}"{if !$img_color_exists && isset($colors.$id_attribute.value) && $colors.$id_attribute.value} style="background:{$colors.$id_attribute.value|escape:'html':'UTF-8'};"{/if} title="{$colors.$id_attribute.name|escape:'html':'UTF-8'}"> {foreach from=$group.attributes key=id_attribute item=group_attribute}
{if $img_color_exists} {assign var='img_color_exists' value=file_exists($col_img_dir|cat:$id_attribute|cat:'.jpg')}
<img src="{$img_col_dir}{$id_attribute|intval}.jpg" alt="{$colors.$id_attribute.name|escape:'html':'UTF-8'}" title="{$colors.$id_attribute.name|escape:'html':'UTF-8'}" width="35" height="35" /> <li{if $group.default == $id_attribute} class="selected"{/if}>
{/if} <a href="{$link->getProductLink($product)|escape:'html':'UTF-8'}" id="color_{$id_attribute|intval}" name="{$colors.$id_attribute.name|escape:'html':'UTF-8'}" class="color_pick{if ($group.default == $id_attribute)} selected{/if}"{if !$img_color_exists && isset($colors.$id_attribute.value) && $colors.$id_attribute.value} style="background:{$colors.$id_attribute.value|escape:'html':'UTF-8'};"{/if} title="{$colors.$id_attribute.name|escape:'html':'UTF-8'}">
</a> {if $img_color_exists}
</li> <img src="{$img_col_dir}{$id_attribute|intval}.jpg" alt="{$colors.$id_attribute.name|escape:'html':'UTF-8'}" title="{$colors.$id_attribute.name|escape:'html':'UTF-8'}" width="35" height="35" />
{if ($group.default == $id_attribute)} {/if}
{$default_colorpicker = $id_attribute} </a>
{/if} </li>
{/foreach} {if ($group.default == $id_attribute)}
</ul> {$default_colorpicker = $id_attribute}
<input type="hidden" class="color_pick_hidden" name="{$groupName|escape:'html':'UTF-8'}" value="{$default_colorpicker|intval}" /> {/if}
{elseif ($group.group_type == 'radio')} {/foreach}
<ul> </ul>
{foreach from=$group.attributes key=id_attribute item=group_attribute} <input type="hidden" class="color_pick_hidden" name="{$groupName|escape:'html':'UTF-8'}" value="{$default_colorpicker|intval}" />
<li> {elseif ($group.group_type == 'radio')}
<input type="radio" class="custom-input attribute_radio" name="{$groupName|escape:'html':'UTF-8'}" value="{$id_attribute}" {if ($group.default == $id_attribute)} checked="checked"{/if} /> <ul>
<span>{$group_attribute|escape:'html':'UTF-8'}</span> {foreach from=$group.attributes key=id_attribute item=group_attribute}
</li> <li>
{/foreach} <input type="radio" class="custom-input attribute_radio" name="{$groupName|escape:'html':'UTF-8'}" value="{$id_attribute}" {if ($group.default == $id_attribute)} checked="checked"{/if} />
</ul> <span>{$group_attribute|escape:'html':'UTF-8'}</span>
{/if} </li>
</div> {/foreach}
</fieldset> </ul>
{/if} {/if}
{/foreach} </div>
</div> </fieldset>
{/if} {/if}
</div> {/foreach}
</div>
<p id="availability_date"{if ($product->quantity > 0) || !$product->available_for_order || $PS_CATALOG_MODE || !isset($product->available_date) || $product->available_date < $smarty.now|date_format:'%Y-%m-%d'} style="display: none;"{/if}> {/if}
<span id="availability_date_label">{l s='Ce produit sera de nouveau disponible à partir du '}</span> </div>
<span id="availability_date_value">{if Validate::isDate($product->available_date)}{dateFormat date=$product->available_date full=false}{/if}</span>
</p> <p id="availability_date"{if ($product->quantity > 0) || !$product->available_for_order || $PS_CATALOG_MODE || !isset($product->available_date) || $product->available_date < $smarty.now|date_format:'%Y-%m-%d'} style="display: none;"{/if}>
<span id="availability_date_label">{l s='Ce produit sera de nouveau disponible à partir du '}</span>
<span id="availability_date_value">{if Validate::isDate($product->available_date)}{dateFormat date=$product->available_date full=false}{/if}</span>
<div class="box-cart-bottom"> </p>
<div{if (!$allow_oosp && $product->quantity <= 0) || !$product->available_for_order || (isset($restricted_country_mode) && $restricted_country_mode) || $PS_CATALOG_MODE} class="unvisible"{/if}>
<p>
<button type="submit" name="Submit" class="btn btn-full-width"> <div class="box-cart-bottom">
<span>{if $content_only && (isset($product->customization_required) && $product->customization_required)}{l s='Customize'}{else}{l s='Add to cart'}{/if}</span> <div{if (!$allow_oosp && $product->quantity <= 0) || !$product->available_for_order || (isset($restricted_country_mode) && $restricted_country_mode) || $PS_CATALOG_MODE} class="unvisible"{/if}>
</button> <p>
</p> <button type="submit" name="Submit" class="btn btn-full-width">
</div> <span>{if $content_only && (isset($product->customization_required) && $product->customization_required)}{l s='Customize'}{else}{l s='Add to cart'}{/if}</span>
</div> </button>
</p>
</div> </div>
{hook h="displayReinsurranceProduct"}
{hook h='displayBottomColumnProduct'}
</div> </div>
</div> </div>
</form> {hook h="displayReinsurranceProduct"}
</div> {hook h='displayBottomColumnProduct'}
</div> </div>
</div>
</form>
</div> </div>
<div class="ctn"> </div>
<div class="ctn-reassurance"> </div>
{hook h='displayReassurance2'} <div class="ctn">
</div> <div class="ctn-reassurance">
</div> {hook h='displayReassurance2'}
</section> </div>
</main> </div>
</section>
</main>

View File

@ -29,6 +29,7 @@
</small> </small>
{/foreach} {/foreach}
{/if} {/if}
{if !isset($noDeleteButton) || !$noDeleteButton} {if !isset($noDeleteButton) || !$noDeleteButton}
{if (!isset($customizedDatas.$productId.$productAttributeId) OR $quantityDisplayed > 0) && empty($product.gift)} {if (!isset($customizedDatas.$productId.$productAttributeId) OR $quantityDisplayed > 0) && empty($product.gift)}
<a rel="nofollow" title="{l s='Delete'}" class="product-delete cart_quantity_delete" id="{$product.id_product}_{$product.id_product_attribute}_{if $quantityDisplayed > 0}nocustom{else}0{/if}_{$product.id_address_delivery|intval}_{$product.id_configurator|intval}" href="{$link->getPageLink('cart', true, NULL, "delete=1&amp;id_product={$product.id_product|intval}&amp;ipa={$product.id_product_attribute|intval}&amp;id_address_delivery={$product.id_address_delivery|intval}&amp;id_configurator={$product.id_configurator|intval}&amp;token={$token_cart}")|escape:'html':'UTF-8'}"> <a rel="nofollow" title="{l s='Delete'}" class="product-delete cart_quantity_delete" id="{$product.id_product}_{$product.id_product_attribute}_{if $quantityDisplayed > 0}nocustom{else}0{/if}_{$product.id_address_delivery|intval}_{$product.id_configurator|intval}" href="{$link->getPageLink('cart', true, NULL, "delete=1&amp;id_product={$product.id_product|intval}&amp;ipa={$product.id_product_attribute|intval}&amp;id_address_delivery={$product.id_address_delivery|intval}&amp;id_configurator={$product.id_configurator|intval}&amp;token={$token_cart}")|escape:'html':'UTF-8'}">
@ -126,6 +127,13 @@
{/if} {/if}
{/if} {/if}
</span> </span>
{if isset($product.configurator_opt)}
{$id_configurator}
<span class="product_configurator_options" style="display:block; clear:both; font-size:12px;">
Options : + {displayPrice price=Product::getConfiguratorSelectedPriceTotal($product.id_product, $product.id_configurator)}
</span>
{/if}
{/if} {/if}
</div> </div>
</div> </div>