// Fixing some problem with new theme and multishipping
This commit is contained in:
@@ -613,6 +613,8 @@ ul.idTabs li {
|
|||||||
/* step 1 - cart ******************************************************************************* */
|
/* step 1 - cart ******************************************************************************* */
|
||||||
.cart_last_product {display:none}
|
.cart_last_product {display:none}
|
||||||
|
|
||||||
|
p.cart_navigation .multishipping-button { margin-right: 10px }
|
||||||
|
|
||||||
#order-detail-content {margin-bottom:20px}
|
#order-detail-content {margin-bottom:20px}
|
||||||
|
|
||||||
table#cart_summary th {
|
table#cart_summary th {
|
||||||
@@ -850,6 +852,54 @@ table#cart_summary .cart_total_price td.cart_voucher {
|
|||||||
border:1px solid #ccc
|
border:1px solid #ccc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* step 3 - address ************************************************************************** */
|
||||||
|
|
||||||
|
.address-form-multishipping { padding: 10px 0px; }
|
||||||
|
#multishipping_mode_box {
|
||||||
|
border: 1px solid #D0D3D8;
|
||||||
|
background: url("../img/form_bg.jpg") repeat-x scroll left top #D0D1D5;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
#multishipping_mode_checkbox {
|
||||||
|
vertical-align: middle;
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
#multishipping_mode_box.on {
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
}
|
||||||
|
#multishipping_mode_box .title {
|
||||||
|
padding: 5px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
#multishipping_mode_box .description, #multishipping_mode_box .description_off {
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
#multishipping_mode_box .description_off {
|
||||||
|
display: none;
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
#multishipping_mode_box .description_off div {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
#multishipping_mode_box .description_off a, #multishipping_mode_box .description a {
|
||||||
|
display: block;
|
||||||
|
text-align: center;
|
||||||
|
text-decoration: none;
|
||||||
|
padding: 5px 10px;
|
||||||
|
margin: 0 160px;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
background: #ddd;
|
||||||
|
}
|
||||||
|
#multishipping_mode_box .description_off a:hover, #multishipping_mode_box .description a:hover {
|
||||||
|
background: #f3f3f3;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
}
|
||||||
|
#multishipping_mode_box.on .description_off {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* step 4 - paiement ************************************************************************** */
|
/* step 4 - paiement ************************************************************************** */
|
||||||
.order_carrier_content {
|
.order_carrier_content {
|
||||||
padding:15px;
|
padding:15px;
|
||||||
|
|||||||
+391
-134
@@ -19,19 +19,197 @@
|
|||||||
*
|
*
|
||||||
* @author PrestaShop SA <contact@prestashop.com>
|
* @author PrestaShop SA <contact@prestashop.com>
|
||||||
* @copyright 2007-2011 PrestaShop SA
|
* @copyright 2007-2011 PrestaShop SA
|
||||||
* @version Release: $Revision: 6594 $
|
* @version Release: $Revision: 7040 $
|
||||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||||
* International Registered Trademark & Property of PrestaShop SA
|
* International Registered Trademark & Property of PrestaShop SA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$(document).ready(function()
|
$(document).ready(function()
|
||||||
{
|
{
|
||||||
$('.cart_quantity_up').unbind('click').click(function(){ upQuantity($(this).attr('id').replace('cart_quantity_up_', '')); return false; });
|
// If block cart isn't used, we don't bind the handle actions
|
||||||
$('.cart_quantity_down').unbind('click').click(function(){ downQuantity($(this).attr('id').replace('cart_quantity_down_', '')); return false; });
|
if (window.ajaxCart !== undefined)
|
||||||
$('.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_up').unbind('click').live('click', function(){ upQuantity($(this).attr('id').replace('cart_quantity_up_', '')); return false; });
|
||||||
|
$('.cart_quantity_down').unbind('click').live('click', function(){ downQuantity($(this).attr('id').replace('cart_quantity_down_', '')); return false; });
|
||||||
|
$('.cart_quantity_delete' ).unbind('click').live('click', function(){ deleteProductFromSummary($(this).attr('id')); return false; });
|
||||||
|
$('.cart_quantity_input').typeWatch({ highlight: true, wait: 600, captureLength: 0, callback: updateQty });
|
||||||
|
|
||||||
|
$('.cart_address_delivery').live('change', function(){ changeAddressDelivery($(this)); });
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$('.cart_address_delivery').change(function(){ submit(); });
|
||||||
|
}
|
||||||
|
cleanSelectAddressDelivery();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function cleanSelectAddressDelivery()
|
||||||
|
{
|
||||||
|
if (window.ajaxCart !== undefined)
|
||||||
|
{
|
||||||
|
//Removing "Ship to an other address" from the address delivery select option if there is not enought address
|
||||||
|
$.each($('.cart_address_delivery'), function(it, item)
|
||||||
|
{
|
||||||
|
var options = $(item).find('option');
|
||||||
|
var address_count = 0;
|
||||||
|
|
||||||
|
var ids = $(item).attr('id').split('_');
|
||||||
|
var id_product = ids[3];
|
||||||
|
var id_product_attribute = ids[4];
|
||||||
|
var id_address_delivery = ids[5];
|
||||||
|
|
||||||
|
$.each(options, function(i) {
|
||||||
|
if ($(options[i]).val() > 0
|
||||||
|
&& ($('#product_' + id_product + '_' + id_product_attribute + '_0_' + $(options[i]).val()).length == 0 // Check the address is not already used for a similare products
|
||||||
|
|| id_address_delivery == $(options[i]).val()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
address_count++;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (address_count < 2) // Need at least two address to allow skipping products to multiple address
|
||||||
|
$($(item).find('option[value=-2]')).remove();
|
||||||
|
else if($($(item).find('option[value=-2]')).length == 0)
|
||||||
|
$(item).append($('<option value="-2">Ship to an other address</option>')); // @todo add translation
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function changeAddressDelivery(obj)
|
||||||
|
{
|
||||||
|
var ids = obj.attr('id').split('_');
|
||||||
|
var id_product = ids[3];
|
||||||
|
var id_product_attribute = ids[4];
|
||||||
|
var old_id_address_delivery = ids[5];
|
||||||
|
var new_id_address_delivery = obj.val();
|
||||||
|
|
||||||
|
if (new_id_address_delivery == old_id_address_delivery)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (new_id_address_delivery > 0) // Change the delivery address
|
||||||
|
{
|
||||||
|
$.ajax({
|
||||||
|
type: 'GET',
|
||||||
|
url: baseDir,
|
||||||
|
async: true,
|
||||||
|
cache: false,
|
||||||
|
dataType: 'json',
|
||||||
|
data: 'controller=cart&ajax=true&changeAddressDelivery&summary&id_product='+id_product
|
||||||
|
+'&id_product_attribute='+id_product_attribute
|
||||||
|
+'&old_id_address_delivery='+old_id_address_delivery
|
||||||
|
+'&new_id_address_delivery='+new_id_address_delivery
|
||||||
|
+'&token='+static_token,
|
||||||
|
success: function(jsonData)
|
||||||
|
{
|
||||||
|
// The product exist
|
||||||
|
if ($('#product_'+id_product+'_'+id_product_attribute+'_0_'+new_id_address_delivery).length)
|
||||||
|
{
|
||||||
|
updateCustomizedDatas(jsonData.customizedDatas);
|
||||||
|
updateCartSummary(jsonData.summary);
|
||||||
|
updateHookShoppingCart(jsonData.HOOK_SHOPPING_CART);
|
||||||
|
updateHookShoppingCartExtra(jsonData.HOOK_SHOPPING_CART_EXTRA);
|
||||||
|
if (jsonData.carriers != null)
|
||||||
|
if (typeof(getCarrierListAndUpdate) != 'undefined')
|
||||||
|
getCarrierListAndUpdate();
|
||||||
|
|
||||||
|
// @todo reverse the remove order
|
||||||
|
// This effect remove the current line, but it's better to remove the other one, and refresshing this one
|
||||||
|
$('#product_'+id_product+'_'+id_product_attribute+'_0_'+old_id_address_delivery).remove();
|
||||||
|
|
||||||
|
// @todo improve customization upgrading
|
||||||
|
$('.product_'+id_product+'_'+id_product_attribute+'_0_'+old_id_address_delivery).remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (window.ajaxCart !== undefined)
|
||||||
|
ajaxCart.refresh();
|
||||||
|
updateAddressId(id_product, id_product_attribute, old_id_address_delivery, new_id_address_delivery);
|
||||||
|
cleanSelectAddressDelivery();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (new_id_address_delivery == -1) // Adding a new address
|
||||||
|
window.location = $($('.address_add a')[0]).attr('href');
|
||||||
|
else if (new_id_address_delivery == -2) // Add a new line for this product
|
||||||
|
{
|
||||||
|
// This test is will not usefull in the future
|
||||||
|
if (old_id_address_delivery == 0)
|
||||||
|
{
|
||||||
|
alert('Please select first an address'); // @todo translate
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get new address to deliver
|
||||||
|
var id_address_delivery = 0;
|
||||||
|
var options = $('#select_address_delivery_'+id_product+'_'+id_product_attribute+'_'+old_id_address_delivery+' option');
|
||||||
|
$.each(options, function(i) {
|
||||||
|
if ($(options[i]).val() > 0 && $(options[i]).val() != old_id_address_delivery
|
||||||
|
&& $('#product_' + id_product + '_' + id_product_attribute + '_0_' + $(options[i]).val()).length == 0 // Check the address is not already used for a similare products
|
||||||
|
)
|
||||||
|
{
|
||||||
|
id_address_delivery = $(options[i]).val();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: 'GET',
|
||||||
|
url: baseDir,
|
||||||
|
async: true,
|
||||||
|
cache: false,
|
||||||
|
dataType: 'json',
|
||||||
|
context: obj,
|
||||||
|
data: 'controller=cart&ajax=true&duplicate&summary&id_product='+id_product+'&id_product_attribute='+id_product_attribute+'&id_address_delivery='+old_id_address_delivery+'&new_id_address_delivery='+id_address_delivery+'&token='+static_token ,
|
||||||
|
success: function(jsonData)
|
||||||
|
{
|
||||||
|
if (jsonData.error)
|
||||||
|
{
|
||||||
|
alert(jsonData.reason);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var line = $('#product_' + id_product+'_' + id_product_attribute + '_0_' + old_id_address_delivery);
|
||||||
|
var new_line = line.clone();
|
||||||
|
updateAddressId(id_product, id_product_attribute, old_id_address_delivery, id_address_delivery, new_line);
|
||||||
|
line.after(new_line);
|
||||||
|
new_line.find('input[name=quantity_' + id_product+'_' + id_product_attribute + '_0_' + old_id_address_delivery + '_hidden]')
|
||||||
|
.val(1);
|
||||||
|
new_line.find('.cart_quantity_input')
|
||||||
|
.val(1);
|
||||||
|
$('#select_address_delivery_' + id_product+'_' + id_product_attribute + '_' + old_id_address_delivery).val(old_id_address_delivery);
|
||||||
|
$('#select_address_delivery_' + id_product+'_' + id_product_attribute + '_' + id_address_delivery).val(id_address_delivery);
|
||||||
|
|
||||||
|
|
||||||
|
cleanSelectAddressDelivery();
|
||||||
|
|
||||||
|
updateCartSummary(jsonData.summary);
|
||||||
|
|
||||||
|
if (window.ajaxCart !== undefined)
|
||||||
|
ajaxCart.refresh();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateAddressId(id_product, id_product_attribute, old_id_address_delivery, id_address_delivery, line)
|
||||||
|
{
|
||||||
|
if (typeof(line) == 'undefined')
|
||||||
|
var line = $('#product_' + id_product+'_' + id_product_attribute + '_0_' + old_id_address_delivery);
|
||||||
|
|
||||||
|
line.attr('id', 'product_' + id_product+'_' + id_product_attribute + '_0_' + id_address_delivery);
|
||||||
|
line.find('.cart_quantity_input')
|
||||||
|
.attr('name', 'quantity_' + id_product+'_' + id_product_attribute + '_0_' + id_address_delivery);
|
||||||
|
line.find('input[name=quantity_' + id_product+'_' + id_product_attribute + '_0_' + old_id_address_delivery + '_hidden]')
|
||||||
|
.attr('name', 'quantity_' + id_product+'_' + id_product_attribute + '_0_' + id_address_delivery + '_hidden');
|
||||||
|
line.find('#cart_quantity_down_' + id_product+'_' + id_product_attribute + '_0_' + old_id_address_delivery)
|
||||||
|
.attr('id', 'cart_quantity_down_' + id_product+'_' + id_product_attribute + '_0_' + id_address_delivery);
|
||||||
|
line.find('#cart_quantity_up_' + id_product+'_' + id_product_attribute + '_0_' + old_id_address_delivery)
|
||||||
|
.attr('id', 'cart_quantity_up_' + id_product+'_' + id_product_attribute + '_0_' + id_address_delivery);
|
||||||
|
line.find('#' + id_product+'_' + id_product_attribute + '_0_' + old_id_address_delivery)
|
||||||
|
.attr('id', id_product+'_' + id_product_attribute + '_0_' + id_address_delivery);
|
||||||
|
line.find('#select_address_delivery_' + id_product+'_' + id_product_attribute + '_' + old_id_address_delivery)
|
||||||
|
.attr('id', 'select_address_delivery_' + id_product+'_' + id_product_attribute + '_' + id_address_delivery);
|
||||||
|
}
|
||||||
|
|
||||||
function updateQty(val)
|
function updateQty(val)
|
||||||
{
|
{
|
||||||
var id = $(this.el).attr('name');
|
var id = $(this.el).attr('name');
|
||||||
@@ -44,19 +222,20 @@ function updateQty(val)
|
|||||||
var QtyToUp = parseInt(input) - parseInt(hidden);
|
var QtyToUp = parseInt(input) - parseInt(hidden);
|
||||||
|
|
||||||
if (parseInt(QtyToUp) > 0)
|
if (parseInt(QtyToUp) > 0)
|
||||||
upQuantity(id.replace('quantity_', ''),QtyToUp);
|
upQuantity(id.replace('quantity_', ''), QtyToUp);
|
||||||
else if(parseInt(QtyToUp) < 0)
|
else if(parseInt(QtyToUp) < 0)
|
||||||
downQuantity(id.replace('quantity_', ''),QtyToUp);
|
downQuantity(id.replace('quantity_', ''), QtyToUp);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$('input[name='+ id +']').val($('input[name='+ id +'_hidden]').val());
|
$('input[name='+ id +']').val($('input[name='+ id +'_hidden]').val());
|
||||||
}
|
}
|
||||||
|
|
||||||
function deletProductFromSummary(id)
|
function deleteProductFromSummary(id)
|
||||||
{
|
{
|
||||||
var customizationId = 0;
|
var customizationId = 0;
|
||||||
var productId = 0;
|
var productId = 0;
|
||||||
var productAttributeId = 0;
|
var productAttributeId = 0;
|
||||||
|
var id_address_delivery = 0;
|
||||||
var ids = 0;
|
var ids = 0;
|
||||||
ids = id.split('_');
|
ids = id.split('_');
|
||||||
productId = parseInt(ids[0]);
|
productId = parseInt(ids[0]);
|
||||||
@@ -64,34 +243,36 @@ function deletProductFromSummary(id)
|
|||||||
productAttributeId = parseInt(ids[1]);
|
productAttributeId = parseInt(ids[1]);
|
||||||
if (typeof(ids[2]) != 'undefined')
|
if (typeof(ids[2]) != 'undefined')
|
||||||
customizationId = parseInt(ids[2]);
|
customizationId = parseInt(ids[2]);
|
||||||
|
if (typeof(ids[3]) != 'undefined')
|
||||||
|
id_address_delivery = parseInt(ids[3]);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: baseDir + 'cart.php',
|
url: baseDir,
|
||||||
async: true,
|
async: true,
|
||||||
cache: false,
|
cache: false,
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
data: 'ajax=true&delete&summary&id_product='+productId+'&ipa='+productAttributeId+ ( (customizationId != 0) ? '&id_customization='+customizationId : '') + '&token=' + static_token ,
|
data: 'controller=cart&ajax=true&delete&summary&id_product='+productId+'&ipa='+productAttributeId+'&id_address_delivery='+id_address_delivery+ ( (customizationId != 0) ? '&id_customization='+customizationId : '') + '&token=' + static_token ,
|
||||||
success: function(jsonData)
|
success: function(jsonData)
|
||||||
{
|
{
|
||||||
if (jsonData.hasError)
|
if (jsonData.hasError)
|
||||||
{
|
{
|
||||||
var errors = '';
|
var errors = '';
|
||||||
for(error in jsonData.errors)
|
for(error in jsonData.errors)
|
||||||
//IE6 bug fix
|
//IE6 bug fix
|
||||||
if(error != 'indexOf')
|
if(error != 'indexOf')
|
||||||
errors += jsonData.errors[error] + "\n";
|
errors += jsonData.errors[error] + "\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (parseInt(jsonData.summary.products.length) == 0)
|
if (parseInt(jsonData.summary.products.length) == 0)
|
||||||
{
|
{
|
||||||
$('#center_column').children().each(function() {
|
$('#center_column').children().each(function() {
|
||||||
if ($(this).attr('id') != 'emptyCartWarning' && $(this).attr('class') != 'breadcrumb' && $(this).attr('id') != 'cart_title')
|
if ($(this).attr('id') != 'emptyCartWarning' && $(this).attr('class') != 'breadcrumb' && $(this).attr('id') != 'cart_title')
|
||||||
{
|
{
|
||||||
$(this).fadeOut('slow', function () {
|
$(this).fadeOut('slow', function () {
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('#summary_products_label').remove();
|
$('#summary_products_label').remove();
|
||||||
$('#emptyCartWarning').fadeIn('slow');
|
$('#emptyCartWarning').fadeIn('slow');
|
||||||
@@ -100,6 +281,7 @@ function deletProductFromSummary(id)
|
|||||||
{
|
{
|
||||||
$('#product_'+ id).fadeOut('slow', function() {
|
$('#product_'+ id).fadeOut('slow', function() {
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
|
cleanSelectAddressDelivery();
|
||||||
});
|
});
|
||||||
|
|
||||||
var exist = false;
|
var exist = false;
|
||||||
@@ -118,12 +300,12 @@ function deletProductFromSummary(id)
|
|||||||
updateHookShoppingCartExtra(jsonData.HOOK_SHOPPING_CART_EXTRA);
|
updateHookShoppingCartExtra(jsonData.HOOK_SHOPPING_CART_EXTRA);
|
||||||
updateCustomizedDatas(jsonData.customizedDatas);
|
updateCustomizedDatas(jsonData.customizedDatas);
|
||||||
if (jsonData.carriers != null)
|
if (jsonData.carriers != null)
|
||||||
updateCarrierList(jsonData);
|
if (typeof(getCarrierListAndUpdate) != 'undefined')
|
||||||
|
getCarrierListAndUpdate();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to save update quantity \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
|
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to save update quantity \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function upQuantity(id, qty)
|
function upQuantity(id, qty)
|
||||||
@@ -133,6 +315,7 @@ function upQuantity(id, qty)
|
|||||||
var customizationId = 0;
|
var customizationId = 0;
|
||||||
var productId = 0;
|
var productId = 0;
|
||||||
var productAttributeId = 0;
|
var productAttributeId = 0;
|
||||||
|
var id_address_delivery = 0;
|
||||||
var ids = 0;
|
var ids = 0;
|
||||||
ids = id.split('_');
|
ids = id.split('_');
|
||||||
productId = parseInt(ids[0]);
|
productId = parseInt(ids[0]);
|
||||||
@@ -140,37 +323,40 @@ function upQuantity(id, qty)
|
|||||||
productAttributeId = parseInt(ids[1]);
|
productAttributeId = parseInt(ids[1]);
|
||||||
if (typeof(ids[2]) != 'undefined')
|
if (typeof(ids[2]) != 'undefined')
|
||||||
customizationId = parseInt(ids[2]);
|
customizationId = parseInt(ids[2]);
|
||||||
|
if (typeof(ids[3]) != 'undefined')
|
||||||
|
id_address_delivery = parseInt(ids[3]);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: baseDir + 'cart.php',
|
url: baseDir,
|
||||||
async: true,
|
async: true,
|
||||||
cache: false,
|
cache: false,
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
data: 'ajax=true&add&summary&id_product='+productId+'&ipa='+productAttributeId + ( (customizationId != 0) ? '&id_customization='+customizationId : '') + '&qty='+qty+'&token=' + static_token ,
|
data: 'controller=cart&ajax=true&add&getproductprice&summary&id_product='+productId+'&ipa='+productAttributeId+'&id_address_delivery='+id_address_delivery + ( (customizationId != 0) ? '&id_customization='+customizationId : '') + '&qty='+qty+'&token=' + static_token ,
|
||||||
success: function(jsonData)
|
success: function(jsonData)
|
||||||
{
|
{
|
||||||
if (jsonData.hasError)
|
if (jsonData.hasError)
|
||||||
{
|
{
|
||||||
var errors = '';
|
var errors = '';
|
||||||
for(error in jsonData.errors)
|
for(error in jsonData.errors)
|
||||||
//IE6 bug fix
|
//IE6 bug fix
|
||||||
if(error != 'indexOf')
|
if(error != 'indexOf')
|
||||||
errors += jsonData.errors[error] + "\n";
|
errors += jsonData.errors[error] + "\n";
|
||||||
alert(errors);
|
alert(errors);
|
||||||
$('input[name=quantity_'+ id +']').val($('input[name=quantity_'+ id +'_hidden]').val());
|
$('input[name=quantity_'+ id +']').val($('input[name=quantity_'+ id +'_hidden]').val());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
updateCustomizedDatas(jsonData.customizedDatas);
|
updateCustomizedDatas(jsonData.customizedDatas);
|
||||||
updateCartSummary(jsonData.summary);
|
updateCartSummary(jsonData.summary);
|
||||||
updateHookShoppingCart(jsonData.HOOK_SHOPPING_CART);
|
updateHookShoppingCart(jsonData.HOOK_SHOPPING_CART);
|
||||||
updateHookShoppingCartExtra(jsonData.HOOK_SHOPPING_CART_EXTRA);
|
updateHookShoppingCartExtra(jsonData.HOOK_SHOPPING_CART_EXTRA);
|
||||||
if (jsonData.carriers != null)
|
if (jsonData.carriers != null)
|
||||||
updateCarrierList(jsonData);
|
if (typeof(getCarrierListAndUpdate) != 'undefined')
|
||||||
}
|
getCarrierListAndUpdate();
|
||||||
},
|
}
|
||||||
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to save update quantity \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
|
},
|
||||||
});
|
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to save update quantity \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function downQuantity(id, qty)
|
function downQuantity(id, qty)
|
||||||
@@ -183,10 +369,11 @@ function downQuantity(id, qty)
|
|||||||
newVal = val - 1;
|
newVal = val - 1;
|
||||||
}
|
}
|
||||||
else if (qty < 0)
|
else if (qty < 0)
|
||||||
qty = -qty;
|
qty = -qty;
|
||||||
var customizationId = 0;
|
var customizationId = 0;
|
||||||
var productId = 0;
|
var productId = 0;
|
||||||
var productAttributeId = 0;
|
var productAttributeId = 0;
|
||||||
|
var id_address_delivery = 0;
|
||||||
var ids = 0;
|
var ids = 0;
|
||||||
if (newVal > 0)
|
if (newVal > 0)
|
||||||
{
|
{
|
||||||
@@ -196,42 +383,45 @@ function downQuantity(id, qty)
|
|||||||
productAttributeId = parseInt(ids[1]);
|
productAttributeId = parseInt(ids[1]);
|
||||||
if (typeof(ids[2]) != 'undefined')
|
if (typeof(ids[2]) != 'undefined')
|
||||||
customizationId = parseInt(ids[2]);
|
customizationId = parseInt(ids[2]);
|
||||||
|
if (typeof(ids[3]) != 'undefined')
|
||||||
|
id_address_delivery = parseInt(ids[3]);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: baseDir + 'cart.php',
|
url: baseDir,
|
||||||
async: true,
|
async: true,
|
||||||
cache: false,
|
cache: false,
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
data: 'ajax=true&add&summary&id_product='+productId+'&ipa='+productAttributeId+'&op=down' + ( (customizationId != 0) ? '&id_customization='+customizationId : '') + '&qty='+qty+'&token=' + static_token ,
|
data: 'controller=cart&ajax=true&add&getproductprice&summary&id_product='+productId+'&ipa='+productAttributeId+'&id_address_delivery='+id_address_delivery+'&op=down' + ( (customizationId != 0) ? '&id_customization='+customizationId : '') + '&qty='+qty+'&token=' + static_token ,
|
||||||
success: function(jsonData)
|
success: function(jsonData)
|
||||||
{
|
{
|
||||||
if (jsonData.hasError)
|
if (jsonData.hasError)
|
||||||
{
|
{
|
||||||
var errors = '';
|
var errors = '';
|
||||||
for(error in jsonData.errors)
|
for(error in jsonData.errors)
|
||||||
//IE6 bug fix
|
//IE6 bug fix
|
||||||
if(error != 'indexOf')
|
if(error != 'indexOf')
|
||||||
errors += jsonData.errors[error] + "\n";
|
errors += jsonData.errors[error] + "\n";
|
||||||
alert(errors);
|
alert(errors);
|
||||||
$('input[name=quantity_'+ id +']').val($('input[name=quantity_'+ id +'_hidden]').val());
|
$('input[name=quantity_'+ id +']').val($('input[name=quantity_'+ id +'_hidden]').val());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
updateCustomizedDatas(jsonData.customizedDatas);
|
updateCustomizedDatas(jsonData.customizedDatas);
|
||||||
updateCartSummary(jsonData.summary);
|
updateCartSummary(jsonData.summary);
|
||||||
updateHookShoppingCart(jsonData.HOOK_SHOPPING_CART);
|
updateHookShoppingCart(jsonData.HOOK_SHOPPING_CART);
|
||||||
updateHookShoppingCartExtra(jsonData.HOOK_SHOPPING_CART_EXTRA);
|
updateHookShoppingCartExtra(jsonData.HOOK_SHOPPING_CART_EXTRA);
|
||||||
if (jsonData.carriers != null)
|
if (jsonData.carriers != null)
|
||||||
updateCarrierList(jsonData);
|
if (typeof(getCarrierListAndUpdate) != 'undefined')
|
||||||
}
|
getCarrierListAndUpdate();
|
||||||
},
|
}
|
||||||
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to save update quantity \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
|
},
|
||||||
});
|
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to save update quantity \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
deletProductFromSummary(id);
|
deleteProductFromSummary(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -240,8 +430,29 @@ function updateCartSummary(json)
|
|||||||
// Update products prices + discount
|
// Update products prices + discount
|
||||||
var i;
|
var i;
|
||||||
var nbrProducts = 0;
|
var nbrProducts = 0;
|
||||||
|
|
||||||
|
if (typeof json == 'undefined')
|
||||||
|
return;
|
||||||
|
|
||||||
for (i=0;i<json.products.length;i++)
|
for (i=0;i<json.products.length;i++)
|
||||||
{
|
{
|
||||||
|
// if reduction, we need to show it in the cart by showing the initial price above the current one
|
||||||
|
var reduction = json.products[i].reduction_applies;
|
||||||
|
var initial_price_text = '';
|
||||||
|
initial_price = '';
|
||||||
|
if (typeof(json.products[i].price_without_quantity_discount) != 'undefined')
|
||||||
|
initial_price = formatCurrency(json.products[i].price_without_quantity_discount, currencyFormat, currencySign, currencyBlank);
|
||||||
|
var current_price = '';
|
||||||
|
if (priceDisplayMethod != 0)
|
||||||
|
current_price = formatCurrency(json.products[i].price, currencyFormat, currencySign, currencyBlank);
|
||||||
|
else
|
||||||
|
current_price = formatCurrency(json.products[i].price_wt, currencyFormat, currencySign, currencyBlank);
|
||||||
|
if (reduction && typeof(initial_price) != 'undefined')
|
||||||
|
{
|
||||||
|
if (initial_price != '' && initial_price > current_price)
|
||||||
|
initial_price_text = '<span style="text-decoration:line-through;">'+initial_price+'</span><br />';
|
||||||
|
}
|
||||||
|
|
||||||
key_for_blockcart = json.products[i].id_product+'_'+json.products[i].id_product_attribute;
|
key_for_blockcart = json.products[i].id_product+'_'+json.products[i].id_product_attribute;
|
||||||
if (json.products[i].id_product_attribute == 0)
|
if (json.products[i].id_product_attribute == 0)
|
||||||
key_for_blockcart = json.products[i].id_product;
|
key_for_blockcart = json.products[i].id_product;
|
||||||
@@ -250,34 +461,38 @@ function updateCartSummary(json)
|
|||||||
|
|
||||||
if (priceDisplayMethod != 0)
|
if (priceDisplayMethod != 0)
|
||||||
{
|
{
|
||||||
$('#cart_block_product_'+key_for_blockcart+' span.price').html(formatCurrency(json.products[i].total, currencyFormat, currencySign, currencyBlank));
|
$('#cart_block_product_'+key_for_blockcart+' span.price').html(formatCurrency(json.products[i].total, currencyFormat, currencySign, currencyBlank));
|
||||||
$('#product_price_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute).html(formatCurrency(json.products[i].price, currencyFormat, currencySign, currencyBlank));
|
$('#product_price_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute+'_'+json.products[i].id_address_delivery).html(initial_price_text+current_price);
|
||||||
$('#total_product_price_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute).html(formatCurrency(json.products[i].total, currencyFormat, currencySign, currencyBlank));
|
$('#total_product_price_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute+'_'+json.products[i].id_address_delivery).html(formatCurrency(json.products[i].total, currencyFormat, currencySign, currencyBlank));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$('#cart_block_product_'+key_for_blockcart+' span.price').html(formatCurrency(json.products[i].total_wt, currencyFormat, currencySign, currencyBlank));
|
$('#cart_block_product_'+key_for_blockcart+' span.price').html(formatCurrency(json.products[i].total_wt, currencyFormat, currencySign, currencyBlank));
|
||||||
$('#product_price_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute).html(formatCurrency(json.products[i].price_wt, currencyFormat, currencySign, currencyBlank));
|
$('#product_price_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute+'_'+json.products[i].id_address_delivery).html(initial_price_text+current_price);
|
||||||
$('#total_product_price_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute).html(formatCurrency(json.products[i].total_wt, currencyFormat, currencySign, currencyBlank));
|
$('#total_product_price_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute+'_'+json.products[i].id_address_delivery).html(formatCurrency(json.products[i].total_wt, currencyFormat, currencySign, currencyBlank));
|
||||||
}
|
}
|
||||||
|
|
||||||
nbrProducts += parseInt(json.products[i].cart_quantity);
|
nbrProducts += parseInt(json.products[i].cart_quantity);
|
||||||
|
|
||||||
if(json.products[i].id_customization == null)
|
if(json.products[i].id_customization == null)
|
||||||
{
|
{
|
||||||
$('input[name=quantity_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute+(json.products[i].id_customization != null ? '_'+json.products[i].id_customization : '')+']').val(json.products[i].cart_quantity);
|
$('input[name=quantity_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute+'_0_'+json.products[i].id_address_delivery+']').val(json.products[i].cart_quantity);
|
||||||
$('input[name=quantity_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute+(json.products[i].id_customization != null ? '_'+json.products[i].id_customization : '')+'_hidden]').val(json.products[i].cart_quantity);
|
$('input[name=quantity_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute+'_0_'+json.products[i].id_address_delivery+'_hidden]').val(json.products[i].cart_quantity);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$('#cart_quantity_custom_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute).html(json.products[i].cart_quantity);
|
//$('input[name=quantity_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute+'_'+json.products[i].id_customization+'_'+json.products[i].id_address_delivery+']')
|
||||||
|
// .val(json.products[i].cart_quantity);
|
||||||
|
$('#cart_quantity_custom_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute+'_'+json.products[i].id_address_delivery)
|
||||||
|
.html(json.products[i].cart_quantity);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show / hide quantity button if minimal quantity
|
// Show / hide quantity button if minimal quantity
|
||||||
if (parseInt(json.products[i].minimal_quantity) == parseInt(json.products[i].cart_quantity) && json.products[i].minimal_quantity != 1)
|
if (parseInt(json.products[i].minimal_quantity) == parseInt(json.products[i].cart_quantity) && json.products[i].minimal_quantity != 1)
|
||||||
$('#cart_quantity_down_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute+(json.products[i].id_customization != null ? '_'+json.products[i].id_customization : '')).fadeTo('slow',0.3);
|
$('#cart_quantity_down_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute+Number(json.products[i].id_customization)+'_'+json.products[i].id_address_delivery).fadeTo('slow',0.3);
|
||||||
else
|
else
|
||||||
$('#cart_quantity_down_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute+(json.products[i].id_customization != null ? '_'+json.products[i].id_customization : '')).fadeTo('slow',1);
|
$('#cart_quantity_down_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute+Number(json.products[i].id_customization)+'_'+json.products[i].id_address_delivery).fadeTo('slow',1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update discounts
|
// Update discounts
|
||||||
@@ -288,7 +503,11 @@ function updateCartSummary(json)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$('#total_discount').html(formatCurrency(json.total_discounts, currencyFormat, currencySign, currencyBlank));
|
if (priceDisplayMethod != 0)
|
||||||
|
$('#total_discount').html(formatCurrency(json.total_discounts_tax_exc, currencyFormat, currencySign, currencyBlank));
|
||||||
|
else
|
||||||
|
$('#total_discount').html(formatCurrency(json.total_discounts, currencyFormat, currencySign, currencyBlank));
|
||||||
|
|
||||||
$('.cart_discount').each(function(){
|
$('.cart_discount').each(function(){
|
||||||
var idElmt = $(this).attr('id').replace('cart_discount_','');
|
var idElmt = $(this).attr('id').replace('cart_discount_','');
|
||||||
var toDelete = true;
|
var toDelete = true;
|
||||||
@@ -298,7 +517,13 @@ function updateCartSummary(json)
|
|||||||
if (json.discounts[i].id_discount == idElmt)
|
if (json.discounts[i].id_discount == idElmt)
|
||||||
{
|
{
|
||||||
if (json.discounts[i].value_real != '!')
|
if (json.discounts[i].value_real != '!')
|
||||||
$('#cart_discount_' + idElmt + ' td.cart_discount_price span.price-discount').html(formatCurrency(json.discounts[i].value_real * -1, currencyFormat, currencySign, currencyBlank));
|
{
|
||||||
|
if (priceDisplayMethod != 0)
|
||||||
|
$('#cart_discount_' + idElmt + ' td.cart_discount_price span.price-discount').html(formatCurrency(json.discounts[i].value_tax_exc * -1, currencyFormat, currencySign, currencyBlank));
|
||||||
|
else
|
||||||
|
$('#cart_discount_' + idElmt + ' td.cart_discount_price span.price-discount').html(formatCurrency(json.discounts[i].value_real * -1, currencyFormat, currencySign, currencyBlank));
|
||||||
|
|
||||||
|
}
|
||||||
toDelete = false;
|
toDelete = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -308,16 +533,16 @@ function updateCartSummary(json)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Block cart
|
// Block cart
|
||||||
if (priceDisplayMethod != 0)
|
if (priceDisplayMethod != 0)
|
||||||
{
|
{
|
||||||
$('#cart_block_shipping_cost').html(formatCurrency(json.total_shipping_tax_exc, currencyFormat, currencySign, currencyBlank));
|
$('#cart_block_shipping_cost').html(formatCurrency(json.total_shipping_tax_exc, currencyFormat, currencySign, currencyBlank));
|
||||||
$('#cart_block_wrapping_cost').html(formatCurrency(json.total_wrapping_tax_exc, currencyFormat, currencySign, currencyBlank));
|
$('#cart_block_wrapping_cost').html(formatCurrency(json.total_wrapping_tax_exc, currencyFormat, currencySign, currencyBlank));
|
||||||
$('#cart_block_total').html(formatCurrency(json.total_price_without_tax, currencyFormat, currencySign, currencyBlank));
|
$('#cart_block_total').html(formatCurrency(json.total_price_without_tax, currencyFormat, currencySign, currencyBlank));
|
||||||
} else {
|
} else {
|
||||||
$('#cart_block_shipping_cost').html(formatCurrency(json.total_shipping, currencyFormat, currencySign, currencyBlank));
|
$('#cart_block_shipping_cost').html(formatCurrency(json.total_shipping, currencyFormat, currencySign, currencyBlank));
|
||||||
$('#cart_block_wrapping_cost').html(formatCurrency(json.total_wrapping, currencyFormat, currencySign, currencyBlank));
|
$('#cart_block_wrapping_cost').html(formatCurrency(json.total_wrapping, currencyFormat, currencySign, currencyBlank));
|
||||||
$('#cart_block_total').html(formatCurrency(json.total_price, currencyFormat, currencySign, currencyBlank));
|
$('#cart_block_total').html(formatCurrency(json.total_price, currencyFormat, currencySign, currencyBlank));
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#cart_block_tax_cost').html(formatCurrency(json.total_tax, currencyFormat, currencySign, currencyBlank));
|
$('#cart_block_tax_cost').html(formatCurrency(json.total_tax, currencyFormat, currencySign, currencyBlank));
|
||||||
$('.ajax_cart_quantity').html(nbrProducts);
|
$('.ajax_cart_quantity').html(nbrProducts);
|
||||||
@@ -325,10 +550,10 @@ function updateCartSummary(json)
|
|||||||
// Cart summary
|
// Cart summary
|
||||||
$('#summary_products_quantity').html(nbrProducts+' '+(nbrProducts > 1 ? txtProducts : txtProduct));
|
$('#summary_products_quantity').html(nbrProducts+' '+(nbrProducts > 1 ? txtProducts : txtProduct));
|
||||||
if (priceDisplayMethod != 0)
|
if (priceDisplayMethod != 0)
|
||||||
$('#total_product').html(formatCurrency(json.total_products, currencyFormat, currencySign, currencyBlank));
|
$('#total_product').html(formatCurrency(json.total_products, currencyFormat, currencySign, currencyBlank));
|
||||||
else
|
else
|
||||||
$('#total_product').html(formatCurrency(json.total_products_wt, currencyFormat, currencySign, currencyBlank));
|
$('#total_product').html(formatCurrency(json.total_products_wt, currencyFormat, currencySign, currencyBlank));
|
||||||
$('#total_price').children('span').html(formatCurrency(json.total_price, currencyFormat, currencySign, currencyBlank));
|
$('#total_price').html(formatCurrency(json.total_price, currencyFormat, currencySign, currencyBlank));
|
||||||
$('#total_price_without_tax').html(formatCurrency(json.total_price_without_tax, currencyFormat, currencySign, currencyBlank));
|
$('#total_price_without_tax').html(formatCurrency(json.total_price_without_tax, currencyFormat, currencySign, currencyBlank));
|
||||||
$('#total_tax').html(formatCurrency(json.total_tax, currencyFormat, currencySign, currencyBlank));
|
$('#total_tax').html(formatCurrency(json.total_tax, currencyFormat, currencySign, currencyBlank));
|
||||||
|
|
||||||
@@ -338,12 +563,12 @@ function updateCartSummary(json)
|
|||||||
{
|
{
|
||||||
$('.cart_total_delivery').fadeIn();
|
$('.cart_total_delivery').fadeIn();
|
||||||
if (priceDisplayMethod != 0)
|
if (priceDisplayMethod != 0)
|
||||||
{
|
{
|
||||||
$('#total_shipping').html(formatCurrency(json.total_shipping_tax_exc, currencyFormat, currencySign, currencyBlank));
|
$('#total_shipping').html(formatCurrency(json.total_shipping_tax_exc, currencyFormat, currencySign, currencyBlank));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$('#total_shipping').html(formatCurrency(json.total_shipping, currencyFormat, currencySign, currencyBlank));
|
$('#total_shipping').html(formatCurrency(json.total_shipping, currencyFormat, currencySign, currencyBlank));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -374,10 +599,11 @@ function updateCustomizedDatas(json)
|
|||||||
for(i in json)
|
for(i in json)
|
||||||
for(j in json[i])
|
for(j in json[i])
|
||||||
for(k in json[i][j])
|
for(k in json[i][j])
|
||||||
{
|
for(l in json[i][j][k])
|
||||||
$('input[name=quantity_'+i+'_'+j+'_'+k+'_hidden]').val(json[i][j][k]['quantity']);
|
{
|
||||||
$('input[name=quantity_'+i+'_'+j+'_'+k+']').val(json[i][j][k]['quantity']);
|
$('input[name=quantity_'+i+'_'+j+'_'+l+'_'+k+'_hidden]').val(json[i][j][k][l]['quantity']);
|
||||||
}
|
$('input[name=quantity_'+i+'_'+j+'_'+l+'_'+k+']').val(json[i][j][k][l]['quantity']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateHookShoppingCart(html)
|
function updateHookShoppingCart(html)
|
||||||
@@ -389,4 +615,35 @@ function updateHookShoppingCartExtra(html)
|
|||||||
{
|
{
|
||||||
$('#HOOK_SHOPPING_CART_EXTRA').html(html);
|
$('#HOOK_SHOPPING_CART_EXTRA').html(html);
|
||||||
}
|
}
|
||||||
|
$(document).ready(function() {
|
||||||
|
$.each($('.delivery_option_radio'), function() {
|
||||||
|
if ($(this).attr('checked'))
|
||||||
|
$(this).parent().find('.delivery_option_carrier').show();
|
||||||
|
else
|
||||||
|
$(this).parent().find('.delivery_option_carrier').hide();
|
||||||
|
|
||||||
|
});
|
||||||
|
$('.delivery_option_radio').change(function() {
|
||||||
|
$(this).parent().parent().find('.delivery_option_carrier').hide();
|
||||||
|
$(this).parent().find('.delivery_option_carrier').show();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#allow_seperated_package').live('click', function() {
|
||||||
|
$.ajax({
|
||||||
|
type: 'GET',
|
||||||
|
url: baseDir,
|
||||||
|
async: true,
|
||||||
|
cache: false,
|
||||||
|
data: 'controller=cart&ajax=true&allowSeperatedPackage&value='
|
||||||
|
+($(this).attr('checked') ? '1' : '0')
|
||||||
|
+'&token='+static_token,
|
||||||
|
success: function(jsonData)
|
||||||
|
{
|
||||||
|
if (typeof(getCarrierListAndUpdate) != 'undefined')
|
||||||
|
getCarrierListAndUpdate();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#gift').checkboxChange(function() { $('#gift_div').show('slow'); }, function() { $('#gift_div').hide('slow'); });
|
||||||
|
});
|
||||||
|
|||||||
+241
-179
@@ -19,71 +19,19 @@
|
|||||||
*
|
*
|
||||||
* @author PrestaShop SA <contact@prestashop.com>
|
* @author PrestaShop SA <contact@prestashop.com>
|
||||||
* @copyright 2007-2011 PrestaShop SA
|
* @copyright 2007-2011 PrestaShop SA
|
||||||
* @version Release: $Revision: 6772 $
|
* @version Release: $Revision: 7040 $
|
||||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||||
* International Registered Trademark & Property of PrestaShop SA
|
* International Registered Trademark & Property of PrestaShop SA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function updateCarrierList(json)
|
function updateCarrierList(json)
|
||||||
{
|
{
|
||||||
var carriers = json.carriers;
|
var html = json.carrier_block;
|
||||||
|
|
||||||
/* contains all carrier available for this address */
|
if (json.HOOK_EXTRACARRIER !== null && json.HOOK_EXTRACARRIER != undefined)
|
||||||
if (carriers.length == 0)
|
html += json.HOOK_EXTRACARRIER;
|
||||||
{
|
|
||||||
checkedCarrier = 0;
|
|
||||||
$('input[name=id_carrier]:checked').attr('checked', false);
|
|
||||||
$('#noCarrierWarning').show();
|
|
||||||
$('#extra_carrier').hide();
|
|
||||||
$('#recyclable_block').hide();
|
|
||||||
$('table#carrierTable:visible').hide();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
checkedCarrier = json.checked;
|
|
||||||
var html = '';
|
|
||||||
for (i=0;i<carriers.length; i++)
|
|
||||||
{
|
|
||||||
var itemType = '';
|
|
||||||
|
|
||||||
if (i == 0)
|
$('#carrier_area').replaceWith(html);
|
||||||
itemType = 'first_item ';
|
|
||||||
else if (i == carriers.length-1)
|
|
||||||
itemType = 'last_item ';
|
|
||||||
if (i % 2)
|
|
||||||
itemType = itemType + 'alternate_item';
|
|
||||||
else
|
|
||||||
itemType = itemType + 'item';
|
|
||||||
|
|
||||||
var name = carriers[i].name;
|
|
||||||
if (carriers[i].img != '')
|
|
||||||
name = '<img src="'+carriers[i].img+'" alt="" />';
|
|
||||||
|
|
||||||
if (!(carriers[i].is_module && !isLogged))
|
|
||||||
var extraHtml = 'disabled="disabled"';
|
|
||||||
else if (checkedCarrier == carriers[i].id_carrier || carriers.length == 1)
|
|
||||||
var extraHtml = 'checked="checked"';
|
|
||||||
|
|
||||||
html = html +
|
|
||||||
'<tr class="'+itemType+'">'+
|
|
||||||
'<td class="carrier_action radio"><input type="radio" name="id_carrier" value="'+carriers[i].id_carrier+'" id="id_carrier'+carriers[i].id_carrier+'" onclick="updateCarrierSelectionAndGift();" '+extraHtml+' /></td>'+
|
|
||||||
'<td class="carrier_name"><label for="id_carrier'+carriers[i].id_carrier+'">'+name+'</label></td>'+
|
|
||||||
'<td class="carrier_infos">'+carriers[i].delay+'</td>'+
|
|
||||||
'<td class="carrier_price"><span class="price">'+formatCurrency(carriers[i].price, currencyFormat, currencySign, currencyBlank)+'</span>';
|
|
||||||
if (taxEnabled && displayPrice == 0)
|
|
||||||
html = html + ' ' + txtWithTax;
|
|
||||||
else
|
|
||||||
html = html + ' ' + txtWithoutTax;
|
|
||||||
html = html + '</td>'+
|
|
||||||
'</tr>';
|
|
||||||
}
|
|
||||||
if (json.HOOK_EXTRACARRIER !== null && json.HOOK_EXTRACARRIER != undefined) html += json.HOOK_EXTRACARRIER;
|
|
||||||
$('#noCarrierWarning').hide();
|
|
||||||
$('#extra_carrier:hidden').show();
|
|
||||||
$('table#carrierTable tbody').html(html);
|
|
||||||
$('table#carrierTable:hidden').show();
|
|
||||||
$('#recyclable_block:hidden').show();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* update hooks for carrier module */
|
/* update hooks for carrier module */
|
||||||
$('#HOOK_BEFORECARRIER').html(json.HOOK_BEFORECARRIER);
|
$('#HOOK_BEFORECARRIER').html(json.HOOK_BEFORECARRIER);
|
||||||
@@ -97,46 +45,51 @@ function updatePaymentMethods(json)
|
|||||||
|
|
||||||
function updateAddressSelection()
|
function updateAddressSelection()
|
||||||
{
|
{
|
||||||
var idAddress_delivery = ($('input#opc_id_address_delivery').length == 1 ? $('input#opc_id_address_delivery').val() : $('select#id_address_delivery').val());
|
var idAddress_delivery = ($('input#opc_id_address_delivery').length == 1 ? $('input#opc_id_address_delivery').val() : $('#id_address_delivery').val());
|
||||||
var idAddress_invoice = ($('input#opc_id_address_invoice').length == 1 ? $('input#opc_id_address_invoice').val() : ($('input[type=checkbox]#addressesAreEquals:checked').length == 1 ? idAddress_delivery : ($('select#id_address_invoice').length == 1 ? $('select#id_address_invoice').val() : idAddress_delivery)));
|
var idAddress_invoice = ($('input#opc_id_address_invoice').length == 1 ? $('input#opc_id_address_invoice').val() : ($('input[type=checkbox]#addressesAreEquals:checked').length == 1 ? idAddress_delivery : ($('#id_address_invoice').length == 1 ? $('select#id_address_invoice').val() : idAddress_delivery)));
|
||||||
|
|
||||||
$('#opc_account-overlay').fadeIn('slow');
|
$('#opc_account-overlay').fadeIn('slow');
|
||||||
$('#opc_delivery_methods-overlay').fadeIn('slow');
|
$('#opc_delivery_methods-overlay').fadeIn('slow');
|
||||||
$('#opc_payment_methods-overlay').fadeIn('slow');
|
$('#opc_payment_methods-overlay').fadeIn('slow');
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: orderOpcUrl,
|
url: orderOpcUrl,
|
||||||
async: true,
|
async: true,
|
||||||
cache: false,
|
cache: false,
|
||||||
dataType : "json",
|
dataType : "json",
|
||||||
data: 'ajax=true&method=updateAddressesSelected&id_address_delivery=' + idAddress_delivery + '&id_address_invoice=' + idAddress_invoice + '&token=' + static_token,
|
data: 'ajax=true&method=updateAddressesSelected&id_address_delivery=' + idAddress_delivery + '&id_address_invoice=' + idAddress_invoice + '&token=' + static_token,
|
||||||
success: function(jsonData)
|
success: function(jsonData)
|
||||||
{
|
{
|
||||||
if (jsonData.hasError)
|
if (jsonData.hasError)
|
||||||
{
|
{
|
||||||
var errors = '';
|
var errors = '';
|
||||||
for(error in jsonData.errors)
|
for(error in jsonData.errors)
|
||||||
//IE6 bug fix
|
//IE6 bug fix
|
||||||
if(error != 'indexOf')
|
if(error != 'indexOf')
|
||||||
errors += jsonData.errors[error] + "\n";
|
errors += jsonData.errors[error] + "\n";
|
||||||
alert(errors);
|
alert(errors);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
updateCarrierList(jsonData);
|
updateCarrierList(jsonData.carrier_data);
|
||||||
updatePaymentMethods(jsonData);
|
updatePaymentMethods(jsonData);
|
||||||
updateCartSummary(jsonData.summary);
|
updateCartSummary(jsonData.summary);
|
||||||
updateHookShoppingCart(jsonData.HOOK_SHOPPING_CART);
|
updateHookShoppingCart(jsonData.HOOK_SHOPPING_CART);
|
||||||
updateHookShoppingCartExtra(jsonData.HOOK_SHOPPING_CART_EXTRA);
|
updateHookShoppingCartExtra(jsonData.HOOK_SHOPPING_CART_EXTRA);
|
||||||
if ($('#gift-price').length == 1)
|
if ($('#gift-price').length == 1)
|
||||||
$('#gift-price').html(jsonData.gift_price);
|
$('#gift-price').html(jsonData.gift_price);
|
||||||
$('#opc_account-overlay').fadeOut('slow');
|
$('#opc_account-overlay').fadeOut('slow');
|
||||||
$('#opc_delivery_methods-overlay').fadeOut('slow');
|
$('#opc_delivery_methods-overlay').fadeOut('slow');
|
||||||
$('#opc_payment_methods-overlay').fadeOut('slow');
|
$('#opc_payment_methods-overlay').fadeOut('slow');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to save adresses \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
|
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||||
|
alert("TECHNICAL ERROR: unable to save adresses \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
||||||
|
$('#opc_account-overlay').fadeOut('slow');
|
||||||
|
$('#opc_delivery_methods-overlay').fadeOut('slow');
|
||||||
|
$('#opc_payment_methods-overlay').fadeOut('slow');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,14 +97,14 @@ function getCarrierListAndUpdate()
|
|||||||
{
|
{
|
||||||
$('#opc_delivery_methods-overlay').fadeIn('slow');
|
$('#opc_delivery_methods-overlay').fadeIn('slow');
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: orderOpcUrl,
|
url: orderOpcUrl,
|
||||||
async: true,
|
async: true,
|
||||||
cache: false,
|
cache: false,
|
||||||
dataType : "json",
|
dataType : "json",
|
||||||
data: 'ajax=true&method=getCarrierList&token=' + static_token,
|
data: 'ajax=true&method=getCarrierList&token=' + static_token,
|
||||||
success: function(jsonData)
|
success: function(jsonData)
|
||||||
{
|
{
|
||||||
if (jsonData.hasError)
|
if (jsonData.hasError)
|
||||||
{
|
{
|
||||||
var errors = '';
|
var errors = '';
|
||||||
@@ -173,7 +126,14 @@ function updateCarrierSelectionAndGift()
|
|||||||
var recyclablePackage = 0;
|
var recyclablePackage = 0;
|
||||||
var gift = 0;
|
var gift = 0;
|
||||||
var giftMessage = '';
|
var giftMessage = '';
|
||||||
var idCarrier = 0;
|
|
||||||
|
var delivery_option_radio = $('.delivery_option_radio');
|
||||||
|
var delivery_option_params = '&';
|
||||||
|
$.each(delivery_option_radio, function(i) {
|
||||||
|
delivery_option_params += $(delivery_option_radio[i]).attr('name') + '=' + $(delivery_option_radio[i]).val() + '&';
|
||||||
|
});
|
||||||
|
if (delivery_option_params == '&')
|
||||||
|
delivery_option_params = '&delivery_option=&'
|
||||||
|
|
||||||
if ($('input#recyclable:checked').length)
|
if ($('input#recyclable:checked').length)
|
||||||
recyclablePackage = 1;
|
recyclablePackage = 1;
|
||||||
@@ -183,43 +143,42 @@ function updateCarrierSelectionAndGift()
|
|||||||
giftMessage = encodeURIComponent($('textarea#gift_message').val());
|
giftMessage = encodeURIComponent($('textarea#gift_message').val());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($('input[name=id_carrier]:checked').length)
|
|
||||||
{
|
|
||||||
idCarrier = $('input[name=id_carrier]:checked').val();
|
|
||||||
checkedCarrier = idCarrier;
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#opc_payment_methods-overlay').fadeIn('slow');
|
$('#opc_payment_methods-overlay').fadeIn('slow');
|
||||||
$('#opc_delivery_methods-overlay').fadeIn('slow');
|
$('#opc_delivery_methods-overlay').fadeIn('slow');
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: orderOpcUrl,
|
url: orderOpcUrl,
|
||||||
async: false,
|
async: true,
|
||||||
cache: false,
|
cache: false,
|
||||||
dataType : "json",
|
dataType : "json",
|
||||||
data: 'ajax=true&method=updateCarrierAndGetPayments&id_carrier=' + idCarrier + '&recyclable=' + recyclablePackage + '&gift=' + gift + '&gift_message=' + giftMessage + '&token=' + static_token ,
|
data: 'ajax=true&method=updateCarrierAndGetPayments' + delivery_option_params + 'recyclable=' + recyclablePackage + '&gift=' + gift + '&gift_message=' + giftMessage + '&token=' + static_token ,
|
||||||
success: function(jsonData)
|
success: function(jsonData)
|
||||||
{
|
{
|
||||||
if (jsonData.hasError)
|
if (jsonData.hasError)
|
||||||
{
|
{
|
||||||
var errors = '';
|
var errors = '';
|
||||||
for(error in jsonData.errors)
|
for(error in jsonData.errors)
|
||||||
//IE6 bug fix
|
//IE6 bug fix
|
||||||
if(error != 'indexOf')
|
if(error != 'indexOf')
|
||||||
errors += jsonData.errors[error] + "\n";
|
errors += jsonData.errors[error] + "\n";
|
||||||
alert(errors);
|
alert(errors);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
updateCartSummary(jsonData.summary);
|
updateCartSummary(jsonData.summary);
|
||||||
updatePaymentMethods(jsonData);
|
updatePaymentMethods(jsonData);
|
||||||
updateHookShoppingCart(jsonData.summary.HOOK_SHOPPING_CART);
|
updateHookShoppingCart(jsonData.summary.HOOK_SHOPPING_CART);
|
||||||
updateHookShoppingCartExtra(jsonData.summary.HOOK_SHOPPING_CART_EXTRA);
|
updateHookShoppingCartExtra(jsonData.summary.HOOK_SHOPPING_CART_EXTRA);
|
||||||
|
updateCarrierList(jsonData.carrier_data);
|
||||||
$('#opc_payment_methods-overlay').fadeOut('slow');
|
$('#opc_payment_methods-overlay').fadeOut('slow');
|
||||||
$('#opc_delivery_methods-overlay').fadeOut('slow');
|
$('#opc_delivery_methods-overlay').fadeOut('slow');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to save carrier \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
|
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||||
|
alert("TECHNICAL ERROR: unable to save carrier \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
||||||
|
$('#opc_payment_methods-overlay').fadeOut('slow');
|
||||||
|
$('#opc_delivery_methods-overlay').fadeOut('slow');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -242,12 +201,12 @@ function confirmFreeOrder()
|
|||||||
{
|
{
|
||||||
var array_split = html.split(':');
|
var array_split = html.split(':');
|
||||||
if (array_split[0] === 'freeorder')
|
if (array_split[0] === 'freeorder')
|
||||||
{
|
{
|
||||||
if (isGuest)
|
if (isGuest)
|
||||||
document.location.href = guestTrackingUrl+'?id_order='+encodeURIComponent(array_split[1])+'&email='+encodeURIComponent(array_split[2]);
|
document.location.href = guestTrackingUrl+'?id_order='+encodeURIComponent(array_split[1])+'&email='+encodeURIComponent(array_split[2]);
|
||||||
else
|
else
|
||||||
document.location.href = historyUrl;
|
document.location.href = historyUrl;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to confirm the order \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
|
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to confirm the order \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
|
||||||
});
|
});
|
||||||
@@ -266,8 +225,11 @@ function saveAddress(type)
|
|||||||
params += 'address2='+encodeURIComponent($('#address2'+(type == 'invoice' ? '_invoice' : '')).val())+'&';
|
params += 'address2='+encodeURIComponent($('#address2'+(type == 'invoice' ? '_invoice' : '')).val())+'&';
|
||||||
params += 'postcode='+encodeURIComponent($('#postcode'+(type == 'invoice' ? '_invoice' : '')).val())+'&';
|
params += 'postcode='+encodeURIComponent($('#postcode'+(type == 'invoice' ? '_invoice' : '')).val())+'&';
|
||||||
params += 'city='+encodeURIComponent($('#city'+(type == 'invoice' ? '_invoice' : '')).val())+'&';
|
params += 'city='+encodeURIComponent($('#city'+(type == 'invoice' ? '_invoice' : '')).val())+'&';
|
||||||
params += 'id_country='+encodeURIComponent($('#id_country'+(type == 'invoice' ? '_invoice' : '')).val())+'&';
|
params += 'id_country='+encodeURIComponent($('#id_country').val())+'&';
|
||||||
|
if ($('#id_state'+(type == 'invoice' ? '_invoice' : '')).val())
|
||||||
|
{
|
||||||
params += 'id_state='+encodeURIComponent($('#id_state'+(type == 'invoice' ? '_invoice' : '')).val())+'&';
|
params += 'id_state='+encodeURIComponent($('#id_state'+(type == 'invoice' ? '_invoice' : '')).val())+'&';
|
||||||
|
}
|
||||||
params += 'other='+encodeURIComponent($('#other'+(type == 'invoice' ? '_invoice' : '')).val())+'&';
|
params += 'other='+encodeURIComponent($('#other'+(type == 'invoice' ? '_invoice' : '')).val())+'&';
|
||||||
params += 'phone='+encodeURIComponent($('#phone'+(type == 'invoice' ? '_invoice' : '')).val())+'&';
|
params += 'phone='+encodeURIComponent($('#phone'+(type == 'invoice' ? '_invoice' : '')).val())+'&';
|
||||||
params += 'phone_mobile='+encodeURIComponent($('#phone_mobile'+(type == 'invoice' ? '_invoice' : '')).val())+'&';
|
params += 'phone_mobile='+encodeURIComponent($('#phone_mobile'+(type == 'invoice' ? '_invoice' : '')).val())+'&';
|
||||||
@@ -278,18 +240,18 @@ function saveAddress(type)
|
|||||||
var result = false;
|
var result = false;
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: addressUrl,
|
url: addressUrl,
|
||||||
async: false,
|
async: false,
|
||||||
cache: false,
|
cache: false,
|
||||||
dataType : "json",
|
dataType : "json",
|
||||||
data: 'ajax=true&submitAddress=true&type='+type+'&'+params+'&token=' + static_token,
|
data: 'ajax=true&submitAddress=true&type='+type+'&'+params+'&token=' + static_token,
|
||||||
success: function(jsonData)
|
success: function(jsonData)
|
||||||
{
|
{
|
||||||
if (jsonData.hasError)
|
if (jsonData.hasError)
|
||||||
{
|
{
|
||||||
var tmp = '';
|
var tmp = '';
|
||||||
var i = 0;
|
var i = 0;
|
||||||
for(error in jsonData.errors)
|
for(error in jsonData.errors)
|
||||||
//IE6 bug fix
|
//IE6 bug fix
|
||||||
if(error != 'indexOf')
|
if(error != 'indexOf')
|
||||||
@@ -315,8 +277,13 @@ function saveAddress(type)
|
|||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to save adresses \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
|
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||||
});
|
alert("TECHNICAL ERROR: unable to save adresses \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
||||||
|
$('#opc_new_account-overlay').fadeOut('slow');
|
||||||
|
$('#opc_delivery_methods-overlay').fadeOut('slow');
|
||||||
|
$('#opc_payment_methods-overlay').fadeOut('slow');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -335,6 +302,10 @@ function updateNewAccountToAddressBlock()
|
|||||||
data: 'ajax=true&method=getAddressBlockAndCarriersAndPayments&token=' + static_token ,
|
data: 'ajax=true&method=getAddressBlockAndCarriersAndPayments&token=' + static_token ,
|
||||||
success: function(json)
|
success: function(json)
|
||||||
{
|
{
|
||||||
|
isLogged = 1;
|
||||||
|
if (json.no_address == 1)
|
||||||
|
document.location.href = addressUrl;
|
||||||
|
|
||||||
$('#opc_new_account').fadeOut('fast', function() {
|
$('#opc_new_account').fadeOut('fast', function() {
|
||||||
$('#opc_new_account').html(json.order_opc_adress);
|
$('#opc_new_account').html(json.order_opc_adress);
|
||||||
// update block user info
|
// update block user info
|
||||||
@@ -348,7 +319,7 @@ function updateNewAccountToAddressBlock()
|
|||||||
$('#opc_new_account').fadeIn('fast', function() {
|
$('#opc_new_account').fadeIn('fast', function() {
|
||||||
updateCartSummary(json.summary);
|
updateCartSummary(json.summary);
|
||||||
updateAddressesDisplay(true);
|
updateAddressesDisplay(true);
|
||||||
updateCarrierList(json.carrier_list);
|
updateCarrierList(json.carrier_data);
|
||||||
updatePaymentMethods(json);
|
updatePaymentMethods(json);
|
||||||
if ($('#gift-price').length == 1)
|
if ($('#gift-price').length == 1)
|
||||||
$('#gift-price').html(json.gift_price);
|
$('#gift-price').html(json.gift_price);
|
||||||
@@ -357,7 +328,11 @@ function updateNewAccountToAddressBlock()
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to send login informations \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
|
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||||
|
alert("TECHNICAL ERROR: unable to send login informations \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
||||||
|
$('#opc_delivery_methods-overlay').fadeOut('slow');
|
||||||
|
$('#opc_payment_methods-overlay').fadeOut('slow');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -433,7 +408,7 @@ $(function() {
|
|||||||
async: false,
|
async: false,
|
||||||
cache: false,
|
cache: false,
|
||||||
dataType : "json",
|
dataType : "json",
|
||||||
data: 'SubmitLogin=true&ajax=true&email='+encodeURIComponent($('#login_email').val())+'&passwd='+encodeURIComponent($('#passwd').val())+'&token=' + static_token ,
|
data: 'SubmitLogin=true&ajax=true&email='+encodeURIComponent($('#login_email').val())+'&passwd='+encodeURIComponent($('#login_passwd').val())+'&token=' + static_token ,
|
||||||
success: function(jsonData)
|
success: function(jsonData)
|
||||||
{
|
{
|
||||||
if (jsonData.hasError)
|
if (jsonData.hasError)
|
||||||
@@ -577,6 +552,7 @@ $(function() {
|
|||||||
// force to refresh carrier list
|
// force to refresh carrier list
|
||||||
if (isGuest)
|
if (isGuest)
|
||||||
{
|
{
|
||||||
|
isLogged = 1;
|
||||||
$('#opc_account_saved').fadeIn('slow');
|
$('#opc_account_saved').fadeIn('slow');
|
||||||
$('#submitAccount').hide();
|
$('#submitAccount').hide();
|
||||||
updateAddressSelection();
|
updateAddressSelection();
|
||||||
@@ -588,7 +564,12 @@ $(function() {
|
|||||||
$('#opc_delivery_methods-overlay').fadeOut('slow');
|
$('#opc_delivery_methods-overlay').fadeOut('slow');
|
||||||
$('#opc_payment_methods-overlay').fadeOut('slow');
|
$('#opc_payment_methods-overlay').fadeOut('slow');
|
||||||
},
|
},
|
||||||
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to save account \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
|
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||||
|
alert("TECHNICAL ERROR: unable to save account \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
||||||
|
$('#opc_new_account-overlay').fadeOut('slow');
|
||||||
|
$('#opc_delivery_methods-overlay').fadeOut('slow');
|
||||||
|
$('#opc_payment_methods-overlay').fadeOut('slow');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
@@ -598,15 +579,15 @@ $(function() {
|
|||||||
$('#message').blur(function() {
|
$('#message').blur(function() {
|
||||||
$('#opc_delivery_methods-overlay').fadeIn('slow');
|
$('#opc_delivery_methods-overlay').fadeIn('slow');
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: orderOpcUrl,
|
url: orderOpcUrl,
|
||||||
async: false,
|
async: false,
|
||||||
cache: false,
|
cache: false,
|
||||||
dataType : "json",
|
dataType : "json",
|
||||||
data: 'ajax=true&method=updateMessage&message=' + encodeURIComponent($('#message').val()) + '&token=' + static_token ,
|
data: 'ajax=true&method=updateMessage&message=' + encodeURIComponent($('#message').val()) + '&token=' + static_token ,
|
||||||
success: function(jsonData)
|
success: function(jsonData)
|
||||||
{
|
{
|
||||||
if (jsonData.hasError)
|
if (jsonData.hasError)
|
||||||
{
|
{
|
||||||
var errors = '';
|
var errors = '';
|
||||||
for(error in jsonData.errors)
|
for(error in jsonData.errors)
|
||||||
@@ -615,11 +596,14 @@ $(function() {
|
|||||||
errors += jsonData.errors[error] + "\n";
|
errors += jsonData.errors[error] + "\n";
|
||||||
alert(errors);
|
alert(errors);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$('#opc_delivery_methods-overlay').fadeOut('slow');
|
$('#opc_delivery_methods-overlay').fadeOut('slow');
|
||||||
},
|
},
|
||||||
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to save message \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
|
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||||
});
|
alert("TECHNICAL ERROR: unable to save message \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
||||||
|
$('#opc_delivery_methods-overlay').fadeOut('slow');
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Recyclable checkbox
|
// Recyclable checkbox
|
||||||
@@ -646,8 +630,8 @@ $(function() {
|
|||||||
updateCarrierSelectionAndGift();
|
updateCarrierSelectionAndGift();
|
||||||
});
|
});
|
||||||
|
|
||||||
// TOS
|
// Term Of Service (TOS)
|
||||||
$('#cgv').click(function() {
|
$('#cgv').live('click', function() {
|
||||||
if ($('#cgv:checked').length != 0)
|
if ($('#cgv:checked').length != 0)
|
||||||
var checked = 1;
|
var checked = 1;
|
||||||
else
|
else
|
||||||
@@ -655,19 +639,19 @@ $(function() {
|
|||||||
|
|
||||||
$('#opc_payment_methods-overlay').fadeIn('slow');
|
$('#opc_payment_methods-overlay').fadeIn('slow');
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: orderOpcUrl,
|
url: orderOpcUrl,
|
||||||
async: true,
|
async: true,
|
||||||
cache: false,
|
cache: false,
|
||||||
dataType : "json",
|
dataType : "json",
|
||||||
data: 'ajax=true&method=updateTOSStatusAndGetPayments&checked=' + checked + '&token=' + static_token,
|
data: 'ajax=true&method=updateTOSStatusAndGetPayments&checked=' + checked + '&token=' + static_token,
|
||||||
success: function(json)
|
success: function(json)
|
||||||
{
|
{
|
||||||
$('div#HOOK_TOP_PAYMENT').html(json.HOOK_TOP_PAYMENT);
|
$('div#HOOK_TOP_PAYMENT').html(json.HOOK_TOP_PAYMENT);
|
||||||
$('#opc_payment_methods-content div#HOOK_PAYMENT').html(json.HOOK_PAYMENT);
|
$('#opc_payment_methods-content div#HOOK_PAYMENT').html(json.HOOK_PAYMENT);
|
||||||
$('#opc_payment_methods-overlay').fadeOut('slow');
|
$('#opc_payment_methods-overlay').fadeOut('slow');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#opc_account_form input,select,textarea').change(function() {
|
$('#opc_account_form input,select,textarea').change(function() {
|
||||||
@@ -679,3 +663,81 @@ $(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function multishippingMode(it)
|
||||||
|
{
|
||||||
|
if ($(it).attr('checked'))
|
||||||
|
{
|
||||||
|
$('#address_delivery').hide();
|
||||||
|
$('#address_invoice').removeClass('alternate_item').addClass('item');
|
||||||
|
$('#multishipping_mode_box').addClass('on');
|
||||||
|
|
||||||
|
$('#link_multishipping_form').click(function() {return false;});
|
||||||
|
|
||||||
|
$('#link_multishipping_form').fancybox({
|
||||||
|
'transitionIn': 'elastic',
|
||||||
|
'transitionOut': 'elastic',
|
||||||
|
'type': 'ajax',
|
||||||
|
'onClosed': function()
|
||||||
|
{
|
||||||
|
// Reload the cart
|
||||||
|
$.ajax({
|
||||||
|
url: orderOpcUrl,
|
||||||
|
data: 'ajax=true&method=cartReload',
|
||||||
|
dataType : 'html',
|
||||||
|
cache: false,
|
||||||
|
success: function(data) {
|
||||||
|
$('#cart_summary').replaceWith($(data).find('#cart_summary'));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
updateCarrierSelectionAndGift();
|
||||||
|
},
|
||||||
|
'onStart': function()
|
||||||
|
{
|
||||||
|
// Removing all ids on the cart to avoid conflic with the new one on the fancybox
|
||||||
|
// This action could "break" the cart design, if css rules use ids of the cart
|
||||||
|
$.each($('#cart_summary *'), function(it, el) {
|
||||||
|
$(el).attr('id', '');
|
||||||
|
});
|
||||||
|
},
|
||||||
|
'onComplete': function()
|
||||||
|
{
|
||||||
|
cleanSelectAddressDelivery();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$('#address_delivery').show();
|
||||||
|
$('#address_invoice').removeClass('item').addClass('alternate_item');
|
||||||
|
$('#multishipping_mode_box').removeClass('on');
|
||||||
|
|
||||||
|
// Disable multi address shipping
|
||||||
|
$.ajax({
|
||||||
|
url: orderOpcUrl,
|
||||||
|
async: true,
|
||||||
|
cache: false,
|
||||||
|
data: 'ajax=true&method=noMultiAddressDelivery',
|
||||||
|
});
|
||||||
|
|
||||||
|
// Reload the cart
|
||||||
|
$.ajax({
|
||||||
|
url: orderOpcUrl,
|
||||||
|
async: true,
|
||||||
|
cache: false,
|
||||||
|
data: 'ajax=true&method=cartReload',
|
||||||
|
dataType : 'html',
|
||||||
|
success: function(data) {
|
||||||
|
$('#cart_summary').replaceWith($(data).find('#cart_summary'));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
// If the multishipping mode is off assure us the checkbox "I want to specify a delivery address for each products I order." is unchecked.
|
||||||
|
$('#multishipping_mode_checkbox').attr('checked', false);
|
||||||
|
// If the multishipping mode is on, check the box "I want to specify a delivery address for each products I order.".
|
||||||
|
if (typeof(multishipping_mode) != 'undefined' && multishipping_mode)
|
||||||
|
$('#multishipping_mode_checkbox').click()
|
||||||
|
});
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
*
|
*
|
||||||
* @author PrestaShop SA <contact@prestashop.com>
|
* @author PrestaShop SA <contact@prestashop.com>
|
||||||
* @copyright 2007-2011 PrestaShop SA
|
* @copyright 2007-2011 PrestaShop SA
|
||||||
* @version Release: $Revision: 6594 $
|
* @version Release: $Revision: 7471 $
|
||||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||||
* International Registered Trademark & Property of PrestaShop SA
|
* International Registered Trademark & Property of PrestaShop SA
|
||||||
*}
|
*}
|
||||||
@@ -67,7 +67,6 @@
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
// <![CDATA[
|
// <![CDATA[
|
||||||
{if !$opc}
|
{if !$opc}
|
||||||
var baseDir = '{$base_dir_ssl}';
|
|
||||||
var orderProcess = 'order';
|
var orderProcess = 'order';
|
||||||
var currencySign = '{$currencySign|html_entity_decode:2:"UTF-8"}';
|
var currencySign = '{$currencySign|html_entity_decode:2:"UTF-8"}';
|
||||||
var currencyRate = '{$currencyRate|floatval}';
|
var currencyRate = '{$currencyRate|floatval}';
|
||||||
@@ -161,32 +160,44 @@
|
|||||||
{if !$opc}<h1>{l s='Addresses'}</h1>{else}<h2><span>1</span> {l s='Addresses'}</h2>{/if}
|
{if !$opc}<h1>{l s='Addresses'}</h1>{else}<h2><span>1</span> {l s='Addresses'}</h2>{/if}
|
||||||
|
|
||||||
{if !$opc}
|
{if !$opc}
|
||||||
{assign var='current_step' value='address'}
|
{assign var='current_step' value='address'}
|
||||||
{include file="$tpl_dir./order-steps.tpl"}
|
{include file="$tpl_dir./order-steps.tpl"}
|
||||||
{include file="$tpl_dir./errors.tpl"}
|
{include file="$tpl_dir./errors.tpl"}
|
||||||
|
|
||||||
<div class="address-form-multishipping">
|
{if !$multi_shipping && {Configuration::get('PS_ALLOW_MULTISHIPPING')}}
|
||||||
<a href="{$link->getPageLink('order', true, NULL, 'step=1&multi-shipping=1')}" title="{l s='Multi-shipping'}" class="button exclusive">
|
<div class="button_multishipping_mode" id="multishipping_mode_box">
|
||||||
{l s='Multi-shipping'}
|
<div class="title">{l s='Multi-shipping'}</div>
|
||||||
</a>
|
<div class="description">
|
||||||
</div>
|
<a href="{$link->getPageLink('order', true, NULL, 'step=1&multi-shipping=1')}"/>
|
||||||
|
{l s='Specify a delivery address for each products ordered.'}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
<form action="{$link->getPageLink($back_order_page, true)}" method="post">
|
<form action="{$link->getPageLink($back_order_page, true)}" method="post">
|
||||||
{else}
|
{else}
|
||||||
<div class="address-form-multishipping">
|
{if {Configuration::get('PS_ALLOW_MULTISHIPPING')}}
|
||||||
<a href="#" id="multishipping_mode" title="{l s='Multi-shipping'}" class="button exclusive" onclick="multishippingMode(this); return false;">
|
<div class="address-form-multishipping">
|
||||||
{l s='Multi-shipping'}
|
<div class="button_multishipping_mode" id="multishipping_mode_box">
|
||||||
</a>
|
<div class="title">{l s='Multi-shipping'}</div>
|
||||||
<a href="{$link->getPageLink('order-opc', true, NULL, 'ajax=1&multi-shipping=1&method=multishipping')}" id="link_multishipping_form" title="{l s='Choose the delivery addresses'}" class="button exclusive" style="display:none">
|
<div class="description">
|
||||||
{l s='Choose the delivery addresses'}
|
<input type="checkbox" id="multishipping_mode_checkbox" onchange="multishippingMode(this); return false;"/><label for="multishipping_mode_checkbox">{l s='I want to specify a delivery address for each products I order.'}</label>
|
||||||
</a>
|
</div>
|
||||||
<script type="text/javascript">
|
<div class="description_off">
|
||||||
{if $is_multi_address_delivery}
|
<a href="{$link->getPageLink('order-opc', true, NULL, 'ajax=1&multi-shipping=1&method=multishipping')}" id="link_multishipping_form" title="{l s='Choose the delivery addresses'}">
|
||||||
var multishipping_mode = true;
|
{l s='Specify a delivery address for each products.'}
|
||||||
{else}
|
</a>
|
||||||
var multishipping_mode = false;
|
</div>
|
||||||
{/if}
|
</div>
|
||||||
</script>
|
<script type="text/javascript">
|
||||||
</div>
|
{if $is_multi_address_delivery}
|
||||||
|
var multishipping_mode = true;
|
||||||
|
{else}
|
||||||
|
var multishipping_mode = false;
|
||||||
|
{/if}
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
<div id="opc_account" class="opc-main-block">
|
<div id="opc_account" class="opc-main-block">
|
||||||
<div id="opc_account-overlay" class="opc-overlay" style="display: none;"></div>
|
<div id="opc_account-overlay" class="opc-overlay" style="display: none;"></div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -1026,13 +1026,12 @@ p.cart_navigation .button_large { float: left }
|
|||||||
p.cart_navigation .exclusive,
|
p.cart_navigation .exclusive,
|
||||||
p.cart_navigation .exclusive_large,
|
p.cart_navigation .exclusive_large,
|
||||||
p.cart_navigation .exclusive_large_disabled { float: right }
|
p.cart_navigation .exclusive_large_disabled { float: right }
|
||||||
p.cart_navigation .multishipping-button { margin-right: 10px }
|
|
||||||
p.cart_navigation_extra {
|
p.cart_navigation_extra {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
width: auto
|
width: auto
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p.cart_navigation .multishipping-button { margin-right: 10px }
|
||||||
.address-form-multishipping { padding: 10px 0px; }
|
.address-form-multishipping { padding: 10px 0px; }
|
||||||
#multishipping_mode_box {
|
#multishipping_mode_box {
|
||||||
border: 1px solid #D0D3D8;
|
border: 1px solid #D0D3D8;
|
||||||
|
|||||||
Reference in New Issue
Block a user