diff --git a/classes/Tools.php b/classes/Tools.php index 2b9310b1d..492e3b209 100644 --- a/classes/Tools.php +++ b/classes/Tools.php @@ -2557,7 +2557,7 @@ exit; $fileAttachment = null; if (isset($_FILES[$input]['name']) && !empty($_FILES[$input]['name']) && !empty($_FILES[$input]['tmp_name'])) { - $fileAttachment['rename'] = uniqid(). self::strtolower(substr($_FILES[$input]['name'], -5)); + $fileAttachment['rename'] = uniqid(). Tools::strtolower(substr($_FILES[$input]['name'], -5)); $fileAttachment['content'] = file_get_contents($_FILES[$input]['tmp_name']); $fileAttachment['tmp_name'] = $_FILES[$input]['tmp_name']; $fileAttachment['name'] = $_FILES[$input]['name']; diff --git a/controllers/admin/AdminCarriersController.php b/controllers/admin/AdminCarriersController.php index b2120da5f..126134938 100644 --- a/controllers/admin/AdminCarriersController.php +++ b/controllers/admin/AdminCarriersController.php @@ -87,11 +87,7 @@ class AdminCarriersControllerCore extends AdminController 'is_free' => array( 'title' => $this->l('Free Shipping'), 'align' => 'center', - 'icon' => array( - 0 => 'disabled.gif', - 1 => 'enabled.gif', - 'default' => 'disabled.gif' - ), + 'active' => 'isFree', 'type' => 'bool', 'orderby' => false, 'width' => 150 @@ -534,6 +530,10 @@ class AdminCarriersControllerCore extends AdminController else $this->errors[] = Tools::displayError('You do not have permission to edit this.'); } + else if (isset($_GET['isFree'.$this->table])) + { + $this->processIsFree(); + } else { if ((Tools::isSubmit('submitDel'.$this->table) && in_array(Configuration::get('PS_CARRIER_DEFAULT'), Tools::getValue('carrierBox'))) @@ -566,6 +566,17 @@ class AdminCarriersControllerCore extends AdminController } } + public function processIsFree() + { + $carrier = new Carrier($this->id_object); + if (!Validate::isLoadedObject($carrier)) + $this->errors[] = Tools::displayError('An error occurred while updating carrier information.'); + $carrier->is_free = $carrier->is_free ? 0 : 1; + if (!$carrier->update()) + $this->errors[] = Tools::displayError('An error occurred while updating carrier information.'); + Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token); + } + /** * Overload the property $fields_value * diff --git a/controllers/admin/AdminModulesController.php b/controllers/admin/AdminModulesController.php index 5be50453c..f76c9133b 100644 --- a/controllers/admin/AdminModulesController.php +++ b/controllers/admin/AdminModulesController.php @@ -767,6 +767,11 @@ class AdminModulesControllerCore extends AdminController Tools::redirectAdmin('index.php?controller=adminmodules&configure='.Tools::getValue('module_name').'&token='.Tools::getValue('token').'&module_name='.Tools::getValue('module_name').$params); Tools::redirectAdmin(self::$currentIndex.'&conf='.$return.'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name.'&anchor=anchor'.ucfirst($module->name).(isset($modules_list_save) ? '&modules_list='.$modules_list_save : '').$params); } + + if(isset($_GET['update'])) + { + Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token.'&updated=1tab_module='.$module->tab.'&module_name='.$module->name.'&anchor=anchor'.ucfirst($module->name).(isset($modules_list_save) ? '&modules_list='.$modules_list_save : '').$params); + } } public function postProcess() @@ -1013,6 +1018,14 @@ class AdminModulesControllerCore extends AdminController // Browse modules list foreach ($modules as $km => $module) { + //Add succes message for one module update + if (Tools::getValue('updated') && Tools::getValue('module_name')) + { + if ($module->name === (string)Tools::getValue('module_name')) + $module_success[] = array('name' => $module->displayName, 'message' => array( + 0 => $this->l('Current version:').$module->version)); + } + //if we are in favorites view we only display installed modules if (Tools::getValue('select') == 'favorites' && !$module->id) { diff --git a/themes/default/js/cart-summary.js b/themes/default/js/cart-summary.js index 218faf25a..206e20737 100644 --- a/themes/default/js/cart-summary.js +++ b/themes/default/js/cart-summary.js @@ -76,7 +76,7 @@ function changeAddressDelivery(obj) if (new_id_address_delivery == old_id_address_delivery) return; - + if (new_id_address_delivery > 0) // Change the delivery address { $.ajax({ @@ -86,24 +86,24 @@ function changeAddressDelivery(obj) async: true, cache: false, dataType: 'json', - data: 'controller=cart&ajax=true&changeAddressDelivery=1&summary=1&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 - +'&allow_refresh=1', + data: 'controller=cart&ajax=true&changeAddressDelivery=1&summary=1&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 + + '&allow_refresh=1', success: function(jsonData) { if (typeof(jsonData.hasErrors) != 'undefined' && jsonData.hasErrors) { alert(jsonData.error); // Reset the old address - $('#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 + '_' + old_id_address_delivery).val(old_id_address_delivery); } else { // The product exist - if ($('#product_'+id_product+'_'+id_product_attribute+'_0_'+new_id_address_delivery).length) + if ($('#product_' + id_product + '_' + id_product_attribute + '_0_' + new_id_address_delivery).length) { updateCartSummary(jsonData.summary); if (window.ajaxCart != undefined) @@ -116,10 +116,10 @@ function changeAddressDelivery(obj) // @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(); + $('#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(); + $('.product_' + id_product + '_' + id_product_attribute + '_0_' + old_id_address_delivery).remove(); } if (window.ajaxCart != undefined) ajaxCart.updateCart(jsonData); @@ -142,7 +142,7 @@ function changeAddressDelivery(obj) // 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'); + var options = $('#select_address_delivery_' + id_product + '_' + id_product_attribute + '_' + old_id_address_delivery + ' option'); $.each(options, function(i) { // Check the address is not already used for a similare products if ($(options[i]).val() > 0 && $(options[i]).val() !== old_id_address_delivery && $('#product_' + id_product + '_' + id_product_attribute + '_0_' + $(options[i]).val()).length == 0) @@ -161,13 +161,13 @@ function changeAddressDelivery(obj) dataType: 'json', context: obj, data: 'controller=cart' - +'&ajax=true&duplicate=true&summary=true' - +'&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 - +'&allow_refresh=1', + + '&ajax=true&duplicate=true&summary=true' + + '&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 + + '&allow_refresh=1', success: function(jsonData) { if (jsonData.error) @@ -176,16 +176,16 @@ function changeAddressDelivery(obj) return; } - var line = $('#product_' + id_product+'_' + id_product_attribute + '_0_' + old_id_address_delivery); + 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]') + 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); + $('#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(); @@ -201,7 +201,6 @@ function changeAddressDelivery(obj) function updateAddressId(id_product, id_product_attribute, old_id_address_delivery, id_address_delivery, line) { - if (typeof(line) == 'undefined' || line.length == 0) line = $('#cart_summary tr[id^=product_' + id_product + '_' + id_product_attribute + '_0_], #cart_summary tr[id^=product_' + id_product + '_' + id_product_attribute + '_nocustom_]'); @@ -253,8 +252,8 @@ function updateQty(val, cart, el) if (exp.test(val) == true) { - var hidden = $(prefix+'input[name='+ id +'_hidden]').val(); - var input = $(prefix+'input[name='+ id +']').val(); + var hidden = $(prefix + 'input[name=' + id + '_hidden]').val(); + var input = $(prefix + 'input[name=' + id + ']').val(); var QtyToUp = parseInt(input) - parseInt(hidden); if (parseInt(QtyToUp) > 0) @@ -263,7 +262,7 @@ function updateQty(val, cart, el) downQuantity(id.replace('quantity_', ''), QtyToUp); } else - $(prefix+'input[name='+ id +']').val($(prefix+'input[name='+ id +'_hidden]').val()); + $(prefix + 'input[name=' + id + ']').val($(prefix + 'input[name=' + id + '_hidden]').val()); if (typeof(getCarrierListAndUpdate) !== 'undefined') getCarrierListAndUpdate(); @@ -292,13 +291,13 @@ function deleteProductFromSummary(id) cache: false, dataType: 'json', data: 'controller=cart' - +'&ajax=true&delete=true&summary=true' - +'&id_product='+productId - +'&ipa='+productAttributeId - +'&id_address_delivery='+id_address_delivery + + '&ajax=true&delete=true&summary=true' + + '&id_product='+productId + + '&ipa='+productAttributeId + + '&id_address_delivery='+id_address_delivery + ((customizationId !== 0) ? '&id_customization=' + customizationId : '') - +'&token=' + static_token - +'&allow_refresh=1', + + '&token=' + static_token + + '&allow_refresh=1', success: function(jsonData) { if (jsonData.hasError) @@ -333,7 +332,7 @@ function deleteProductFromSummary(id) } else { - $('#product_'+ id).fadeOut('slow', function() { + $('#product_' + id).fadeOut('slow', function() { $(this).remove(); cleanSelectAddressDelivery(); if (!customizationId) @@ -437,17 +436,17 @@ function upQuantity(id, qty) cache: false, dataType: 'json', data: 'controller=cart' - +'&ajax=true' - +'&add=true' - +'&getproductprice=true' - +'&summary=true' - +'&id_product=' + productId - +'&ipa=' + productAttributeId - +'&id_address_delivery=' + id_address_delivery + + '&ajax=true' + + '&add=true' + + '&getproductprice=true' + + '&summary=true' + + '&id_product=' + productId + + '&ipa=' + productAttributeId + + '&id_address_delivery=' + id_address_delivery + ((customizationId !== 0) ? '&id_customization=' + customizationId : '') - +'&qty=' + qty - +'&token=' + static_token - +'&allow_refresh=1', + + '&qty=' + qty + + '&token=' + static_token + + '&allow_refresh=1', success: function(jsonData) { if (jsonData.hasError) @@ -486,7 +485,7 @@ function upQuantity(id, qty) function downQuantity(id, qty) { - var val = $('input[name=quantity_'+id+']').val(); + var val = $('input[name=quantity_' + id + ']').val(); var newVal = val; if(typeof(qty) == 'undefined' || !qty) { @@ -511,7 +510,7 @@ function downQuantity(id, qty) if (typeof(ids[3]) !== 'undefined') id_address_delivery = parseInt(ids[3]); - if (newVal > 0 || $('#product_'+id+'_gift').length) + if (newVal > 0 || $('#product_' + id + '_gift').length) { $.ajax({ type: 'POST', @@ -521,18 +520,18 @@ function downQuantity(id, qty) cache: false, dataType: 'json', data: 'controller=cart' - +'&ajax=true' - +'&add=true' - +'&getproductprice=true' - +'&summary=true' - +'&id_product='+productId - +'&ipa='+productAttributeId - +'&id_address_delivery='+id_address_delivery - +'&op=down' + + '&ajax=true' + + '&add=true' + + '&getproductprice=true' + + '&summary=true' + + '&id_product='+productId + + '&ipa='+productAttributeId + + '&id_address_delivery='+id_address_delivery + + '&op=down' + ((customizationId !== 0) ? '&id_customization='+customizationId : '') - +'&qty='+qty - +'&token='+static_token - +'&allow_refresh=1', + + '&qty='+qty + + '&token='+static_token + + '&allow_refresh=1', success: function(jsonData) { if (jsonData.hasError) @@ -543,7 +542,7 @@ function downQuantity(id, qty) if(error !== 'indexOf') errors += $('
').html(jsonData.errors[error]).text() + "\n"; 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 { @@ -558,7 +557,7 @@ function downQuantity(id, qty) updateHookShoppingCartExtra(jsonData.HOOK_SHOPPING_CART_EXTRA); if (newVal == 0) - $('#product_'+id).hide(); + $('#product_' + id).hide(); if (typeof(getCarrierListAndUpdate) !== 'undefined') getCarrierListAndUpdate(); @@ -591,18 +590,18 @@ function updateCartSummary(json) $('div.error').fadeOut(); for (i=0;i 1 ? txtProducts : txtProduct)); + $('#summary_products_quantity').html(nbrProducts + ' ' + (nbrProducts > 1 ? txtProducts : txtProduct)); if (priceDisplayMethod !== 0) $('#total_product').html(formatCurrency(json.total_products, currencyFormat, currencySign, currencyBlank)); else @@ -772,8 +771,8 @@ function updateCustomizedDatas(json) for(var l in json[i][j][k]) { var quantity = json[i][j][k][l]['quantity']; - $('input[name=quantity_'+i+'_'+j+'_'+l+'_'+k+'_hidden]').val(quantity); - $('input[name=quantity_'+i+'_'+j+'_'+l+'_'+k+']').val(quantity); + $('input[name=quantity_' + i + '_' + j + '_' + l + '_' + k + '_hidden]').val(quantity); + $('input[name=quantity_' + i + '_' + j + '_' + l + '_' + k + ']').val(quantity); } } @@ -797,7 +796,7 @@ function refreshDeliveryOptions() carrier_id_list.pop(); var it = this; $(carrier_id_list).each(function() { - $(it).parent().find('input[value="'+this.toString()+'"]').change(); + $(it).parent().find('input[value="' + this.toString() + '"]').change(); }); } else @@ -820,9 +819,9 @@ $(document).ready(function() { async: true, cache: false, data: 'controller=cart&ajax=true&allowSeperatedPackage=true&value=' - +($(this).prop('checked') ? '1' : '0') - +'&token='+static_token - +'&allow_refresh=1', + + ($(this).prop('checked') ? '1' : '0') + + '&token='+static_token + + '&allow_refresh=1', success: function(jsonData) { if (typeof(getCarrierListAndUpdate) !== 'undefined') @@ -862,14 +861,14 @@ function updateExtraCarrier(id_delivery_option, id_address) cache: false, dataType : "json", data: 'ajax=true' - +'&method=updateExtraCarrier' - +'&id_address='+id_address - +'&id_delivery_option='+id_delivery_option - +'&token='+static_token - +'&allow_refresh=1', + + '&method=updateExtraCarrier' + + '&id_address='+id_address + + '&id_delivery_option='+id_delivery_option + + '&token='+static_token + + '&allow_refresh=1', success: function(jsonData) { - $('#HOOK_EXTRACARRIER_'+id_address).html(jsonData['content']); + $('#HOOK_EXTRACARRIER_' + id_address).html(jsonData['content']); } }); -} +} \ No newline at end of file diff --git a/themes/default/product-list.tpl b/themes/default/product-list.tpl index e734ab630..1d5a38a59 100644 --- a/themes/default/product-list.tpl +++ b/themes/default/product-list.tpl @@ -41,7 +41,7 @@ {$product.legend|escape:'htmlall':'UTF-8'} {if isset($product.new) && $product.new == 1}{l s='New'}{/if} -

{$product.name|truncate:35:'...'|escape:'htmlall':'UTF-8'}

+

{if isset($product.pack_quantity) && $product.pack_quantity}{$product.pack_quantity|intval|cat:' x '}{/if}{$product.name|truncate:35:'...'|escape:'htmlall':'UTF-8'}

{$product.description_short|strip_tags:'UTF-8'|truncate:360:'...'}

diff --git a/themes/default/product.tpl b/themes/default/product.tpl index 508639287..a9a3ed9e4 100644 --- a/themes/default/product.tpl +++ b/themes/default/product.tpl @@ -609,7 +609,7 @@ var fieldRequired = '{l s='Please fill in all the required fields before saving {if $field.type == 1}
  • - +
  • {counter} {/if}