Merge branch 'ticket-13564-giftOnShoppingCart' into develop
This commit is contained in:
commit
323e859e3f
@ -303,9 +303,11 @@ class CartController extends CartControllerCore
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($giftMessage){
|
if($giftMessage){
|
||||||
if(Tools::getValue('action') == 'remove_message'){
|
if(Tools::getValue('action') == 'remove_all'){
|
||||||
self::$cart->gift = 0;
|
self::$cart->gift = 0;
|
||||||
self::$cart->gift_message = '';
|
self::$cart->gift_message = '';
|
||||||
|
} elseif(Tools::getValue('action') == 'remove_message'){
|
||||||
|
self::$cart->gift_message = '';
|
||||||
} elseif(Tools::getValue('action') == 'add_message'){
|
} elseif(Tools::getValue('action') == 'add_message'){
|
||||||
self::$cart->gift = 1;
|
self::$cart->gift = 1;
|
||||||
self::$cart->gift_message = strip_tags(Tools::getValue('message'));
|
self::$cart->gift_message = strip_tags(Tools::getValue('message'));
|
||||||
|
@ -33,11 +33,9 @@ $(document).ready(function()
|
|||||||
$('.cart_quantity_down').unbind('click').click(function(){ downQuantity($(this).attr('id').replace('cart_quantity_down_', '')); return false; });
|
$('.cart_quantity_down').unbind('click').click(function(){ downQuantity($(this).attr('id').replace('cart_quantity_down_', '')); return false; });
|
||||||
$('.cart_quantity_delete' ).unbind('click').click(function(){ deletProductFromSummary($(this).attr('id')); return false; });
|
$('.cart_quantity_delete' ).unbind('click').click(function(){ deletProductFromSummary($(this).attr('id')); return false; });
|
||||||
$('.cart_quantity_input').typeWatch({ highlight: true, wait: 600, captureLength: 0, callback: updateQty });
|
$('.cart_quantity_input').typeWatch({ highlight: true, wait: 600, captureLength: 0, callback: updateQty });
|
||||||
$('#go_to_next_step').unbind('click').click(function(){giftMessage(true,true); });
|
|
||||||
|
|
||||||
// $('#cart_add_gift_message').unbind('click').click(function(){giftMessage(true); return false; });
|
$('#go_to_next_step').unbind('click').click(function(){giftMessage(true,true,false);});
|
||||||
// $('#cart_remove_gift_message').unbind('click').click(function(){giftMessage(false); return false; });
|
$('.remove_message_gift').unbind('click').click(function(){giftMessage(false,false,true); return false; });
|
||||||
$('.remove_message_gift').unbind('click').click(function(){giftMessage(false,false); return false; });
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -478,10 +476,21 @@ function updateCartSummary(json)
|
|||||||
ajaxCart.refresh();
|
ajaxCart.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
function giftMessage(add, next){
|
function giftMessage(add, next, all){
|
||||||
var action = "add_message";
|
var action = "add_message";
|
||||||
if(add == false || $('#gift_message').val()=='' || !$('input#gift').is(':checked')){
|
if(add == false ){
|
||||||
var action = "remove_message";
|
if(all == true || !$('input#gift').is(':checked')) {
|
||||||
|
action = "remove_all";
|
||||||
|
} else {
|
||||||
|
action = "remove_message";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(add == true){
|
||||||
|
if(!$('input#gift').is(':checked')){
|
||||||
|
action = "remove_all";
|
||||||
|
} else {
|
||||||
|
action = "add_message";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
@ -513,12 +522,19 @@ function giftMessage(add, next){
|
|||||||
message = escape($('#gift_message').val())
|
message = escape($('#gift_message').val())
|
||||||
$('#my_gift_message').html($('#gift_message').val().replace(/\n/g, "<br/>"));
|
$('#my_gift_message').html($('#gift_message').val().replace(/\n/g, "<br/>"));
|
||||||
$('#my_gift').show();
|
$('#my_gift').show();
|
||||||
} else {
|
if($('#gift_message').val()==''){
|
||||||
|
$('#my_gift').hide();
|
||||||
|
}
|
||||||
|
} else if (jsonData.action == "remove_all") {
|
||||||
$('#my_gift_message').html('');
|
$('#my_gift_message').html('');
|
||||||
$('#my_gift').hide();
|
$('#my_gift').hide();
|
||||||
$('#gift_message').val('');
|
$('#gift_message').val('');
|
||||||
$('#gift_div').hide();
|
$('#gift_div').hide();
|
||||||
$('#gift').removeAttr('checked');
|
$('#gift').removeAttr('checked');
|
||||||
|
} else if (jsonData.action == "remove_message") {
|
||||||
|
$('#my_gift_message').html('');
|
||||||
|
$('#my_gift').hide();
|
||||||
|
$('#gift_message').val('');
|
||||||
}
|
}
|
||||||
if(next==true){
|
if(next==true){
|
||||||
return true;
|
return true;
|
||||||
|
@ -317,7 +317,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{if $giftAllowed}
|
{if $giftAllowed}
|
||||||
<p id="my_gift" {if $cart->gift == 0} style="display:none;" {/if}>
|
<p id="my_gift" {if $cart->gift == 0 || $cart->gift_message == ''} style="display:none;" {/if}>
|
||||||
<span class="remove_message_gift">X</span>
|
<span class="remove_message_gift">X</span>
|
||||||
<span class="my_gift">{l s='My message : '}</span><br>
|
<span class="my_gift">{l s='My message : '}</span><br>
|
||||||
<span id="my_gift_message">{nl2br($cart->gift_message)|escape:'UTF-8'}<span>
|
<span id="my_gift_message">{nl2br($cart->gift_message)|escape:'UTF-8'}<span>
|
||||||
|
@ -34,7 +34,7 @@ $(document).ready(function()
|
|||||||
$('.cart_quantity_delete' ).unbind('click').click(function(){ deletProductFromSummary($(this).attr('id')); return false; });
|
$('.cart_quantity_delete' ).unbind('click').click(function(){ deletProductFromSummary($(this).attr('id')); return false; });
|
||||||
$('.cart_quantity_input').typeWatch({ highlight: true, wait: 600, captureLength: 0, callback: updateQty });
|
$('.cart_quantity_input').typeWatch({ highlight: true, wait: 600, captureLength: 0, callback: updateQty });
|
||||||
|
|
||||||
$('#go_to_next_step').unbind('click').click(function(){giftMessage(true,true); });
|
$('#go_to_next_step').unbind('click').click(function(){giftMessage(true,true,false); });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -464,10 +464,21 @@ function updateCartSummary(json)
|
|||||||
ajaxCart.refresh();
|
ajaxCart.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
function giftMessage(add, next){
|
function giftMessage(add, next, all){
|
||||||
var action = "add_message";
|
var action = "add_message";
|
||||||
if(add == false || $('#gift_message').val()=='' || !$('input#gift').is(':checked')){
|
if(add == false ){
|
||||||
var action = "remove_message";
|
if(all == true || !$('input#gift').is(':checked')) {
|
||||||
|
action = "remove_all";
|
||||||
|
} else {
|
||||||
|
action = "remove_message";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(add == true){
|
||||||
|
if(!$('input#gift').is(':checked')){
|
||||||
|
action = "remove_all";
|
||||||
|
} else {
|
||||||
|
action = "add_message";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
@ -497,6 +508,8 @@ function giftMessage(add, next){
|
|||||||
{
|
{
|
||||||
if(jsonData.action == "remove_message") {
|
if(jsonData.action == "remove_message") {
|
||||||
$('#gift_message').val('');
|
$('#gift_message').val('');
|
||||||
|
}else if(jsonData.action == "remove_all"){
|
||||||
|
$('#gift_message').val('');
|
||||||
$('#gift_div').hide();
|
$('#gift_div').hide();
|
||||||
$('#gift').removeAttr('checked');
|
$('#gift').removeAttr('checked');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user