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;
}
// Configurator impact
$flatrate = true;
$impact = 0;
if ($product['id_configurator'] != 0) {
$impact = Product::getConfiguratorSelectedPriceTotal($product['id_product'], $product['id_configurator']);
}
switch ($ps_round_type) {
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;
case Order::ROUND_LINE:
$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);
break;
case Order::ROUND_ITEM:
default:
$product_price = /*$with_taxes ? $tax_calculator->addTaxes($price) : */$price;
$products_total[$id_tax_rules_group] += Tools::ps_round($product_price, $compute_precision) * (int)$product['cart_quantity'];
$product_price = $price;
$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;
}
}

View File

@ -35,32 +35,13 @@ class Product extends ProductCore
return $priceImpact;
}
/**
* Price calculation / Get product price
*
* @param int $id_shop Shop id
* @param int $id_product Product id
* @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 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);
}
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_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];
}
/**
* Override product price
*/
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,
$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 $productWithImpactPrice;
public function init()
{
parent::init();
@ -43,16 +45,22 @@ class ProductController extends ProductControllerCore
$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()
{
if ($this->ajax && Tools::getValue('impactprice', 0)) {
$qty = Tools::getValue('qty', 1);
$return = array(
'priceDisplay' => Tools::displayPrice($this->impactPrice),
'price' => $this->impactPrice,
'priceUnitDisplay' => Tools::displayPrice($this->product->getPrice(true, null, 6, null, false, true, $qty)),
'priceDisplay' => Tools::displayPrice($this->productPriceWithImpact),
'price' => $this->productPriceWithImpact,
);
die(Tools::jsonEncode($return));
}

View File

@ -600,8 +600,6 @@ class Cart extends CartCore
$products = $this->getProducts($refresh);
foreach ($products as $key => &$product) {
$null = null;
$product['price_without_quantity_discount'] = Product::getPriceStatic(
$product['id_product'],
@ -899,21 +897,39 @@ class Cart extends CartCore
} elseif (!isset($products_total[$id_tax_rules_group.'_'.$id_address])) {
$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) {
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;
case Order::ROUND_LINE:
$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);
break;
case Order::ROUND_ITEM:
default:
$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;
}
}

View File

@ -125,19 +125,6 @@ class Product extends ProductCore
),
);
/*
* module: antadisconfigurator
* 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
WHERE id_product = '.$this->id.'
AND id_configurator_opt IN('.join(',', $optId).')';
$sql = 'SELECT pcoi.`price` FROM `'._DB_PREFIX_.'product_configurator_opt_impact` pcoi
WHERE pcoi.`id_product` = '.$this->id.'
AND pcoi.`id_configurator`_opt IN('.join(',', $optId).')';
$result = Db::getInstance()->executeS($sql);
if (count($result) > 0) {
foreach ($result as $item) {
@ -172,6 +159,12 @@ class Product extends ProductCore
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
@ -317,7 +310,8 @@ class Product extends ProductCore
$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.
' AND id_product = '.(int)$id_product;
$priceResult = Db::getInstance()->executeS($sql);

View File

@ -15,6 +15,13 @@ class ProductController extends ProductControllerCore
*/
protected $impactPrice;
/*
* module: antadisconfigurator
* date: 2017-06-27 12:10:07
* version: 0.1
*/
protected $productPriceWithImpact;
/*
* module: antadisconfigurator
* date: 2017-06-27 12:10:07
@ -24,7 +31,7 @@ class ProductController extends ProductControllerCore
{
parent::init();
if (Tools::getValue('ajax') && Tools::getValue('action') == 'getProductInfo'){
if (Tools::getValue('ajax') && Tools::getValue('action') == 'getProductInfo') {
$this->ajaxProcessGetProductInfo();
}
@ -62,10 +69,11 @@ class ProductController extends ProductControllerCore
$impact = $this->product->getConfiguratorImpactPrice($this->optValues);
}
$this->impactPrice = $impact;
// We want total price
$productPrice = $productPrice * $qty;
$this->impactPrice = $productPrice + $impact;
$this->productPriceWithImpact = $productPrice + $impact;
}
}
@ -80,8 +88,8 @@ class ProductController extends ProductControllerCore
$qty = Tools::getValue('qty', 1);
$return = array(
'priceUnitDisplay' => Tools::displayPrice($this->product->getPrice(true, null, 6, null, false, true, $qty)),
'priceDisplay' => Tools::displayPrice($this->impactPrice),
'price' => $this->impactPrice,
'priceDisplay' => Tools::displayPrice($this->productPriceWithImpact),
'price' => $this->productPriceWithImpact,
);
die(Tools::jsonEncode($return));
}
@ -101,6 +109,23 @@ class ProductController extends ProductControllerCore
$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()
{
$context = Context::getContext();

View File

@ -5,254 +5,257 @@
{/if}
<main class="product-main configurator">
<section itemscope itemtype="http://schema.org/Product" {if $content_only}class="frame"{else}class="container-big bg-green"{/if}>
<header class="page-heading">
{include file="$tpl_dir./breadcrumb.tpl"}
<div class="ctn">
<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="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>
</div>
<section itemscope itemtype="http://schema.org/Product" {if $content_only}class="frame"{else}class="container-big bg-green"{/if}>
<header class="page-heading">
{include file="$tpl_dir./breadcrumb.tpl"}
<div class="ctn">
<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="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>
</div>
{if isset($confirmation) && $confirmation}
<p class="confirmation">
{$confirmation}
</p>
{/if}
</header>
{if isset($confirmation) && $confirmation}
<p class="confirmation">
{$confirmation}
</p>
{/if}
</header>
<div class="content container">
<div class="bg">
<div class="row">
<!-- Images-->
<div id="image-block" class="md6 xxs12 {if $noSimulator}noSimulator{/if}">
{if $noSimulator}
{if $have_image}
<span id="view_full_size">
{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'}">
<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>
{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>
<div class="content container">
<div class="bg">
<div class="row">
<!-- Images-->
<div id="image-block" class="md6 xxs12 {if $noSimulator}noSimulator{/if}">
{if $noSimulator}
{if $have_image}
<span id="view_full_size">
{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'}">
<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>
{else}
<span id="view_full_size">
<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>
<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}
{/if}
{hook h='displayProductBloc' mod='antadissimulator'}
</div>
<!-- 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'}
</span>
{else}
<span id="view_full_size">
<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}
{hook h='displayProductBloc' mod='antadissimulator'}
</div>
<!-- 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 -->
{*{if $product->description_short || $packItems|@count > 0}
{if $product->description_short}
<div class="resume" itemprop="description">
{$product->description_short}
</div>
{/if}
{/if}*}
{if isset($HOOK_PRODUCT_ACTIONS) && $HOOK_PRODUCT_ACTIONS}{$HOOK_PRODUCT_ACTIONS}{/if}
</div>
<div id="product-actions" class="lg6 md12 xxs12">
<div class="bg-pink-dark clearfix">
<!-- Quantité -->
<div id="quantity" class="clear invisible no-print">
{if !$PS_CATALOG_MODE}
<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 class="valign-middle form-group">
<div class="qtyInputs {if $quantity_discounts|@count > 0}spectific-btn{/if}">
{* Configurator + quantity_discounts => gestion des quantités par palier *}
{if $quantity_discounts|@count > 0}
{if $product->minimal_quantity == 0}
<span>{l s='Quantité(s) non définie sur le produit'}</span>
{else}
<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>
{foreach from=$quantity_discounts key=k item=qty}
<option value="{$qty.quantity}"{if isset($quantityBackup) && $quantityBackup==$qty.quantity} selected{/if}>{$qty.quantity}</option>
{/foreach}
</select>
{/if}
{else}
<a href="#" data-field-qty="qty" class="product_quantity_down">
<i class="icon icon-minus"></i>
</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}" />
<a href="#" data-field-qty="qty" class="product_quantity_up">
<i class="icon icon-plus"></i>
</a>
{/if}
</div>
</div>
<!-- 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}>
{l s='The minimum purchase order quantity for the product is'} <b id="minimal_quantity_label">{$product->minimal_quantity}</b>
</p>
</div>
{/if}
</div>
{if $percentReduction > 0}
<span class="product-reduction">-<span>{$percentReduction}</span><sup>%</sup></span>
{/if}
<p class="hidden">
<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="add" value="1" />
<input type="hidden" name="id_product_attribute" id="idCombination" value="" />
</p>
<!-- 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}>
{if $product->quantity <= 0}
{if $PS_STOCK_MANAGEMENT && $allow_oosp}
{$product->available_later}
{else}
<span id="availability_value" class="label-warning">{l s='Hors stock'}</span>
{/if}
{elseif $PS_STOCK_MANAGEMENT}
<span id="availability_value">{$product->available_now}</span>
{/if}
</span>
</p>
<!-- Attributs produits -->
<div class="product_attributes clearfix">
<!-- Prix -->
{if $product->show_price && !isset($restricted_country_mode) && !$PS_CATALOG_MODE}
<div class="price">
<p itemprop="offers" itemscope itemtype="http://schema.org/Offer">
{if $product->quantity > 0}<link itemprop="availability" href="http://schema.org/InStock"/>{/if}
{if $priceDisplay >= 0 && $priceDisplay <= 2}
{if $quantity_discounts|@count > 0}
{if isset($quantityBackup)}
{assign var=quantityTotal value=$quantityBackup}
{else}
{assign var=quantityTotal value=$product->minimal_quantity}
{/if}
<span id="our_price_display" class="current-price" itemprop="price">{convertPrice price=$productPrice*$quantityTotal}</span>
<small style="display:none;" id="unit_price_display">{convertPrice price=$productPrice}</small>
<span class="old-price"{if (!$product->specificPrice || !$product->specificPrice.reduction) && $group_reduction == 0} class="hidden"{/if}>
{if $percentReduction > 0}
{l s='au lieu de '}<span class="barre">{if $productPriceWithoutReduction > $productPrice}{convertPrice price=$productPriceWithoutReduction*$quantityTotal}{/if}</span>
{/if}
</span>
{else}
<span id="our_price_display" class="current-price" itemprop="price">{convertPrice price=$productPrice}</span>
<span class="old-price"{if (!$product->specificPrice || !$product->specificPrice.reduction) && $group_reduction == 0} class="hidden"{/if}>
{if $percentReduction > 0}
{l s='au lieu de '}<span class="barre">{if $productPriceWithoutReduction > $productPrice}{convertPrice price=$productPriceWithoutReduction}{/if}</span>
{/if}
</span>
{/if}
<meta itemprop="priceCurrency" content="{$currency->iso_code}" />
{hook h="displayProductPriceBlock" product=$product type="price"}
{/if}
</p>
</div> <!-- end prices -->
{if $packItems|@count && $productPrice < $product->getNoPackPrice()}
<div class="pack-price">{l s='Price of products purchased separately : '}{convertPrice price=$product->getNoPackPrice()}</div>
{/if}
{if !empty($product->unity) && $product->unit_price_ratio > 0.000000}
{math equation="pprice / punit_price" pprice=$productPrice punit_price=$product->unit_price_ratio assign=unit_price}
<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}
{/if}
<!-- Attributs -->
{if isset($groups)}
<div id="attributes" class="clear">
{foreach from=$groups key=id_attribute_group item=group}
{if $group.attributes|@count}
<fieldset>
<label>{$group.name|escape:'html':'UTF-8'}&nbsp;</label>
{assign var="groupName" value="group_$id_attribute_group"}
<div class="attribute_list">
{if ($group.group_type == 'select')}
<select name="{$groupName}" id="group_{$id_attribute_group|intval}" class="custom-input form-control attribute_select no-print">
{foreach from=$group.attributes key=id_attribute item=group_attribute}
<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>
{/foreach}
</select>
{elseif ($group.group_type == 'color')}
<ul class="color">
{assign var="default_colorpicker" value=""}
{foreach from=$group.attributes key=id_attribute item=group_attribute}
{assign var='img_color_exists' value=file_exists($col_img_dir|cat:$id_attribute|cat:'.jpg')}
<li{if $group.default == $id_attribute} class="selected"{/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'}">
{if $img_color_exists}
<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}
</a>
</li>
{if ($group.default == $id_attribute)}
{$default_colorpicker = $id_attribute}
{/if}
{/foreach}
</ul>
<input type="hidden" class="color_pick_hidden" name="{$groupName|escape:'html':'UTF-8'}" value="{$default_colorpicker|intval}" />
{elseif ($group.group_type == 'radio')}
<ul>
{foreach from=$group.attributes key=id_attribute item=group_attribute}
<li>
<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} />
<span>{$group_attribute|escape:'html':'UTF-8'}</span>
</li>
{/foreach}
</ul>
{/if}
</div>
</fieldset>
{/if}
{/foreach}
</div>
{/if}
</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}>
<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>
</p>
<div class="box-cart-bottom">
<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">
<span>{if $content_only && (isset($product->customization_required) && $product->customization_required)}{l s='Customize'}{else}{l s='Add to cart'}{/if}</span>
</button>
</p>
</div>
</div>
<!-- Description -->
{*{if $product->description_short || $packItems|@count > 0}
{if $product->description_short}
<div class="resume" itemprop="description">
{$product->description_short}
</div>
{/if}
{/if}*}
{if isset($HOOK_PRODUCT_ACTIONS) && $HOOK_PRODUCT_ACTIONS}{$HOOK_PRODUCT_ACTIONS}{/if}
</div>
<div id="product-actions" class="lg6 md12 xxs12">
<div class="bg-pink-dark clearfix">
<!-- Quantité -->
<div id="quantity" class="clear invisible no-print">
{if !$PS_CATALOG_MODE}
<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 class="valign-middle form-group">
<div class="qtyInputs {if $quantity_discounts|@count > 0}spectific-btn{/if}">
{* Configurator + quantity_discounts => gestion des quantités par palier *}
{if $quantity_discounts|@count > 0}
{if $product->minimal_quantity == 0}
<span>{l s='Quantité(s) non définie sur le produit'}</span>
{else}
<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>
{foreach from=$quantity_discounts key=k item=qty}
<option value="{$qty.quantity}"{if isset($quantityBackup) && $quantityBackup==$qty.quantity} selected{/if}>{$qty.quantity}</option>
{/foreach}
</select>
{/if}
{else}
<a href="#" data-field-qty="qty" class="product_quantity_down">
<i class="icon icon-minus"></i>
</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}" />
<a href="#" data-field-qty="qty" class="product_quantity_up">
<i class="icon icon-plus"></i>
</a>
{/if}
</div>
</div>
<!-- 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}>
{l s='The minimum purchase order quantity for the product is'} <b id="minimal_quantity_label">{$product->minimal_quantity}</b>
</p>
</div>
{/if}
</div>
{if $percentReduction > 0}
<span class="product-reduction">-<span>{$percentReduction}</span><sup>%</sup></span>
{/if}
<p class="hidden">
<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="add" value="1" />
<input type="hidden" name="id_product_attribute" id="idCombination" value="" />
</p>
<!-- 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}>
{if $product->quantity <= 0}
{if $PS_STOCK_MANAGEMENT && $allow_oosp}
{$product->available_later}
{else}
<span id="availability_value" class="label-warning">{l s='Hors stock'}</span>
{/if}
{elseif $PS_STOCK_MANAGEMENT}
<span id="availability_value">{$product->available_now}</span>
{/if}
</span>
</p>
<!-- Attributs produits -->
<div class="product_attributes clearfix">
{if $impactPrice > 0}
<div class="hidden">Options sélectionnés: {displayPrice price=$impactPrice}</div>
{/if}
<!-- Prix -->
{if $product->show_price && !isset($restricted_country_mode) && !$PS_CATALOG_MODE}
<div class="price">
<p itemprop="offers" itemscope itemtype="http://schema.org/Offer">
{if $product->quantity > 0}<link itemprop="availability" href="http://schema.org/InStock"/>{/if}
{if $priceDisplay >= 0 && $priceDisplay <= 2}
{if $quantity_discounts|@count > 0}
{if isset($quantityBackup)}
{assign var=quantityTotal value=$quantityBackup}
{else}
{assign var=quantityTotal value=$product->minimal_quantity}
{/if}
<span id="our_price_display" class="current-price" itemprop="price">{convertPrice price=$productPrice*$quantityTotal+$impactPrice}</span>
<small style="display:none;" id="unit_price_display">{convertPrice price=$productPrice}</small>
<span class="old-price"{if (!$product->specificPrice || !$product->specificPrice.reduction) && $group_reduction == 0} class="hidden"{/if}>
{if $percentReduction > 0}
{l s='au lieu de '}<span class="barre">{if $productPriceWithoutReduction > $productPrice}{convertPrice price=$productPriceWithoutReduction*$quantityTotal}{/if}</span>
{/if}
</span>
{else}
<span id="our_price_display" class="current-price" itemprop="price">{convertPrice price=$productPrice}</span>
<span class="old-price"{if (!$product->specificPrice || !$product->specificPrice.reduction) && $group_reduction == 0} class="hidden"{/if}>
{if $percentReduction > 0}
{l s='au lieu de '}<span class="barre">{if $productPriceWithoutReduction > $productPrice}{convertPrice price=$productPriceWithoutReduction}{/if}</span>
{/if}
</span>
{/if}
<meta itemprop="priceCurrency" content="{$currency->iso_code}" />
{hook h="displayProductPriceBlock" product=$product type="price"}
{/if}
</p>
</div> <!-- end prices -->
{if $packItems|@count && $productPrice < $product->getNoPackPrice()}
<div class="pack-price">{l s='Price of products purchased separately : '}{convertPrice price=$product->getNoPackPrice()}</div>
{/if}
{if !empty($product->unity) && $product->unit_price_ratio > 0.000000}
{math equation="pprice / punit_price" pprice=$productPrice punit_price=$product->unit_price_ratio assign=unit_price}
<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}
{/if}
<!-- Attributs -->
{if isset($groups)}
<div id="attributes" class="clear">
{foreach from=$groups key=id_attribute_group item=group}
{if $group.attributes|@count}
<fieldset>
<label>{$group.name|escape:'html':'UTF-8'}&nbsp;</label>
{assign var="groupName" value="group_$id_attribute_group"}
<div class="attribute_list">
{if ($group.group_type == 'select')}
<select name="{$groupName}" id="group_{$id_attribute_group|intval}" class="custom-input form-control attribute_select no-print">
{foreach from=$group.attributes key=id_attribute item=group_attribute}
<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>
{/foreach}
</select>
{elseif ($group.group_type == 'color')}
<ul class="color">
{assign var="default_colorpicker" value=""}
{foreach from=$group.attributes key=id_attribute item=group_attribute}
{assign var='img_color_exists' value=file_exists($col_img_dir|cat:$id_attribute|cat:'.jpg')}
<li{if $group.default == $id_attribute} class="selected"{/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'}">
{if $img_color_exists}
<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}
</a>
</li>
{if ($group.default == $id_attribute)}
{$default_colorpicker = $id_attribute}
{/if}
{/foreach}
</ul>
<input type="hidden" class="color_pick_hidden" name="{$groupName|escape:'html':'UTF-8'}" value="{$default_colorpicker|intval}" />
{elseif ($group.group_type == 'radio')}
<ul>
{foreach from=$group.attributes key=id_attribute item=group_attribute}
<li>
<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} />
<span>{$group_attribute|escape:'html':'UTF-8'}</span>
</li>
{/foreach}
</ul>
{/if}
</div>
</fieldset>
{/if}
{/foreach}
</div>
{/if}
</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}>
<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>
</p>
<div class="box-cart-bottom">
<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">
<span>{if $content_only && (isset($product->customization_required) && $product->customization_required)}{l s='Customize'}{else}{l s='Add to cart'}{/if}</span>
</button>
</p>
</div>
{hook h="displayReinsurranceProduct"}
{hook h='displayBottomColumnProduct'}
</div>
</div>
</form>
</div>
</div>
{hook h="displayReinsurranceProduct"}
{hook h='displayBottomColumnProduct'}
</div>
</div>
</form>
</div>
<div class="ctn">
<div class="ctn-reassurance">
{hook h='displayReassurance2'}
</div>
</div>
</section>
</main>
</div>
</div>
<div class="ctn">
<div class="ctn-reassurance">
{hook h='displayReassurance2'}
</div>
</div>
</section>
</main>

View File

@ -29,6 +29,7 @@
</small>
{/foreach}
{/if}
{if !isset($noDeleteButton) || !$noDeleteButton}
{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'}">
@ -126,6 +127,13 @@
{/if}
{/if}
</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}
</div>
</div>