// report bugfix from saving customization with combination
This commit is contained in:
@@ -559,5 +559,22 @@ class ProductControllerCore extends FrontController
|
|||||||
}
|
}
|
||||||
return $specific_prices;
|
return $specific_prices;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function postProcess()
|
||||||
|
{
|
||||||
|
if ($this->ajax)
|
||||||
|
{
|
||||||
|
if (Tools::isSubmit('submitCustomizedDatas'))
|
||||||
|
{
|
||||||
|
$this->pictureUpload($this->product, $this->context->cart);
|
||||||
|
$this->textRecord($this->product, $this->context->cart);
|
||||||
|
$this->formTargetFormat();
|
||||||
|
}
|
||||||
|
if (count($this->errors))
|
||||||
|
die(Tools::jsonEncode(array('hasErrors' => true, 'errors' => $this->errors)));
|
||||||
|
else
|
||||||
|
die(Tools::jsonEncode(array('hasErrors' => false, 'conf' => Tools::displayError('Customization saved successfully.'))));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -215,6 +215,12 @@ function emptyCustomizations()
|
|||||||
{
|
{
|
||||||
if(typeof(customizationFields) == 'undefined') return;
|
if(typeof(customizationFields) == 'undefined') return;
|
||||||
|
|
||||||
|
$('.customization_block .success').fadeOut(function(){
|
||||||
|
$(this).remove();
|
||||||
|
});
|
||||||
|
$('.customization_block .error').fadeOut(function(){
|
||||||
|
$(this).remove();
|
||||||
|
});
|
||||||
for (var i = 0; i < customizationFields.length; i++)
|
for (var i = 0; i < customizationFields.length; i++)
|
||||||
{
|
{
|
||||||
$('#' + customizationFields[i][0]).html('');
|
$('#' + customizationFields[i][0]).html('');
|
||||||
|
|||||||
@@ -493,8 +493,10 @@ var ajaxCart = {
|
|||||||
|
|
||||||
if (!hasAlreadyCustomizations)
|
if (!hasAlreadyCustomizations)
|
||||||
{
|
{
|
||||||
if (!product.hasAttributes) content += '<dd id="cart_block_combination_of_' + productId + '" class="hidden">';
|
if (!product.hasAttributes)
|
||||||
content += '<ul class="cart_block_customizations" id="customization_' + productId + '_' + productAttributeId + '">';
|
content += '<dd id="cart_block_combination_of_' + productId + '" class="hidden">';
|
||||||
|
if ($('#customization_' + productId + '_' + productAttributeId).val() == undefined)
|
||||||
|
content += '<ul class="cart_block_customizations" id="customization_' + productId + '_' + productAttributeId + '">';
|
||||||
}
|
}
|
||||||
|
|
||||||
$(product.customizedDatas).each(function(){
|
$(product.customizedDatas).each(function(){
|
||||||
@@ -502,7 +504,7 @@ var ajaxCart = {
|
|||||||
customizationId = parseInt(this.customizationId);
|
customizationId = parseInt(this.customizationId);
|
||||||
productAttributeId = typeof(product.idCombination) == 'undefined' ? 0 : parseInt(product.idCombination);
|
productAttributeId = typeof(product.idCombination) == 'undefined' ? 0 : parseInt(product.idCombination);
|
||||||
// If the customization is already displayed on the cart, no update's needed
|
// If the customization is already displayed on the cart, no update's needed
|
||||||
if($('#cart_block').find("div[id^=deleteCustomizableProduct_" + customizationId + "_]").length)
|
if ($("#deleteCustomizableProduct_" + customizationId + "_" + productId + "_" + productAttributeId).length)
|
||||||
return ('');
|
return ('');
|
||||||
content += '<li name="customization"><div class="deleteCustomizableProduct" id="deleteCustomizableProduct_' + customizationId + '_' + productId + '_' + (productAttributeId ? productAttributeId : '0') + '"><a rel="nofollow" class="ajax_cart_block_remove_link" href="' + baseDir + 'index.php?controller=cart&delete&id_product=' + productId + '&ipa=' + productAttributeId + '&id_customization=' + customizationId + '&token=' + static_token + '"> </a></div><span class="quantity-formated"><span class="quantity">' + parseInt(this.quantity) + '</span>x</span>';
|
content += '<li name="customization"><div class="deleteCustomizableProduct" id="deleteCustomizableProduct_' + customizationId + '_' + productId + '_' + (productAttributeId ? productAttributeId : '0') + '"><a rel="nofollow" class="ajax_cart_block_remove_link" href="' + baseDir + 'index.php?controller=cart&delete&id_product=' + productId + '&ipa=' + productAttributeId + '&id_customization=' + customizationId + '&token=' + static_token + '"> </a></div><span class="quantity-formated"><span class="quantity">' + parseInt(this.quantity) + '</span>x</span>';
|
||||||
|
|
||||||
|
|||||||
@@ -89,6 +89,13 @@ p {padding-bottom:20px}
|
|||||||
font-size:13px;
|
font-size:13px;
|
||||||
background:#ffffe0
|
background:#ffffe0
|
||||||
}
|
}
|
||||||
|
.success {
|
||||||
|
margin:0 0 10px 0;
|
||||||
|
padding:10px;
|
||||||
|
border:1px solid #5cff74;
|
||||||
|
font-size:13px;
|
||||||
|
background: #d3ffab
|
||||||
|
}
|
||||||
.error {
|
.error {
|
||||||
margin:0 0 10px 0;
|
margin:0 0 10px 0;
|
||||||
padding:10px;
|
padding:10px;
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ var combinations = new Array();
|
|||||||
var selectedCombination = new Array();
|
var selectedCombination = new Array();
|
||||||
var globalQuantity = new Number;
|
var globalQuantity = new Number;
|
||||||
var colors = new Array();
|
var colors = new Array();
|
||||||
|
var input_save_customized_datas = '';
|
||||||
|
|
||||||
//check if a function exists
|
//check if a function exists
|
||||||
function function_exists(function_name)
|
function function_exists(function_name)
|
||||||
@@ -548,6 +549,7 @@ $(document).ready(function()
|
|||||||
|
|
||||||
// Hide the customization submit button and display some message
|
// Hide the customization submit button and display some message
|
||||||
$('p#customizedDatas input').click(function() {
|
$('p#customizedDatas input').click(function() {
|
||||||
|
input_save_customized_datas = $('p#customizedDatas').html();
|
||||||
$('p#customizedDatas input').hide();
|
$('p#customizedDatas input').hide();
|
||||||
$('#ajax-loader').fadeIn();
|
$('#ajax-loader').fadeIn();
|
||||||
$('p#customizedDatas').append(uploading_in_progress);
|
$('p#customizedDatas').append(uploading_in_progress);
|
||||||
@@ -578,8 +580,50 @@ function saveCustomization()
|
|||||||
$('body select[id^="group_"]').each(function() {
|
$('body select[id^="group_"]').each(function() {
|
||||||
customAction = customAction.replace(new RegExp(this.id + '=\\d+'), this.id +'='+this.value);
|
customAction = customAction.replace(new RegExp(this.id + '=\\d+'), this.id +'='+this.value);
|
||||||
});
|
});
|
||||||
$('#customizationForm').attr('action', customAction);
|
|
||||||
$('#customizationForm').submit();
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: customAction,
|
||||||
|
data: 'ajax=true&'+$('#customizationForm').serialize(),
|
||||||
|
dataType: 'json',
|
||||||
|
async : true,
|
||||||
|
success: function(data) {
|
||||||
|
$('#customizedDatas').fadeOut();
|
||||||
|
$('#customizedDatas').html(input_save_customized_datas);
|
||||||
|
$('#customizedDatas').fadeIn();
|
||||||
|
if (!data.hasErrors)
|
||||||
|
{
|
||||||
|
$('#customizationForm').find('.error').fadeOut(function(){
|
||||||
|
$(this).remove();
|
||||||
|
});
|
||||||
|
// display a confirmation message
|
||||||
|
if ($('#customizationForm').find('.success').val() == undefined)
|
||||||
|
$('#customizationForm').prepend("<p class='success'>"+data.conf+"</p>");
|
||||||
|
else
|
||||||
|
$('#customizationForm.success').html("<p class='success'>"+data.conf+"</p>");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$('#customizationForm').find('.success').fadeOut(function(){
|
||||||
|
$(this).remove();
|
||||||
|
});
|
||||||
|
// display an error message
|
||||||
|
if ($('#customizationForm').find('.error').val() == undefined)
|
||||||
|
{
|
||||||
|
$('#customizationForm').prepend("<p class='error'></p>");
|
||||||
|
for (var i = 0; i < data.errors.length; i++)
|
||||||
|
$('#customizationForm .error').html($('#customizationForm .error').html()+data.errors[i]+"<br />");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$('#customizationForm .error').html('');
|
||||||
|
for (var i = 0; i < data.errors.length; i++)
|
||||||
|
$('#customizationForm .error').html($('#customizationForm .error').html()+data.errors[i]+"<br />");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function submitPublishProduct(url, redirect)
|
function submitPublishProduct(url, redirect)
|
||||||
|
|||||||
Reference in New Issue
Block a user