// Changes to manufacturers and accessories in BO product page

This commit is contained in:
tDidierjean
2011-12-15 15:57:50 +00:00
parent 2a32862cd5
commit 58cb9344b1
5 changed files with 64 additions and 65 deletions
@@ -69,17 +69,17 @@
<div class="separation"></div>
<table>
<tr>
<td class="col-left"><label>{l s='Accessories:'}<br /><br /><i>{l s='(Do not forget to Save the product afterward)'}</i></label></td>
<td class="col-left"><label>{l s='Accessories:'}{*<br /><br /><i>{l s='(Do not forget to Save the product afterward)'}</i>*}</label></td>
<td style="padding-bottom:5px;">
<input type="hidden" name="inputAccessories" id="inputAccessories" value="{foreach from=$accessories item=accessory}{$accessory.id_product}-{/foreach}" />
<input type="hidden" name="nameAccessories" id="nameAccessories" value="{foreach from=$accessories item=accessory}{$accessory.name|htmlentitiesUTF8}¤{/foreach}" />
<div id="ajax_choose_product" style="padding:6px; padding-top:2px; width:600px;">
<p style="clear:both;margin-top:0;" class="preference_description">
{l s='Begin typing the first letters of the product name, then select the product from the drop-down list:'}
<div id="ajax_choose_product">
<p style="clear:both;margin-top:0;">
<input type="text" value="" id="product_autocomplete_input" />
{l s='Begin typing the first letters of the product name, then select the product from the drop-down list'}
</p>
<p class="preference_description">{l s='(Do not forget to Save the product afterward)'}</p>
<!--<img onclick="$(this).prev().search();" style="cursor: pointer;" src="../img/admin/add.gif" alt="{l s='Add an accessory'}" title="{l s='Add an accessory'}" />-->
</div>
<div id="divAccessories">
@@ -93,6 +93,23 @@
</div>
</td>
</tr>
<tr>
<br />
<td class="col-left"><label>{l s='Manufacturer:'}</label></td>
<td style="padding-bottom:5px;">
<select name="id_manufacturer" id="id_manufacturer">
<option value="0">-- {l s='Choose (optional)'} --</option>
{if $product->id_manufacturer}
<option value="{$product->id_manufacturer}" selected="selected">{$product->manufacturer_name}</option>
{/if}
<option disabled="disabled">----------</option>
</select>&nbsp;&nbsp;&nbsp;
<a href="{$link->getAdminLink('AdminManufacturers')}&addmanufacturer" onclick="return confirm('{l s='Are you sure you want to delete product information entered?' js=1} ')">
<img src="../img/admin/add.gif" alt="{l s='Create'}" title="{l s='Create'}" /> <b>{l s='Create'}</b>
</a>
</td>
</tr>
</table>
</div>
@@ -115,11 +132,14 @@
return item[1]+' - '+item[0];
}
}).result(addAccessory);
$('#product_autocomplete_input').setOptions({
extraParams: {
excludeIds : getAccessorieIds()
}
});
getManufacturers();
});
function getAccessorieIds()
@@ -169,21 +169,6 @@
</select>
</td>
</tr>
<tr>
<td class="col-left"><label>{l s='Manufacturer:'}</label></td>
<td style="padding-bottom:5px;">
<select name="id_manufacturer" id="id_manufacturer">
<option value="0">-- {l s='Choose (optional)'} --</option>
{if $product->id_manufacturer}
<option value="{$product->id_manufacturer}" selected="selected">{$product->manufacturer_name}</option>
{/if}
<option disabled="disabled">----------</option>
</select>&nbsp;&nbsp;&nbsp;
<a href="{$link->getAdminLink('AdminManufacturers')}&addmanufacturer" onclick="return confirm('{l s='Are you sure you want to delete product information entered?' js=1} ')">
<img src="../img/admin/add.gif" alt="{l s='Create'}" title="{l s='Create'}" /> <b>{l s='Create'}</b>
</a>
</td>
</tr>
</table>
<table cellpadding="5" cellspacing="0" border="0" style="width: 100%;"><tr><td><div class="separation"></div></td></tr></table>
{* [begin] pack product *}
+4 -15
View File
@@ -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);
+29 -24
View File
@@ -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 += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>';
$("select#id_manufacturer").replaceWith("<select id=\"id_manufacturer\">"+options+"</select>");
},
error: function(XMLHttpRequest, textStatus, errorThrown)
{
$("select#id_manufacturer").replaceWith("<p id=\"id_manufacturer\">[TECHNICAL ERROR] ajaxProductManufacturers: "+textStatus+"</p>");
}
});
}
/* 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 += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>';
$("select#id_manufacturer").replaceWith("<select id=\"id_manufacturer\">"+options+"</select>");
},
error: function(XMLHttpRequest, textStatus, errorThrown)
{
$("select#id_manufacturer").replaceWith("<p id=\"id_manufacturer\">[TECHNICAL ERROR] ajaxProductManufacturers: "+textStatus+"</p>");
}
});
$(function() {
$('#curPackItemName')
+6 -6
View File
@@ -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';