From 58cb9344b1a2bb2f724533e63e23d2277706f657 Mon Sep 17 00:00:00 2001 From: tDidierjean Date: Thu, 15 Dec 2011 15:57:50 +0000 Subject: [PATCH] // Changes to manufacturers and accessories in BO product page --- .../themes/template/products/associations.tpl | 30 +++++++++-- .../themes/template/products/informations.tpl | 15 ------ controllers/admin/AdminProductsController.php | 19 ++----- js/admin-products.js | 53 ++++++++++--------- translations/fr/admin.php | 12 ++--- 5 files changed, 64 insertions(+), 65 deletions(-) diff --git a/admin-dev/themes/template/products/associations.tpl b/admin-dev/themes/template/products/associations.tpl index 9ae9ba45d..ccec5c19e 100644 --- a/admin-dev/themes/template/products/associations.tpl +++ b/admin-dev/themes/template/products/associations.tpl @@ -69,17 +69,17 @@
- + + +
+ + + +
-
-

- {l s='Begin typing the first letters of the product name, then select the product from the drop-down list:'} +

+

+ {l s='Begin typing the first letters of the product name, then select the product from the drop-down list'}

- +

{l s='(Do not forget to Save the product afterward)'}

@@ -93,6 +93,23 @@
+     + + {l s='Create'} {l s='Create'} + +
@@ -115,11 +132,14 @@ return item[1]+' - '+item[0]; } }).result(addAccessory); + $('#product_autocomplete_input').setOptions({ extraParams: { excludeIds : getAccessorieIds() } }); + + getManufacturers(); }); function getAccessorieIds() diff --git a/admin-dev/themes/template/products/informations.tpl b/admin-dev/themes/template/products/informations.tpl index 2eb960525..65b2bbcad 100644 --- a/admin-dev/themes/template/products/informations.tpl +++ b/admin-dev/themes/template/products/informations.tpl @@ -169,21 +169,6 @@ - - - -     - - {l s='Create'} {l s='Create'} - - -
{* [begin] pack product *} diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 34304f71c..c223cce0c 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -2430,11 +2430,14 @@ class AdminProductsControllerCore extends AdminController } $data->assign('accessories', $accessories); + $product->manufacturer_name = Manufacturer::getNameById($product->id_manufacturer); + $data->assign(array('default_category' => $default_category, 'selected_cat_ids' => implode(',', array_keys($selected_cat)), 'selected_cat' => $selected_cat, 'category_tree' => Helper::renderAdminCategorieTree($translations, $selected_cat, 'categoryBox', false, true), - 'product' => $product + 'product' => $product, + 'link' => $this->context->link )); $this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch(); @@ -2827,18 +2830,6 @@ class AdminProductsControllerCore extends AdminController $cover = Product::getCover($product->id); $this->_applyTaxToEcotax($product); - // Accessories block - $accessories = Product::getAccessoriesLight($this->context->language->id, $product->id); - - if ($post_accessories = Tools::getValue('inputAccessories')) - { - $post_accessories_tab = explode('-', Tools::getValue('inputAccessories')); - foreach ($post_accessories_tab as $accessory_id) - if (!$this->haveThisAccessory($accessory_id, $accessories) && $accessory = Product::getAccessoryById($accessory_id)) - $accessories[] = $accessory; - } - $data->assign('accessories', $accessories); - /* * Form for adding a virtual product like software, mp3, etc... */ @@ -2882,8 +2873,6 @@ class AdminProductsControllerCore extends AdminController if (!$product->id) $product->name['class'] .= ' copy2friendlyUrl'; - $product->manufacturer_name = Manufacturer::getNameById($product->id_manufacturer); - // @todo : initPack should not be called like this $this->initPack($product); diff --git a/js/admin-products.js b/js/admin-products.js index 2c338f90e..da1f52de6 100644 --- a/js/admin-products.js +++ b/js/admin-products.js @@ -297,6 +297,35 @@ function delPackItem(id) } }); } +/** + * Update the manufacturer select element with the list of existing manufacturers + */ +function getManufacturers() +{ + $.ajax({ + url: 'ajax-tab.php', + cache: false, + dataType: 'json', + data: { + ajaxProductManufacturers:"1", + ajax : '1', + token : token, + controller : 'AdminProducts', + action : 'productManufacturers' + }, + success: function(j) { + var options = $('select#id_manufacturer').html(); + if (j) + for (var i = 0; i < j.length; i++) + options += ''; + $("select#id_manufacturer").replaceWith(""); + }, + error: function(XMLHttpRequest, textStatus, errorThrown) + { + $("select#id_manufacturer").replaceWith("

