[-] FO : #PSFV-803 - Fix bugs with customization and cart summary
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@14788 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
+2
-2
@@ -1117,12 +1117,12 @@ class CartCore extends ObjectModel
|
|||||||
AND `id_product_attribute` = '.(int)$id_product_attribute.'
|
AND `id_product_attribute` = '.(int)$id_product_attribute.'
|
||||||
'.((int)$id_address_delivery ? 'AND `id_address_delivery` = '.(int)$id_address_delivery : ''));
|
'.((int)$id_address_delivery ? 'AND `id_address_delivery` = '.(int)$id_address_delivery : ''));
|
||||||
|
|
||||||
if (!$this->_deleteCustomization((int)$id_customization, (int)$id_product, (int)$id_product_attribute))
|
if (!$this->_deleteCustomization((int)$id_customization, (int)$id_product, (int)$id_product_attribute, $id_address_delivery))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// refresh cache of self::_products
|
// refresh cache of self::_products
|
||||||
$this->_products = $this->getProducts(true);
|
$this->_products = $this->getProducts(true);
|
||||||
return ($customization_quantity == $product_total_quantity && $this->deleteProduct((int)$id_product, $id_product_attribute, null));
|
return ($customization_quantity == $product_total_quantity && $this->deleteProduct((int)$id_product, $id_product_attribute, $id_address_delivery));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get customization quantity */
|
/* Get customization quantity */
|
||||||
|
|||||||
@@ -675,14 +675,22 @@ table#cart_summary td.price_discount_del {border-right:none}
|
|||||||
table#cart_summary .last_item td {border-bottom:1px solid #999}
|
table#cart_summary .last_item td {border-bottom:1px solid #999}
|
||||||
|
|
||||||
|
|
||||||
table#cart_summary tr:nth-child(odd),
|
table#cart_summary tr.cart_item.odd,
|
||||||
table#cart_summary tr.cart_total_delivery,
|
table#cart_summary tr.cart_total_delivery,
|
||||||
table#cart_summary tr.cart_total_price {
|
table#cart_summary tr.cart_total_price {
|
||||||
background-color: #fff
|
background-color: #fff
|
||||||
}
|
}
|
||||||
table#cart_summary tr:nth-child(even) {
|
table#cart_summary tr.cart_item.even {
|
||||||
background-color: #f3f3f3
|
background-color: #f3f3f3
|
||||||
}
|
}
|
||||||
|
|
||||||
|
table#cart_summary tr.customization.odd {
|
||||||
|
background-color: #fff
|
||||||
|
}
|
||||||
|
table#cart_summary tr.customization.even {
|
||||||
|
background-color: #f3f3f3
|
||||||
|
}
|
||||||
|
|
||||||
table#cart_summary tr ul {
|
table#cart_summary tr ul {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
}
|
}
|
||||||
@@ -696,6 +704,7 @@ table#cart_summary .cart_description {
|
|||||||
}
|
}
|
||||||
table#cart_summary .cart_unit {width:130px}
|
table#cart_summary .cart_unit {width:130px}
|
||||||
table#cart_summary .cart_quantity {width:130px}
|
table#cart_summary .cart_quantity {width:130px}
|
||||||
|
table#cart_summary .customization .cart_quantity {padding: 8px 12px 0;}
|
||||||
.cart_quantity .cart_quantity_input {
|
.cart_quantity .cart_quantity_input {
|
||||||
float:left;
|
float:left;
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
|
|||||||
@@ -295,19 +295,24 @@ function deleteProductFromSummary(id)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$('#product_'+ id).fadeOut('slow', function() {
|
$('#product_'+ id).fadeOut('slow', function() {
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
cleanSelectAddressDelivery();
|
cleanSelectAddressDelivery();
|
||||||
});
|
if (!customizationId)
|
||||||
|
refreshOddRow();
|
||||||
|
});
|
||||||
|
|
||||||
var exist = false;
|
var exist = false;
|
||||||
for (i=0;i<jsonData.summary.products.length;i++)
|
for (i=0;i<jsonData.summary.products.length;i++)
|
||||||
if (jsonData.summary.products[i].id_product == productId)
|
if (jsonData.summary.products[i].id_product == productId
|
||||||
|
&& jsonData.summary.products[i].id_product_attribute == productAttributeId
|
||||||
|
&& jsonData.summary.products[i].id_address_delivery == id_address_delivery)
|
||||||
exist = true;
|
exist = true;
|
||||||
|
|
||||||
// if all customization remove => delete product line
|
// if all customization removed => delete product line
|
||||||
if (!exist)
|
if (!exist && customizationId)
|
||||||
$('#product_'+ productId+'_'+productAttributeId).fadeOut('slow', function() {
|
$('#product_' + productId + '_' + productAttributeId + '_0_' + id_address_delivery).fadeOut('slow', function() {
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
|
refreshOddRow();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
updateCartSummary(jsonData.summary);
|
updateCartSummary(jsonData.summary);
|
||||||
@@ -322,6 +327,29 @@ function deleteProductFromSummary(id)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function refreshOddRow()
|
||||||
|
{
|
||||||
|
var odd_class = 'odd';
|
||||||
|
var even_class = 'even';
|
||||||
|
$.each($('.cart_item'), function(i, it)
|
||||||
|
{
|
||||||
|
if (i == 0) // First item
|
||||||
|
{
|
||||||
|
if ($(this).hasClass('even'))
|
||||||
|
{
|
||||||
|
odd_class = 'even';
|
||||||
|
even_class = 'odd';
|
||||||
|
}
|
||||||
|
$(this).addClass('first_item');
|
||||||
|
}
|
||||||
|
if(i % 2)
|
||||||
|
$(this).removeClass(odd_class).addClass(even_class);
|
||||||
|
else
|
||||||
|
$(this).removeClass(even_class).addClass(odd_class);
|
||||||
|
});
|
||||||
|
$('.cart_item:last-child, .customization:last-child').addClass('last_item');
|
||||||
|
}
|
||||||
|
|
||||||
function upQuantity(id, qty)
|
function upQuantity(id, qty)
|
||||||
{
|
{
|
||||||
if (typeof(qty) == 'undefined' || !qty)
|
if (typeof(qty) == 'undefined' || !qty)
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
* International Registered Trademark & Property of PrestaShop SA
|
* International Registered Trademark & Property of PrestaShop SA
|
||||||
*}
|
*}
|
||||||
|
|
||||||
<tr id="product_{$product.id_product}_{$product.id_product_attribute}_0_{$product.id_address_delivery|intval}" class="{if isset($productLast) && $productLast}last_item{elseif isset($productFirst) && $productFirst}first_item{/if} {if isset($customizedDatas.$productId.$productAttributeId) AND $quantityDisplayed == 0}alternate_item{/if} cart_item">
|
<tr id="product_{$product.id_product}_{$product.id_product_attribute}_0_{$product.id_address_delivery|intval}" class="{if isset($productLast) && $productLast && (!isset($ignoreProductLast) || !$ignoreProductLast)}last_item{elseif isset($productFirst) && $productFirst}first_item{/if} {if isset($customizedDatas.$productId.$productAttributeId) AND $quantityDisplayed == 0}alternate_item{/if} cart_item {if $odd}odd{else}even{/if}">
|
||||||
<td class="cart_product">
|
<td class="cart_product">
|
||||||
<a href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category)|escape:'htmlall':'UTF-8'}"><img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'small')}" alt="{$product.name|escape:'htmlall':'UTF-8'}" {if isset($smallSize)}width="{$smallSize.width}" height="{$smallSize.height}" {/if} /></a>
|
<a href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category)|escape:'htmlall':'UTF-8'}"><img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'small')}" alt="{$product.name|escape:'htmlall':'UTF-8'}" {if isset($smallSize)}width="{$smallSize.width}" height="{$smallSize.height}" {/if} /></a>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -222,13 +222,16 @@
|
|||||||
{assign var='productId' value=$product.id_product}
|
{assign var='productId' value=$product.id_product}
|
||||||
{assign var='productAttributeId' value=$product.id_product_attribute}
|
{assign var='productAttributeId' value=$product.id_product_attribute}
|
||||||
{assign var='quantityDisplayed' value=0}
|
{assign var='quantityDisplayed' value=0}
|
||||||
|
{assign var='odd' value=$product@iteration%2}
|
||||||
|
{assign var='ignoreProductLast' value=isset($customizedDatas.$productId.$productAttributeId)}
|
||||||
{* Display the product line *}
|
{* Display the product line *}
|
||||||
{include file="./shopping-cart-product-line.tpl" productLast=$product@last productFirst=$product@first}
|
{include file="./shopping-cart-product-line.tpl" productLast=$product@last productFirst=$product@first}
|
||||||
{* Then the customized datas ones*}
|
{* Then the customized datas ones*}
|
||||||
{if isset($customizedDatas.$productId.$productAttributeId)}
|
{if isset($customizedDatas.$productId.$productAttributeId)}
|
||||||
{foreach $customizedDatas.$productId.$productAttributeId[$product.id_address_delivery] as $id_customization=>$customization}
|
{foreach $customizedDatas.$productId.$productAttributeId[$product.id_address_delivery] as $id_customization=>$customization}
|
||||||
<tr id="product_{$product.id_product}_{$product.id_product_attribute}_{$id_customization}_{$product.id_address_delivery|intval}" class="alternate_item cart_item">
|
<tr id="product_{$product.id_product}_{$product.id_product_attribute}_{$id_customization}_{$product.id_address_delivery|intval}" class="product_customization_for_{$product.id_product}_{$product.id_product_attribute}_{$product.id_address_delivery|intval} {if $odd}odd{else}even{/if} customization alternate_item {if $product@last && $customization@last}last_item{/if}">
|
||||||
<td colspan="4">
|
<td></td>
|
||||||
|
<td colspan="3">
|
||||||
{foreach $customization.datas as $type=>$custom_data}
|
{foreach $customization.datas as $type=>$custom_data}
|
||||||
|
|
||||||
{if $type == $CUSTOMIZE_FILE}
|
{if $type == $CUSTOMIZE_FILE}
|
||||||
|
|||||||
Reference in New Issue
Block a user