[-] MO: Display real price instead of Free for product which are not gifts on blockcart #PSCFV-6423

This commit is contained in:
Rémi Gaillard
2013-02-05 18:25:40 +01:00
parent 604602a6b6
commit 73143db07f
5 changed files with 9 additions and 7 deletions

View File

@@ -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&amp;delete&amp;id_product=' + product['id'] + '&amp;ipa=' + product['idCombination'] + '&amp;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);

View File

@@ -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:'\\\'':'\''}",

View File

@@ -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_);

View File

@@ -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&amp;id_product={$product.id_product}&amp;ipa={$product.id_product_attribute}&amp;id_address_delivery={$product.id_address_delivery}&amp;token={$static_token}", true)}" title="{l s='remove this product from my cart' mod='blockcart'}">&nbsp;</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&amp;id_product={$product.id_product}&amp;ipa={$product.id_product_attribute}&amp;id_address_delivery={$product.id_address_delivery}&amp;token={$static_token}", true)}" title="{l s='remove this product from my cart' mod='blockcart'}">&nbsp;</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>

View File

@@ -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&amp;id_product={$product.id_product}&amp;ipa={$product.id_product_attribute}&amp;id_address_delivery={$product.id_address_delivery}&amp;token={$static_token}", true)}" title="{l s='remove this product from my cart' mod='blockcart'}">&nbsp;</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&amp;id_product={$product.id_product}&amp;ipa={$product.id_product_attribute}&amp;id_address_delivery={$product.id_address_delivery}&amp;token={$static_token}", true)}" title="{l s='remove this product from my cart' mod='blockcart'}">&nbsp;</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>