[TECHNICAL ERROR] ajaxProductManufacturers: "+textStatus+"

"); + } + }); +} /* function autocomplete */ urlToCall = null; @@ -312,30 +341,6 @@ function getSelectedIds() $(document).ready(function() { updateCurrentText(); updateFriendlyURL(); - $.ajax({ - url: 'ajax-tab.php', - cache: false, - dataType: 'json', - data: { - ajaxProductManufacturers:"1", - ajax : '1', - token : token, - controller : 'AdminProducts', - action : 'productManufacturers', - }, - success: function(j) { - var options = $('select#id_manufacturer').html(); - if (j) - for (var i = 0; i < j.length; i++) - options += ''; - $("select#id_manufacturer").replaceWith(""); - }, - error: function(XMLHttpRequest, textStatus, errorThrown) - { - $("select#id_manufacturer").replaceWith("

[TECHNICAL ERROR] ajaxProductManufacturers: "+textStatus+"

"); - } - - }); $(function() { $('#curPackItemName') diff --git a/translations/fr/admin.php b/translations/fr/admin.php index b8a74885e..7cec8b8f2 100644 --- a/translations/fr/admin.php +++ b/translations/fr/admin.php @@ -540,7 +540,7 @@ $_LANGADM['AdminCms45b1bce0ceb1e155fc99d59a21761b9e'] = 'Contenu de la page'; $_LANGADM['AdminCms0099c0173a3c7758b36025bdae9b4fc7'] = 'Activé :'; $_LANGADM['AdminCmsb9f5c797ebbf55adccdd8539a65a0241'] = 'Désactivé'; $_LANGADM['AdminCms38fb7d24e0d60a048f540ecb18e13376'] = 'Enregistrer'; -$_LANGADM['AdminCmsf16b5952df8d25ea30b25ff95ee8fedf'] = 'Boutique associé'; +$_LANGADM['AdminCmsf16b5952df8d25ea30b25ff95ee8fedf'] = 'Boutique associée'; $_LANGADM['AdminCmscc4fbd30d676ea2f9994b7063a8ada15'] = 'Pages dans cette catégorie'; $_LANGADM['AdminCmsef61fb324d729c341ea8ab9901e23566'] = 'Créer'; $_LANGADM['AdminCms5ece607071fe59ddc4c88dc6abfe2310'] = 'Pas de page trouvée'; @@ -972,7 +972,7 @@ $_LANGADM['AdminScenes5ffd7a335dd836b3373f5ec570a58bdc'] = 'Tout développer'; $_LANGADM['AdminScenesd0f06038b6b3aa5edc07c7a6fd3ca3f9'] = 'Rechercher une catégorie'; $_LANGADM['AdminScenes8c38776925f7cf41c090646a43157024'] = 'Catégories:'; $_LANGADM['AdminScenesf5dae0e1b3d4bc66fadd2840b4f79227'] = 'Veuillez ajouter une image pour continuer'; -$_LANGADM['AdminScenesf16b5952df8d25ea30b25ff95ee8fedf'] = 'Boutique associé :'; +$_LANGADM['AdminScenesf16b5952df8d25ea30b25ff95ee8fedf'] = 'Boutique associée :'; $_LANGADM['AdminScenes997fd7aaabd538817e06ff1b3289bee3'] = 'Image à \"tagger\" :'; $_LANGADM['Helper0f86285516456595b59620181e9c689c'] = 'Groupe de boutiques'; $_LANGADM['Helper9f82518d468b9fee614fcc92f76bb163'] = 'Boutique'; @@ -1271,7 +1271,7 @@ $_LANGADM['AdminCurrenciesb9f5c797ebbf55adccdd8539a65a0241'] = 'Désactivé'; $_LANGADM['AdminCurrencies87bd3cbac63d9410fff1815181cb60cc'] = 'Espace :'; $_LANGADM['AdminCurrenciesd6b378c31ecfd51965a5a318e06af249'] = 'Inclus un espace entre le signe et le prix, ex :'; $_LANGADM['AdminCurrencies0099c0173a3c7758b36025bdae9b4fc7'] = 'Activé :'; -$_LANGADM['AdminCurrenciesf16b5952df8d25ea30b25ff95ee8fedf'] = 'Boutique associé'; +$_LANGADM['AdminCurrenciesf16b5952df8d25ea30b25ff95ee8fedf'] = 'Boutique associée'; $_LANGADM['AdminCurrencies38fb7d24e0d60a048f540ecb18e13376'] = 'Enregistrer'; $_LANGADM['AdminCurrencies795b18173b4ddc7ea79c606ccd0f3feb'] = 'Vous ne pouvez pas supprimer la devise par défaut'; $_LANGADM['AdminCurrenciese7e915ec26ac2be5f5730752e5fc3b78'] = 'Vous ne pouvez pas désactiver la devise par défaut'; @@ -1627,7 +1627,7 @@ $_LANGADM['AdminCountries5c7246a637866f706a8319f8f701497e'] = 'Affichage ou non $_LANGADM['AdminCountriescef82d41923398076fb06d463541d707'] = 'Contient des états :'; $_LANGADM['AdminCountries09545da0018af8fd4d2725858aa9b26d'] = 'Requiert un numéro d\'identification fiscale ?'; $_LANGADM['AdminCountries187dc89384a93e0bd008a5d1ec2339b6'] = 'Afficher le label de la taxe :'; -$_LANGADM['AdminCountriesf16b5952df8d25ea30b25ff95ee8fedf'] = 'Boutique associé'; +$_LANGADM['AdminCountriesf16b5952df8d25ea30b25ff95ee8fedf'] = 'Boutique associée'; $_LANGADM['AdminCountries38fb7d24e0d60a048f540ecb18e13376'] = 'Enregistrer'; $_LANGADM['AdminCountriesd88def0eb4ff593621b4113e1fc54965'] = 'Utiliser la dernière mise en page enregistrer'; $_LANGADM['AdminCountries6d869ac09b11028c6884152b08f52786'] = 'Utiliser une mise en page par défaut'; @@ -2256,7 +2256,7 @@ $_LANGADM['AdminCarriersa2fb5420f32b0749ad87318f82c0db2c'] = 'Comportement des t $_LANGADM['AdminCarriers482836cce404046ca7dc34fb0a6fc526'] = 'Prend la tranche la plus grande'; $_LANGADM['AdminCarriers4f890cf6a72112cad95093baecf39831'] = 'Désactiver le transporteur'; $_LANGADM['AdminCarriersa26f79d46b0719d8baa3a5a7c9abda74'] = 'Comportement à adopter lorsqu\'aucune tranche n\'est trouvée (exemple : le poids total du panier d\'un client est supérieur à la tranche la plus élevée que vous avez définie)'; -$_LANGADM['AdminCarriersf16b5952df8d25ea30b25ff95ee8fedf'] = 'Boutique associé'; +$_LANGADM['AdminCarriersf16b5952df8d25ea30b25ff95ee8fedf'] = 'Boutique associée'; $_LANGADM['AdminCarriers38fb7d24e0d60a048f540ecb18e13376'] = 'Enregistrer'; $_LANGADM['AdminCarriersf6308cfdf671a710ebff8ac860d3a406'] = 'Choisissez un nouveau transporteur par défaut avant de supprimer celui-ci'; $_LANGADM['AdminCartRulesd3b206d196cd6be3a2764c1fb90b200f'] = 'Supprimer la sélection'; @@ -3133,7 +3133,7 @@ $_LANGADM['AdminProductsc3543f3c6662fa1dedf70ed9c35053c0'] = 'Votre produit va $_LANGADM['AdminProductsf8825c9f08ff15b5ef6bc3a3898817e8'] = 'Enregistrer et prévisualiser'; $_LANGADM['AdminProducts0449f210068787074ce58175b1a2f5cf'] = 'Supprimer ce produit'; $_LANGADM['AdminProductsed75712b0eb1913c28a3872731ffd48d'] = 'Dupliquer'; -$_LANGADM['AdminProductsbe79f9c19dbf33fba980c3d9961bed6e'] = 'Pévisualiser'; +$_LANGADM['AdminProductsbe79f9c19dbf33fba980c3d9961bed6e'] = 'Prévisualiser'; $_LANGADM['AdminProducts3094af8ef1a9cd6080c00647a5fbfc61'] = 'Voir les ventes du produit'; $_LANGADM['AdminProductscc78b7c8486204f81b1298df02d6e035'] = 'Ajouter une nouvelle combinaison'; $_LANGADM['AdminProductsea4788705e6873b424c65e91c2846b19'] = 'Annuler';