[-] MO : #PSCFV-3057 - Block cart: If no products, block cart is never displayed
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@16245 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
//JS Object : update the cart by ajax actions
|
//JS Object : update the cart by ajax actions
|
||||||
var ajaxCart = {
|
var ajaxCart = {
|
||||||
|
nb_total_products: 0,
|
||||||
|
|
||||||
//override every button in the page in relation to the cart
|
//override every button in the page in relation to the cart
|
||||||
overrideButtonsInThePage : function(){
|
overrideButtonsInThePage : function(){
|
||||||
@@ -311,9 +312,10 @@ var ajaxCart = {
|
|||||||
$('#'+removedProductId).addClass('strike').fadeTo('slow', 0, function(){
|
$('#'+removedProductId).addClass('strike').fadeTo('slow', 0, function(){
|
||||||
$(this).slideUp('slow', function(){
|
$(this).slideUp('slow', function(){
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
//if the cart is now empty, show the 'no product in the cart' message
|
// If the cart is now empty, show the 'no product in the cart' message and close detail
|
||||||
if($('#cart_block dl.products dt').length == 0)
|
if($('#cart_block dl.products dt').length == 0)
|
||||||
{
|
{
|
||||||
|
$("#header #cart_block").stop(true, true).slideUp(200);
|
||||||
$('p#cart_block_no_products:hidden').slideDown(450);
|
$('p#cart_block_no_products:hidden').slideDown(450);
|
||||||
$('div#cart_block dl.products').remove();
|
$('div#cart_block dl.products').remove();
|
||||||
}
|
}
|
||||||
@@ -601,6 +603,9 @@ var ajaxCart = {
|
|||||||
$('.ajax_cart_tax_cost').text(jsonData.taxCost);
|
$('.ajax_cart_tax_cost').text(jsonData.taxCost);
|
||||||
$('.cart_block_wrapping_cost').text(jsonData.wrappingCost);
|
$('.cart_block_wrapping_cost').text(jsonData.wrappingCost);
|
||||||
$('.ajax_block_cart_total').text(jsonData.total);
|
$('.ajax_block_cart_total').text(jsonData.total);
|
||||||
|
|
||||||
|
this.nb_total_products = jsonData.nbTotalProducts;
|
||||||
|
|
||||||
if(parseInt(jsonData.nbTotalProducts) > 0)
|
if(parseInt(jsonData.nbTotalProducts) > 0)
|
||||||
{
|
{
|
||||||
$('.ajax_cart_no_product').hide();
|
$('.ajax_cart_no_product').hide();
|
||||||
@@ -674,7 +679,8 @@ $(document).ready(function(){
|
|||||||
$("#shopping_cart a:first").hover(
|
$("#shopping_cart a:first").hover(
|
||||||
function() {
|
function() {
|
||||||
$(this).css('border-radius', '3px 3px 0px 0px');
|
$(this).css('border-radius', '3px 3px 0px 0px');
|
||||||
$("#header #cart_block").stop(true, true).slideDown(450);
|
if (ajaxCart.nb_total_products > 0)
|
||||||
|
$("#header #cart_block").stop(true, true).slideDown(450);
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
$('#shopping_cart a').css('border-radius', '3px');
|
$('#shopping_cart a').css('border-radius', '3px');
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
"link": "{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category, null, null, $product.id_shop, $product.id_product_attribute)|addslashes|replace:'\\\'':'\''}",
|
"link": "{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category, null, null, $product.id_shop, $product.id_product_attribute)|addslashes|replace:'\\\'':'\''}",
|
||||||
"quantity": {$product.cart_quantity},
|
"quantity": {$product.cart_quantity},
|
||||||
"priceByLine": "{if $priceDisplay == $smarty.const.PS_TAX_EXC}{displayWtPrice|html_entity_decode:2:'UTF-8' p=$product.total}{else}{displayWtPrice|html_entity_decode:2:'UTF-8' p=$product.total_wt}{/if}",
|
"priceByLine": "{if $priceDisplay == $smarty.const.PS_TAX_EXC}{displayWtPrice|html_entity_decode:2:'UTF-8' p=$product.total}{else}{displayWtPrice|html_entity_decode:2:'UTF-8' p=$product.total_wt}{/if}",
|
||||||
"name": "{$product.name|html_entity_decode:2:'UTF-8'|escape|truncate:15:'...':true}",
|
"name": "{$product.name|html_entity_decode:2:'UTF-8'|escape:'htmlall'|truncate:15:'...':true}",
|
||||||
"price": "{if $priceDisplay == $smarty.const.PS_TAX_EXC}{displayWtPrice|html_entity_decode:2:'UTF-8' p=$product.total}{else}{displayWtPrice|html_entity_decode:2:'UTF-8' p=$product.total_wt}{/if}",
|
"price": "{if $priceDisplay == $smarty.const.PS_TAX_EXC}{displayWtPrice|html_entity_decode:2:'UTF-8' p=$product.total}{else}{displayWtPrice|html_entity_decode:2:'UTF-8' p=$product.total_wt}{/if}",
|
||||||
"price_float": "{$product.total}",
|
"price_float": "{$product.total}",
|
||||||
"idCombination": {if isset($product.attributes_small)}{$productAttributeId}{else}0{/if},
|
"idCombination": {if isset($product.attributes_small)}{$productAttributeId}{else}0{/if},
|
||||||
|
|||||||
Reference in New Issue
Block a user