diff --git a/admin-dev/themes/default/template/controllers/groups/helpers/form/form.tpl b/admin-dev/themes/default/template/controllers/groups/helpers/form/form.tpl index acb52c2e8..7d2423cf1 100644 --- a/admin-dev/themes/default/template/controllers/groups/helpers/form/form.tpl +++ b/admin-dev/themes/default/template/controllers/groups/helpers/form/form.tpl @@ -106,63 +106,61 @@ if ($(this).attr('name') == 'category_reduction['+$('[name="id_category"]:checked').val()+']') { exist = true; - jAlert('{l s='This category already exists for this group.'}'); + jAlert('{l s='This category already exists for this group.' js='1'}'); return false; } - }); if (exist) return; $.ajax({ - type:"POST", - url: "ajax-tab.php", - async: true, - dataType: "json", - data : { - ajax: "1", - token: "{getAdminToken tab='AdminGroups'}", - controller: "AdminGroups", - action: "addCategoryReduction", - category_reduction: $('#category_reduction_fancybox').val() , - id_category: $('[name="id_category"]:checked').val() - }, - success : function(jsonData) + type:"POST", + url: "ajax-tab.php", + async: true, + dataType: "json", + data : { + ajax: "1", + token: "{getAdminToken tab='AdminGroups'}", + controller: "AdminGroups", + action: "addCategoryReduction", + category_reduction: $('#category_reduction_fancybox').val() , + id_category: $('[name="id_category"]:checked').val() + }, + success : function(jsonData) { + if (jsonData.hasError) { - if (jsonData.hasError) - { - var errors = ''; - for(error in jsonData.errors) - //IE6 bug fix - if(error != 'indexOf') - errors += jsonData.errors[error] + "\n"; - jAlert(errors); - } - else - { - $('#group_discount_category_table').append(''+jsonData.catPath+'{l s='Discount:'}'+jsonData.discount+'{l s='%'}'); - - var input_hidden = document.createElement("input"); - input_hidden.setAttribute('type', 'hidden'); - input_hidden.setAttribute('value', jsonData.discount); - input_hidden.setAttribute('name', 'category_reduction['+jsonData.id_category+']'); - input_hidden.setAttribute('class', 'category_reduction'); - - $('#group_discount_category_table tr#'+jsonData.id_category+' > td:last').append(input_hidden); - $.fancybox.close(); - } + var errors = ''; + for (error in jsonData.errors) + //IE6 bug fix + if (error != 'indexOf') + errors += $('
').html(jsonData.errors[error]).text() + "\n"; + jAlert(errors); } - }); + else + { + $('#group_discount_category_table').append(''+jsonData.catPath+'{l s='Discount:'}'+jsonData.discount+'{l s='%'}'); + + var input_hidden = document.createElement("input"); + input_hidden.setAttribute('type', 'hidden'); + input_hidden.setAttribute('value', jsonData.discount); + input_hidden.setAttribute('name', 'category_reduction['+jsonData.id_category+']'); + input_hidden.setAttribute('class', 'category_reduction'); + + $('#group_discount_category_table tr#'+jsonData.id_category+' > td:last').append(input_hidden); + $.fancybox.close(); + } + } + }); return false; } - function initFancyBox() - { - $('[name="id_category"]:checked').removeAttr('checked'); - collapseAllCategories(); - $('#category_reduction_fancybox').val('0.00'); - } + function initFancyBox() + { + $('[name="id_category"]:checked').removeAttr('checked'); + collapseAllCategories(); + $('#category_reduction_fancybox').val('0.00'); + }
{l s='Add a category discount'} diff --git a/admin-dev/themes/default/template/controllers/import/helpers/form/form.tpl b/admin-dev/themes/default/template/controllers/import/helpers/form/form.tpl index 7f270fa20..e148c0e97 100644 --- a/admin-dev/themes/default/template/controllers/import/helpers/form/form.tpl +++ b/admin-dev/themes/default/template/controllers/import/helpers/form/form.tpl @@ -50,14 +50,14 @@ console.log(truncateAuthorized); if (truncateAuthorized) { - if (!confirm('{l s='Are you sure that you would like to delete this' js=1}' + ' ' + $.trim($('#entity > option:selected').text().toLowerCase()) + '{l s='?' js=1}')) + if (!confirm('{l s='Are you sure that you would like to delete this' js=1}' + ' ' + $.trim($('#entity > option:selected').text().toLowerCase()) + '?')) { e.preventDefault(); } } else { - jAlert('{l s='You do not have permission to delete here. When the multistore is enabled, only a SuperAdmin can delete all items before an import.'}'); + jAlert('{l s='You do not have permission to delete here. When the multistore is enabled, only a SuperAdmin can delete all items before an import.' js='1'}'); return false; } } diff --git a/admin-dev/themes/default/template/controllers/request_sql/helpers/form/form.tpl b/admin-dev/themes/default/template/controllers/request_sql/helpers/form/form.tpl index d23e8c976..e4083836a 100644 --- a/admin-dev/themes/default/template/controllers/request_sql/helpers/form/form.tpl +++ b/admin-dev/themes/default/template/controllers/request_sql/helpers/form/form.tpl @@ -90,7 +90,7 @@ var table = $('#selectTables select').val(); if (!table) - jAlert("{l s='Please choose a table.'}"); + jAlert("{l s='Please choose a table.' js='1'}"); else AddRequestSql(table); }); diff --git a/admin-dev/themes/default/template/controllers/shop/helpers/list/list_action_delete.tpl b/admin-dev/themes/default/template/controllers/shop/helpers/list/list_action_delete.tpl index 197faa431..87d038a72 100644 --- a/admin-dev/themes/default/template/controllers/shop/helpers/list/list_action_delete.tpl +++ b/admin-dev/themes/default/template/controllers/shop/helpers/list/list_action_delete.tpl @@ -24,9 +24,9 @@ *} {$action} \ No newline at end of file diff --git a/admin-dev/themes/default/template/controllers/supply_orders/helpers/form/form.tpl b/admin-dev/themes/default/template/controllers/supply_orders/helpers/form/form.tpl index 79f38f94b..9372654b7 100644 --- a/admin-dev/themes/default/template/controllers/supply_orders/helpers/form/form.tpl +++ b/admin-dev/themes/default/template/controllers/supply_orders/helpers/form/form.tpl @@ -138,7 +138,7 @@ // check if it's possible to add the product if (product_infos == null || $('#cur_product_name').val() == '') { - jAlert('{l s='Please select at least one product.'}'); + jAlert('{l s='Please select at least one product.' js='1'}'); return false; } diff --git a/classes/db/DbMySQLi.php b/classes/db/DbMySQLi.php index e03974a38..e89d59ccc 100644 --- a/classes/db/DbMySQLi.php +++ b/classes/db/DbMySQLi.php @@ -181,7 +181,7 @@ class DbMySQLiCore extends Db $value = 'InnoDB'; $sql = 'SHOW VARIABLES WHERE Variable_name = \'have_innodb\''; - $result = $link->query($sql); + $result = $this->link->query($sql); if (!$result) $value = 'MyISAM'; $row = $result->fetch_assoc(); @@ -190,7 +190,7 @@ class DbMySQLiCore extends Db /* MySQL >= 5.6 */ $sql = 'SHOW ENGINES'; - $result = $link->query($sql); + $result = $this->link->query($sql); while ($row = $result->fetch_assoc()) if ($row['Engine'] == 'InnoDB') { diff --git a/classes/db/DbPDO.php b/classes/db/DbPDO.php index 9a381d721..7c6a43977 100644 --- a/classes/db/DbPDO.php +++ b/classes/db/DbPDO.php @@ -215,7 +215,7 @@ class DbPDOCore extends Db $value = 'InnoDB'; $sql = 'SHOW VARIABLES WHERE Variable_name = \'have_innodb\''; - $result = $link->query($sql); + $result = $this->link->query($sql); if (!$result) $value = 'MyISAM'; $row = $result->fetch(); @@ -224,7 +224,7 @@ class DbPDOCore extends Db /* MySQL >= 5.6 */ $sql = 'SHOW ENGINES'; - $result = $link->query($sql); + $result = $this->link->query($sql); while ($row = $result->fetch()) if ($row['Engine'] == 'InnoDB') { diff --git a/controllers/front/ContactController.php b/controllers/front/ContactController.php index 8098ad0ee..f32311554 100644 --- a/controllers/front/ContactController.php +++ b/controllers/front/ContactController.php @@ -170,6 +170,7 @@ class ContactControllerCore extends FrontController '{attached_file}' => '-', '{message}' => Tools::nl2br(stripslashes($message)), '{email}' => $from, + '{product_name}' => '', ); if (isset($filename)) @@ -177,6 +178,8 @@ class ContactControllerCore extends FrontController $id_order = (int)Tools::getValue('id_order'); + $id_product = (int)Tools::getValue('id_product'); + if (isset($ct) && Validate::isLoadedObject($ct)) { if ($ct->id_order) @@ -193,6 +196,13 @@ class ContactControllerCore extends FrontController $var_list['{id_order}'] = $id_order; } + if ($id_product) + { + $product = new Product((int)$id_product); + if (Validate::isLoadedObject($product) && isset($product->name[Context::getContext()->language->id])) + $var_list['{product_name}'] = $product->name[Context::getContext()->language->id]; + } + if (empty($contact->email)) Mail::Send($this->context->language->id, 'contact_form', $subject, $var_list, $from, null, null, null, $fileAttachment); else diff --git a/install-dev/upgrade/sql/1.5.0.0.sql b/install-dev/upgrade/sql/1.5.0.0.sql index ee3f806ad..04d5ec9e5 100755 --- a/install-dev/upgrade/sql/1.5.0.0.sql +++ b/install-dev/upgrade/sql/1.5.0.0.sql @@ -92,7 +92,6 @@ UPDATE PREFIX_stock_mvt sm SET sm.id_stock = IFNULL(( WHERE s.id_product = sm.id_product AND s.id_product_attribute = sm.id_product_attribute ORDER BY s.id_shop - LIMIT 1 ), 0); DELETE FROM PREFIX_stock_mvt WHERE id_stock = 0; ALTER TABLE PREFIX_stock_mvt DROP id_product, DROP id_product_attribute; diff --git a/js/admin_order.js b/js/admin_order.js index 098d83e59..f2305948b 100644 --- a/js/admin_order.js +++ b/js/admin_order.js @@ -470,8 +470,7 @@ function init() cache: false, dataType: 'json', data : query, - success : function(data) - { + success : function(data) { if (data.result) { go = false; @@ -491,8 +490,7 @@ function init() else jAlert(data.error); }, - error : function(XMLHttpRequest, textStatus, errorThrown) - { + error : function(XMLHttpRequest, textStatus, errorThrown) { jAlert("Impossible to add the product to the cart.\n\ntextStatus: '" + textStatus + "'\nerrorThrown: '" + errorThrown + "'\nresponseText:\n" + XMLHttpRequest.responseText); } }); diff --git a/js/hookLiveEdit.js b/js/hookLiveEdit.js index b7b7b1239..1cd67129e 100644 --- a/js/hookLiveEdit.js +++ b/js/hookLiveEdit.js @@ -161,7 +161,7 @@ function getHookableList() { var errors = ''; for (error in jsonData.errors) //IE6 bug fix if (error != 'indexOf') - errors += jsonData.errors[error] + "\n"; + errors += $('
').html(jsonData.errors[error]).text() + "\n"; alert(errors); } else diff --git a/mails/en/contact_form.html b/mails/en/contact_form.html index 67ee471ca..e7c9018b2 100644 --- a/mails/en/contact_form.html +++ b/mails/en/contact_form.html @@ -20,7 +20,7 @@   -Your message has been sent successfully.

Message: {message}

Order ID : {order_name}

Attached file : {attached_file} +Your message has been sent successfully.

Message: {message}

Order ID : {order_name}

Product : {product_name}

Attached file : {attached_file}   diff --git a/modules/blockcart/ajax-cart.js b/modules/blockcart/ajax-cart.js index df74b0c63..18d84db16 100644 --- a/modules/blockcart/ajax-cart.js +++ b/modules/blockcart/ajax-cart.js @@ -446,7 +446,7 @@ var ajaxCart = { var name = (this.name.length > 12 ? this.name.substring(0, 10) + '...' : this.name); content += '' + name + ''; - if (parseFloat(this.price_float) > 0) + if (this.is_gift != undefined && this.is_gift == 1) content += ' '; else content += ''; @@ -568,10 +568,10 @@ var ajaxCart = { if (jsonData.hasError) { var errors = ''; - for(error in jsonData.errors) + for (error in jsonData.errors) //IE6 bug fix - if(error != 'indexOf') - errors += jsonData.errors[error] + "\n"; + if (error != 'indexOf') + errors += $('
').html(jsonData.errors[error]).text() + "\n"; alert(errors); } else diff --git a/modules/blockcms/blockcms.php b/modules/blockcms/blockcms.php index 7b1cfac49..80fcb35e0 100755 --- a/modules/blockcms/blockcms.php +++ b/modules/blockcms/blockcms.php @@ -740,10 +740,38 @@ class BlockCms extends Module public function hookActionShopDataDuplication($params) { - Db::getInstance()->execute(' - INSERT IGNORE INTO '._DB_PREFIX_.'cms_block_shop (id_cms_block, id_shop) - SELECT id_cms_block, '.(int)$params['new_id_shop'].' - FROM '._DB_PREFIX_.'cms_block_shop - WHERE id_shop = '.(int)$params['old_id_shop']); + //get all cmd block to duplicate in new shop + $cms_blocks = Db::getInstance()->executeS(' + SELECT * FROM `'._DB_PREFIX_.'cms_block` cb + LEFT JOIN `'._DB_PREFIX_.'cms_block_shop` cbf + ON (cb.`id_cms_block` = cbf.`id_cms_block` AND cbf.`id_shop` = '.(int)$params['old_id_shop'].') '); + + if (count($cms_blocks)) + { + foreach ($cms_blocks as $cms_block) + { + Db::getInstance()->execute(' + INSERT IGNORE INTO '._DB_PREFIX_.'cms_block (`id_cms_block`, `id_cms_category`, `location`, `position`, `display_store`) + VALUES (NULL, '.(int)$cms_block['id_cms_category'].', '.(int)$cms_block['location'].', '.(int)$cms_block['position'].', '.(int)$cms_block['display_store'].');'); + + $id_block_cms = Db::getInstance()->Insert_ID(); + + Db::getInstance()->execute('INSERT IGNORE INTO '._DB_PREFIX_.'cms_block_shop (`id_cms_block`, `id_shop`) VALUES ('.(int)$id_block_cms.', '.(int)$params['new_id_shop'].');'); + + $langs = Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'cms_block_lang` WHERE `id_cms_block` = '.(int)$cms_block['id_cms_block']); + + foreach($langs as $lang) + Db::getInstance()->execute(' + INSERT IGNORE INTO `'._DB_PREFIX_.'cms_block_lang` (`id_cms_block`, `id_lang`, `name`) + VALUES ('.(int)$id_block_cms.', '.(int)$lang['id_lang'].', \''.pSQL($lang['name']).'\');'); + + $pages = Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'cms_block_page` WHERE `id_cms_block` = '.(int)$cms_block['id_cms_block']); + + foreach($pages as $page) + Db::getInstance()->execute(' + INSERT IGNORE INTO `'._DB_PREFIX_.'cms_block_page` (`id_cms_block_page`, `id_cms_block`, `id_cms`, `is_category`) + VALUES (NULL, '.(int)$id_block_cms.', '.(int)$page['id_cms'].', '.(int)$page['is_category'].');'); + } + } } } diff --git a/themes/default/js/cart-summary.js b/themes/default/js/cart-summary.js index 31c5c7df2..8c43483c9 100644 --- a/themes/default/js/cart-summary.js +++ b/themes/default/js/cart-summary.js @@ -454,7 +454,7 @@ function upQuantity(id, qty) for(var error in jsonData.errors) //IE6 bug fix if(error !== 'indexOf') - errors += jsonData.errors[error] + "\n"; + errors += $('
').html(jsonData.errors[error]).text() + "\n"; alert(errors); $('input[name=quantity_'+ id +']').val($('input[name=quantity_'+ id +'_hidden]').val()); } @@ -539,7 +539,7 @@ function downQuantity(id, qty) for(var error in jsonData.errors) //IE6 bug fix if(error !== 'indexOf') - errors += jsonData.errors[error] + "\n"; + errors += $('
').html(jsonData.errors[error]).text() + "\n"; alert(errors); $('input[name=quantity_'+ id +']').val($('input[name=quantity_'+ id +'_hidden]').val()); } diff --git a/themes/default/js/order-address.js b/themes/default/js/order-address.js index 567bd85e0..a9c29a6eb 100644 --- a/themes/default/js/order-address.js +++ b/themes/default/js/order-address.js @@ -121,7 +121,7 @@ function updateAddresses() for(var error in jsonData.errors) //IE6 bug fix if(error !== 'indexOf') - errors += jsonData.errors[error] + "\n"; + errors += $('
').html(jsonData.errors[error]).text() + "\n"; alert(errors); } }, diff --git a/themes/default/js/order-opc.js b/themes/default/js/order-opc.js index 88c1d2af3..de6686d66 100644 --- a/themes/default/js/order-opc.js +++ b/themes/default/js/order-opc.js @@ -93,7 +93,7 @@ function updateAddressSelection() for(var error in jsonData.errors) //IE6 bug fix if(error !== 'indexOf') - errors += jsonData.errors[error] + "\n"; + errors += $('
').html(jsonData.errors[error]).text() + "\n"; alert(errors); } else @@ -186,7 +186,7 @@ function getCarrierListAndUpdate() for(var error in jsonData.errors) //IE6 bug fix if(error !== 'indexOf') - errors += jsonData.errors[error] + "\n"; + errors += $('
').html(jsonData.errors[error]).text() + "\n"; alert(errors); } else @@ -236,7 +236,7 @@ function updateCarrierSelectionAndGift() for(var error in jsonData.errors) //IE6 bug fix if(error !== 'indexOf') - errors += jsonData.errors[error] + "\n"; + errors += $('
').html(jsonData.errors[error]).text() + "\n"; alert(errors); } else @@ -703,7 +703,7 @@ function bindInputs() for(var error in jsonData.errors) //IE6 bug fix if(error !== 'indexOf') - errors += jsonData.errors[error] + "\n"; + errors += $('
').html(jsonData.errors[error]).text() + "\n"; alert(errors); } else diff --git a/themes/default/mobile/js/opc.js b/themes/default/mobile/js/opc.js index 4f2c93825..9e550ed98 100644 --- a/themes/default/mobile/js/opc.js +++ b/themes/default/mobile/js/opc.js @@ -170,7 +170,7 @@ function bindInputs() for(var error in jsonData.errors) //IE6 bug fix if(error !== 'indexOf') - errors += jsonData.errors[error] + "\n"; + errors += $('
').html(jsonData.errors[error]).text() + "\n"; alert(errors); } else @@ -254,7 +254,7 @@ function updateCarrierSelectionAndGift() for(var error in jsonData.errors) //IE6 bug fix if(error !== 'indexOf') - errors += jsonData.errors[error] + "\n"; + errors += $('
').html(jsonData.errors[error]).text() + "\n"; alert(errors); } else