Merge branch 'ticket-12574-RemoveProductFromBlockcart' into develop

This commit is contained in:
Marion Muszynski 2017-03-01 17:24:04 +01:00
commit 0da43afb39
5 changed files with 81 additions and 18 deletions

View File

@ -395,8 +395,8 @@ class AdminAntConfigurations extends AdminTab
<br>
<form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&tab-pan=discounts" method="post" enctype="multipart/form-data">
<div class="col-md-6 col-md-offset-3">
<p class="text-center">'.$this->l('Export des codes promos générés et de leur utilisations.').'</p>
<p class="text-center">'.$this->l('Préférer de courtes périodes (se base sur la date de génération du bon).').'</p>';
<p class="text-center">'.$this->l('Export des codes promos générés et de leur utilisations.').'
<br>'.$this->l('Préférer de courtes périodes (se base sur la date de génération du bon).').'</p>';
$input = array(
'type' => 'simpleDate',
'period' => true,
@ -428,7 +428,8 @@ class AdminAntConfigurations extends AdminTab
<br>
<form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&tab-pan=loyalties" method="post" enctype="multipart/form-data">
<div class="col-md-6 col-md-offset-3">
<p class="text-center">'.$this->l('Choisir de préférence un plage d\'1 mois').'</p>';
<p class="text-center">'.$this->l('Choisir de préférence des plages d\'1 mois').'
<br>'.$this->l('(Les dates renseignées sont comprises dans la période demandée)').'</p>';
$input = array(
'type' => 'simpleDate',
'period' => true,

View File

@ -388,18 +388,21 @@ var ajaxCart = {
// Update product quantity
updateProductQuantity : function (product, quantity) {
$('dt#cart_block_product_' + product.id + (product.idCombination ? '_' + product.idCombination : '') + ' .quantity').fadeTo('fast', 0, function() {
$(this).text(quantity);
$(this).fadeTo('fast', 1, function(){
$(this).fadeTo('fast', 0, function(){
$(this).fadeTo('fast', 1, function(){
$(this).fadeTo('fast', 0, function(){
$(this).fadeTo('fast', 1);
var old_quantity = parseInt($('dt#cart_block_product_' + product.id + (product.idCombination ? '_' + product.idCombination : '') + ' .quantity').text());
if(old_quantity != quantity) {
$('dt#cart_block_product_' + product.id + (product.idCombination ? '_' + product.idCombination : '') + ' .quantity').fadeTo('fast', 0, function() {
$(this).text(quantity);
$(this).fadeTo('fast', 1, function(){
$(this).fadeTo('fast', 0, function(){
$(this).fadeTo('fast', 1, function(){
$(this).fadeTo('fast', 0, function(){
$(this).fadeTo('fast', 1);
});
});
});
});
});
});
}
},
@ -426,7 +429,11 @@ var ajaxCart = {
var content = '<dt class="hidden" id="cart_block_product_' + domIdProduct + '">';
content += '<a class="img_cart" href="' + this.link + '" title="' + this.name + '"><img src="' + this.id_image + '" alt="' + this.name +'"></a>';
content += '<a class="cart_block_product_name" href="' + this.link + '" title="' + this.name + '">' + name + '</a>';
content += '<p class="label_quantity">Quantité : <span class="quantity">' + this.quantity + '</span></p>';
content += '<p class="label_quantity">Quantité : ';
content += '<span class="quantity">' + this.quantity + '</span>';
content += ' <a rel="nofollow" class="cart_quantity_down" id="cart_quantity_down_'+productId+'_'+productAttributeId+'" onclick="updateQuantity('+productId+','+productAttributeId+',\'down\');"><img src="'+baseDir+'themes/site/img/icon/quantity_down.gif" alt="-" width="14" height="9" /></a>';
content += ' <a rel="nofollow" class="cart_quantity_up" id="cart_quantity_up_'+productId+'_'+productAttributeId+'" onclick="updateQuantity('+productId+','+productAttributeId+',\'up\');"><img src="'+baseDir+'themes/site/img/icon/quantity_up.gif" alt="-" width="14" height="9" /></a>';
content += '</p>';
content += '<span class="remove_link"><a rel="nofollow" class="ajax_cart_block_remove_link" href="' + baseDir + 'cart.php?delete&amp;id_product=' + productId + '&amp;token=' + static_token + (this.hasAttributes ? '&amp;ipa=' + parseInt(this.idCombination) : '') + '"> </a></span>';
content += '<p><span class="label_price">Prix unitaire : <span class="green price">' + this.unit_price + '</span></p>';
content += '</dt>';
@ -713,6 +720,21 @@ function removeAllCart() {
});
}
function updateQuantity(id_product,id_product_attribute,op) {
$.ajax({
type: 'POST',
url: baseDir + 'cart.php',
async: true,
cache: false,
dataType : "json",
data: 'add=1&op='+op+'&id_product='+id_product+'&ipa='+id_product_attribute+'&qty=1&token=' + static_token + '&ajax=true',
success: function(jsonData) {
ajaxCart.updateCart(jsonData);
},
error: function() {alert('ERROR: unable to remove your cart');}
});
}
//when document is loaded...
$(document).ready(function(){

View File

@ -7287,3 +7287,28 @@ table#carrierTable tbody td {
border-bottom: 15px solid transparent;
border-right: 15px solid #fff;
}
#cart_block_list .products dt{
position: relative;
}
#cart_block_list .remove_link{
display: block;
position: absolute;
height: 13px;
width: 13px;
top:10px;
right:5px;
cursor: pointer;
background: url("../img/icon/delete.gif") no-repeat center center #fff;
}
#cart_block_list .remove_link a{
display: block;
width: 100%;
height: 100%;
}
#cart_block_list .cart_quantity_dow,
#cart_block_list .cart_quantity_dup{
text-decoration: none;
}

View File

@ -75,16 +75,31 @@ $(document).ready(function() {
<div id="cart_block_list" class="{if isset($colapseExpandStatus) && $colapseExpandStatus eq 'expanded' || !$ajax_allowed || !isset($colapseExpandStatus)}expanded{else}collapsed{/if}">
{if $products}
<dl class="products">
{foreach from=$products item='product' name='myLoop'}
{foreach from=$products item='product' name='myLoop'}
{assign var='productId' value=$product.id_product}
{assign var='productAttributeId' value=$product.id_product_attribute}
<dt id="cart_block_product_{$product.id_product}{if $product.id_product_attribute}_{$product.id_product_attribute}{/if}" class="{if $smarty.foreach.myLoop.first}first_item{elseif $smarty.foreach.myLoop.last}last_item{else}item{/if}">
<dt id="cart_block_product_{$product.id_product}{if $product.id_product_attribute}_{$product.id_product_attribute}{/if}" class="{if $smarty.foreach.myLoop.first}first_item{elseif $smarty.foreach.myLoop.last}last_item{else}item{/if}">
<a class="img_cart" href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category)}"><img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'mini_carre')}" alt="" align="left" title="{$product.name|escape:htmlall:'UTF-8'|truncate:20}" /></a>
<a class="cart_block_product_name" href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category)}" title="{$product.name|escape:html:'UTF-8'}">
{$product.name|truncate:40:'...'|escape:html:'UTF-8'}</a>
<p class="label_quantity">{l s='Quantité :' mod='blockcartex'} <span class="quantity">{$product.cart_quantity}</span></p>
<p class="label_quantity">{l s='Quantité :' mod='blockcartex'} <span class="quantity">{$product.cart_quantity}</span>
{if isset($page_name) && $page_name != 'order'}
{if $product.minimal_quantity < ($customization.quantity - $quantityDisplayed) OR $product.minimal_quantity <= 1}
<a rel="nofollow" class="cart_quantity_down" id="cart_quantity_down_{$product.id_product}_{$product.id_product_attribute}" onclick="updateQuantity({$product.id_product|intval},{$product.id_product_attribute|intval},'down');" title="{l s='Subtract' mod='blockcartex'}">
<img src="{$img_dir}icon/quantity_down.gif" alt="{l s='Subtract'}" width="14" height="9" />
</a>
{else}
<a class="cart_quantity_down" style="opacity: 0.3;" id="cart_quantity_down_{$product.id_product}_{$product.id_product_attribute}" href="#" title="{l s='Subtract' mod='blockcartex'}">
<img src="{$img_dir}icon/quantity_down.gif" alt="{l s='Subtract'}" width="14" height="9" />
</a>
{/if}
<a rel="nofollow" class="cart_quantity_up" id="cart_quantity_up_{$product.id_product}_{$product.id_product_attribute}" onclick="updateQuantity({$product.id_product|intval},{$product.id_product_attribute|intval},'up');" title="{l s='Add' mod='blockcartex'}"><img src="{$img_dir}icon/quantity_up.gif" alt="{l s='Add'}" width="14" height="9" /></a><br />
{/if}
</p>
<span class="remove_link">{if !isset($customizedDatas.$productId.$productAttributeId)}<a rel="nofollow" class="ajax_cart_block_remove_link" href="{$link->getPageLink('cart.php')}?delete&amp;id_product={$product.id_product}&amp;ipa={$product.id_product_attribute}&amp;token={$static_token}" title="{l s='remove this product from my cart' mod='blockcartex'}">&nbsp;</a>{/if}</span>
<p><span class="label_price">{l s='Prix unitaire :' mod='blockcartex'}</span> <span class="green price">{if $priceDisplay == $smarty.const.PS_TAX_EXC}{displayWtPrice p="`$product.total`"}{else}{displayWtPrice p="`$product.price_wt`"}{/if}</span>
</p>
@ -94,7 +109,7 @@ $(document).ready(function() {
<a href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category)}" title="{l s='Product detail'}">{$product.attributes_small}</a>
{/if}
<!-- Customizable datas
<!-- Customizable datas
{if isset($customizedDatas.$productId.$productAttributeId)}
{if !isset($product.attributes_small)}<dd id="cart_block_combination_of_{$product.id_product}{if $product.id_product_attribute}_{$product.id_product_attribute}{/if}" class="{if $smarty.foreach.myLoop.first}first_item{elseif $smarty.foreach.myLoop.last}last_item{else}item{/if}">{/if}
<ul class="cart_block_customizations" id="customization_{$productId}_{$productAttributeId}">

View File

@ -6,7 +6,7 @@
<h5>{l s='Title 1' mod='blocktext2'}</h5>
<p>{l s='Text 1' mod='blocktext2'}</p>
<h5>{l s='Title 2' mod='blocktext2'}</h5>
<p>{l s='Text 2' mod='blocktext2'}</p>
<p>{l s='Text 2' mod='blocktext2'}<br>{l s='Text 2 bis' mod='blocktext2'}</p>
</div>
</div>
</div>