[-] MO: Display real price instead of Free for product which are not gifts on blockcart #PSCFV-6423
This commit is contained in:
@@ -353,7 +353,7 @@ var ajaxCart = {
|
||||
var removeLinks = $('#cart_block_product_' + domIdProduct).find('a.ajax_cart_block_remove_link');
|
||||
if (!product.hasCustomizedDatas && !removeLinks.length)
|
||||
$('#' + domIdProduct + ' span.remove_link').html('<a class="ajax_cart_block_remove_link" rel="nofollow" href="' + baseUri + '?controller=cart&delete&id_product=' + product['id'] + '&ipa=' + product['idCombination'] + '&token=' + static_token + '"> </a>');
|
||||
if (parseFloat(product.price_float) <= 0)
|
||||
if (product.is_gift)
|
||||
$('#' + domIdProduct + ' span.remove_link').html('');
|
||||
},
|
||||
|
||||
@@ -453,7 +453,7 @@ var ajaxCart = {
|
||||
else
|
||||
content += '<span class="remove_link"></span>';
|
||||
if (typeof(freeShippingTranslation) != 'undefined')
|
||||
content += '<span class="price">' + (parseFloat(this.price_float) > 0 ? this.priceByLine : freeProductTranslation) + '</span>';
|
||||
content += '<span class="price">' + (parseFloat(this.price_float) > 0 ? this.priceByLine : freeShippingTranslation) + '</span>';
|
||||
content += '</dt>';
|
||||
if (this.hasAttributes)
|
||||
content += '<dd id="cart_block_combination_of_' + domIdProduct + '" class="hidden"><a href="' + this.link + '" title="' + this.name + '">' + this.attributes + '</a>';
|
||||
@@ -470,7 +470,7 @@ var ajaxCart = {
|
||||
if($('#cart_block_product_' + domIdProduct + ' .quantity').text() != jsonProduct.quantity || $('dt#cart_block_product_' + domIdProduct + ' .price').text() != jsonProduct.priceByLine)
|
||||
{
|
||||
// Usual product
|
||||
if (parseFloat(this.price_float) > 0)
|
||||
if (!this.is_gift)
|
||||
$('#cart_block_product_' + domIdProduct + ' .price').text(jsonProduct.priceByLine);
|
||||
else
|
||||
$('#cart_block_product_' + domIdProduct + ' .price').html(freeProductTranslation);
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
"price_float": "{$product.total}",
|
||||
"idCombination": {if isset($product.attributes_small)}{$productAttributeId}{else}0{/if},
|
||||
"idAddressDelivery": {if isset($product.id_address_delivery)}{$product.id_address_delivery}{else}0{/if},
|
||||
"is_gift" : {if isset($product.is_gift) && $product.is_gift}1{else}0{/if},
|
||||
{if isset($product.attributes_small)}
|
||||
"hasAttributes": true,
|
||||
"attributes": "{$product.attributes_small|addslashes|replace:'\\\'':'\''}",
|
||||
|
||||
@@ -89,6 +89,7 @@ class BlockCart extends Module
|
||||
foreach ($products as &$product)
|
||||
if ($product['id_product'] == $cart_rule['gift_product'] && $product['id_product_attribute'] == $cart_rule['gift_product_attribute'])
|
||||
{
|
||||
$product['is_gift'] = 1;
|
||||
$product['total_wt'] = Tools::ps_round($product['total_wt'] - $product['price_wt'], (int)$currency->decimals * _PS_PRICE_DISPLAY_PRECISION_);
|
||||
$product['total'] = Tools::ps_round($product['total'] - $product['price'], (int)$currency->decimals * _PS_PRICE_DISPLAY_PRECISION_);
|
||||
$cart_rule['value_real'] = Tools::ps_round($cart_rule['value_real'] - $product['price_wt'], (int)$currency->decimals * _PS_PRICE_DISPLAY_PRECISION_);
|
||||
|
||||
@@ -78,9 +78,9 @@ var delete_txt = '{l s='Delete' mod='blockcart' js=1}';
|
||||
<span class="quantity-formated"><span class="quantity">{$product.cart_quantity}</span>x</span>
|
||||
<a class="cart_block_product_name" href="{$link->getProductLink($product, $product.link_rewrite, $product.category, null, null, $product.id_shop, $product.id_product_attribute)}" title="{$product.name|escape:html:'UTF-8'}">
|
||||
{$product.name|truncate:13:'...'|escape:html:'UTF-8'}</a>
|
||||
<span class="remove_link">{if !isset($customizedDatas.$productId.$productAttributeId) && ($product.total > 0)}<a rel="nofollow" class="ajax_cart_block_remove_link" href="{$link->getPageLink('cart', true, NULL, "delete&id_product={$product.id_product}&ipa={$product.id_product_attribute}&id_address_delivery={$product.id_address_delivery}&token={$static_token}", true)}" title="{l s='remove this product from my cart' mod='blockcart'}"> </a>{/if}</span>
|
||||
<span class="remove_link">{if !isset($customizedDatas.$productId.$productAttributeId) && (!isset($product.is_gift) || !$product.is_gift)}<a rel="nofollow" class="ajax_cart_block_remove_link" href="{$link->getPageLink('cart', true, NULL, "delete&id_product={$product.id_product}&ipa={$product.id_product_attribute}&id_address_delivery={$product.id_address_delivery}&token={$static_token}", true)}" title="{l s='remove this product from my cart' mod='blockcart'}"> </a>{/if}</span>
|
||||
<span class="price">
|
||||
{if $product.total > 0}
|
||||
{if !isset($product.is_gift) || !$product.is_gift}
|
||||
{if $priceDisplay == $smarty.const.PS_TAX_EXC}{displayWtPrice p="`$product.total`"}{else}{displayWtPrice p="`$product.total_wt`"}{/if}
|
||||
{else}
|
||||
<b>{l s='Free!' mod='blockcart'}</b>
|
||||
|
||||
@@ -78,9 +78,9 @@ var delete_txt = '{l s='Delete' mod='blockcart' js=1}';
|
||||
<span class="quantity-formated"><span class="quantity">{$product.cart_quantity}</span>x</span>
|
||||
<a class="cart_block_product_name" href="{$link->getProductLink($product, $product.link_rewrite, $product.category, null, null, $product.id_shop, $product.id_product_attribute)}" title="{$product.name|escape:html:'UTF-8'}">
|
||||
{$product.name|truncate:13:'...'|escape:html:'UTF-8'}</a>
|
||||
<span class="remove_link">{if !isset($customizedDatas.$productId.$productAttributeId) && ($product.total > 0)}<a rel="nofollow" class="ajax_cart_block_remove_link" href="{$link->getPageLink('cart', true, NULL, "delete&id_product={$product.id_product}&ipa={$product.id_product_attribute}&id_address_delivery={$product.id_address_delivery}&token={$static_token}", true)}" title="{l s='remove this product from my cart' mod='blockcart'}"> </a>{/if}</span>
|
||||
<span class="remove_link">{if !isset($customizedDatas.$productId.$productAttributeId) && (!isset($product.is_gift) || !$product.is_gift)}<a rel="nofollow" class="ajax_cart_block_remove_link" href="{$link->getPageLink('cart', true, NULL, "delete&id_product={$product.id_product}&ipa={$product.id_product_attribute}&id_address_delivery={$product.id_address_delivery}&token={$static_token}", true)}" title="{l s='remove this product from my cart' mod='blockcart'}"> </a>{/if}</span>
|
||||
<span class="price">
|
||||
{if $product.total > 0}
|
||||
{if !isset($product.is_gift) || !$product.is_gift}
|
||||
{if $priceDisplay == $smarty.const.PS_TAX_EXC}{displayWtPrice p="`$product.total`"}{else}{displayWtPrice p="`$product.total_wt`"}{/if}
|
||||
{else}
|
||||
<b>{l s='Free!' mod='blockcart'}</b>
|
||||
|
||||
Reference in New Issue
Block a user