[-] FO : Fix bug #PSCFV-10478 could not see auto added cart rule voucher on product page

This commit is contained in:
gRoussac
2013-09-23 16:08:44 +02:00
parent dedc59f1db
commit 92382e347c
2 changed files with 26 additions and 34 deletions
+6 -8
View File
@@ -398,8 +398,7 @@ var ajaxCart = {
else
{
$('#vouchers tbody').html('');
for (i=0;i<jsonData.discounts.length;i++)
for (i=0; i < jsonData.discounts.length; i++)
{
if (parseFloat(jsonData.discounts[i].price_float) > 0)
{
@@ -408,15 +407,14 @@ var ajaxCart = {
delete_link = '<a class="delete_voucher" href="'+jsonData.discounts[i].link+'" title="'+delete_txt+'"><img src="'+img_dir+'icon/delete.gif" alt="'+delete_txt+'" class="icon" /></a>';
$('#vouchers tbody').append($(
'<tr class="bloc_cart_voucher" id="bloc_cart_voucher_'+jsonData.discounts[i].id+'">'
+' <td class="quantity">1x</td>'
+' <td class="name" title="'+jsonData.discounts[i].description+'">'+jsonData.discounts[i].name+'</td>'
+' <td class="price">-'+jsonData.discounts[i].price+'</td>'
+' <td class="delete">' + delete_link + '</td>'
+'</tr>'
+ '<td class="quantity">1x</td>'
+ '<td class="name" title="'+jsonData.discounts[i].description+'">'+jsonData.discounts[i].name+'</td>'
+ '<td class="price">-'+jsonData.discounts[i].price+'</td>'
+ '<td class="delete">' + delete_link + '</td>'
+ '</tr>'
));
}
}
$('#vouchers').show();
}
+20 -26
View File
@@ -22,17 +22,11 @@
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
{* IMPORTANT : If you change some data here, you have to report these changes in the ./blockcart-json.js (to let ajaxCart available) *}
{if $ajax_allowed}
<script type="text/javascript">
{if $ajax_allowed}
var CUSTOMIZE_TEXTFIELD = {$CUSTOMIZE_TEXTFIELD};
var img_dir = '{$img_dir|addslashes}';
</script>
{/if}
<script type="text/javascript">
var customizationIdMessage = '{l s='Customization #' mod='blockcart' js=1}';
var removingLinkText = '{l s='remove this product from my cart' mod='blockcart' js=1}';
var freeShippingTranslation = '{l s='Free shipping!' mod='blockcart' js=1}';
@@ -40,8 +34,6 @@ var freeProductTranslation = '{l s='Free!' mod='blockcart' js=1}';
var delete_txt = '{l s='Delete' mod='blockcart' js=1}';
var generated_date = {$smarty.now|intval};
</script>
<!-- MODULE Block cart -->
<div id="cart_block" class="block exclusive">
<p class="title_block">
@@ -92,7 +84,6 @@ var generated_date = {$smarty.now|intval};
<dd id="cart_block_combination_of_{$product.id_product}{if $product.id_product_attribute}_{$product.id_product_attribute}{/if}_{$product.id_address_delivery|intval}" class="{if $smarty.foreach.myLoop.first}first_item{elseif $smarty.foreach.myLoop.last}last_item{else}item{/if}">
<a href="{$link->getProductLink($product, $product.link_rewrite, $product.category, null, null, $product.id_shop, $product.id_product_attribute)|escape:'html'}" title="{l s='Product detail' mod='blockcart'}">{$product.attributes_small}</a>
{/if}
<!-- Customizable datas -->
{if isset($customizedDatas.$productId.$productAttributeId[$product.id_address_delivery])}
{if !isset($product.attributes_small)}<dd id="cart_block_combination_of_{$product.id_product}_{if $product.id_product_attribute}{$product.id_product_attribute}{else}0{/if}_{if $product.id_address_delivery}{$product.id_address_delivery}{else}0{/if}" class="{if $smarty.foreach.myLoop.first}first_item{elseif $smarty.foreach.myLoop.last}last_item{else}item{/if}">{/if}
@@ -110,31 +101,35 @@ var generated_date = {$smarty.now|intval};
</ul>
{if !isset($product.attributes_small)}</dd>{/if}
{/if}
{if isset($product.attributes_small)}</dd>{/if}
{/foreach}
</dl>
{/if}
<p class="cart_block_no_products{if $products} hidden{/if}" id="cart_block_no_products">{l s='No products' mod='blockcart'}</p>
{if $discounts|@count > 0}
<table id="vouchers"{if $discounts|@count == 0} style="display:none;"{/if}>
{foreach from=$discounts item=discount}
{if $discount.value_real > 0}
<tr class="bloc_cart_voucher" id="bloc_cart_voucher_{$discount.id_discount}">
<td class="quantity">1x</td>
<td class="name" title="{$discount.description}">{$discount.name|cat:' : '|cat:$discount.description|truncate:18:'...'|escape:'htmlall':'UTF-8'}</td>
<td class="price">-{if $priceDisplay == 1}{convertPrice price=$discount.value_tax_exc}{else}{convertPrice price=$discount.value_real}{/if}</td>
<td class="delete">
{if strlen($discount.code)}
<a class="delete_voucher" href="{$link->getPageLink('$order_process', true)}?deleteDiscount={$discount.id_discount}" title="{l s='Delete' mod='blockcart'}" rel="nofollow"><img src="{$img_dir}icon/delete.gif" alt="{l s='Delete' mod='blockcart'}" class="icon" /></a>
{/if}
</td>
</tr>
<tbody>
<tr class="bloc_cart_voucher" id="bloc_cart_voucher_{$discount.id_discount}">
<td class="quantity">1x</td>
<td class="name" title="{$discount.description}">{$discount.name|cat:' : '|cat:$discount.description|truncate:18:'...'|escape:'htmlall':'UTF-8'}</td>
<td class="price">-{if $priceDisplay == 1}{convertPrice price=$discount.value_tax_exc}{else}{convertPrice price=$discount.value_real}{/if}</td>
<td class="delete">
{if strlen($discount.code)}
<a class="delete_voucher" href="{$link->getPageLink('$order_process', true)}?deleteDiscount={$discount.id_discount}" title="{l s='Delete' mod='blockcart'}" rel="nofollow"><img src="{$img_dir}icon/delete.gif" alt="{l s='Delete' mod='blockcart'}" class="icon" /></a>
{/if}
</td>
</tr>
</tbody>
{/if}
{foreachelse}{* W3C and cart rule vouchers *}
<tbody>
<tr class="bloc_cart_voucher">
<td>&nbsp;</td>
</tr>
</tbody>
{/foreach}
</table>
{/if}
<p id="cart-prices">
<span id="cart_block_shipping_cost" class="price ajax_cart_shipping_cost">{$shipping_cost}</span>
<span>{l s='Shipping' mod='blockcart'}</span>
@@ -172,5 +167,4 @@ var generated_date = {$smarty.now|intval};
</div>
</div>
</div>
<!-- /MODULE Block cart -->
<!-- /MODULE Block cart -->