// Product Admin Controller : update toolbar + bugs fix

This commit is contained in:
dSevere
2011-11-22 19:17:41 +00:00
parent 051c7c69a4
commit e11de57be9
7 changed files with 71 additions and 42 deletions
@@ -39,9 +39,6 @@
<input type="text" name="zone_{$id_zone}" value="{$currentZone['account_number']}" />
</div>
{/foreach}
<div class="margin-form">
<input type="submit" class="button" name="submitAccountingDetails" />
</div>
</form>
<div style="text-align:left; font-size:11px;">
<i>{l s='Theses fields are used for the accounting export'}</i>
@@ -29,7 +29,7 @@
onchange="$('.custom_{$available_feature.id_feature}_').val('');">
<option value="0">---&nbsp;</option>
{foreach from=$available_feature.featureValues item=value}
<option value="{$value.id_feature_value}"{if $available_feature.current_item == $value.id_feature_value}selected="selected"{/if} >
<option value="{$value.id_feature_value}"{if $available_feature.current_item == $value.id_feature_value}selected="selected"{/if} >
{$value.value|truncate:40}&nbsp;
</option>
{/foreach}
@@ -37,7 +37,7 @@
</select>
{else}
<input type="hidden" name="feature_{$available_feature.id_feature}_value" value="0" />
<span style="font-size: 10px; color: #666;">{l s='N/A'} -
<span style="font-size: 10px; color: #666;">{l s='N/A'} -
<a href="{$link->getAdminLink('AdminFeatures')}&amp;addfeature_value&id_feature={$available_feature.id_feature}"
style="color: #666; text-decoration: underline;">{l s='Add pre-defined values first'}</a>
</span>
@@ -52,15 +52,10 @@
{/foreach}
</td>
</tr>
{foreachelse}
<tr><td colspan="3" style="text-align:center;">{l s='No features defined'}</td></tr>
{/foreach}
<tr>
<td style="height: 50px; text-align: center;" colspan="3">
<input type="submit" name="submitProductFeature" id="submitProductFeature" value="{l s='Save modifications'}" class="button" />
</td>
</tr>
</table>
<div class="separation"></div>
+41 -9
View File
@@ -48,16 +48,49 @@
</div>
</div>
<script type="text/javascript">
function showSaveButtons()
{
$('#desc-product-save').show();
$('#desc-product-save-and-stay').show();
}
function hideSaveButtons()
{
$('#desc-product-save').hide();
$('#desc-product-save-and-stay').hide();
}
var toload = new Array();
var pos_select = {$pos_select};
var tabs_toolbar_save_buttons = [];
{foreach $tabs_toolbar_save_buttons key=key item=value}
{if $value == true}
tabs_toolbar_save_buttons.push('{$key}');
{/if}
{/foreach}
$(document).ready(function(){
{* submenu binding *}
$(".tab-page").click(function(e){
e.preventDefault();
// currentId is the current producttab id
currentId = $(".productTabs a.selected").attr('id').substr(5);
// id is the wanted producttab id
id = $(this).attr('id').substr(5);
// Update submit button value
var split_position = id.indexOf('-') + 1;
var btn_name = id.substr(split_position);
$("#product_form_submit_btn").attr('name', 'submit'+btn_name);
// Show/hide save buttons
if (jQuery.inArray(btn_name, tabs_toolbar_save_buttons) != -1)
showSaveButtons();
else
hideSaveButtons();
if ($(this).attr("id") != $(".productTabs a.selected").attr('id'))
{
$(".tab-page").removeClass('selected');
@@ -72,7 +105,7 @@ $(document).ready(function(){
}
$("#product-tab-content-wait").show();
if ($("#product-tab-content-"+id).hasClass('not-loaded') || $(this).hasClass('selected'))
{
myurl = $(this).attr("href")+"&ajax=1";
@@ -94,7 +127,7 @@ $(document).ready(function(){
$("#link-"+id).addClass('selected');
}
$("#product-tab-content-wait").hide();
var languages = new Array();
if (id == 3)
populate_attrs();
@@ -135,7 +168,7 @@ $(document).ready(function(){
{
$("#is_virtual_file_product").hide();
$("#virtual_good_attributes").hide();
if (elt.checked)
{
$('#virtual_good').show('slow');
@@ -187,7 +220,7 @@ $(document).ready(function(){
}
}
);
}
}
function uploadFile2()
{
@@ -215,9 +248,9 @@ $(document).ready(function(){
$('#upload-confirmation2').html(
'<a class="link" href="get-file-admin.php?file='+msg+'&filename='+fileName+'">{l s='The file'}&nbsp;"' + fileName + '"&nbsp;{l s='has successfully been uploaded'}</a>' +
'<input type="hidden" id="virtual_product_filename_attribute" name="virtual_product_filename_attribute" value="' + msg + '" />');
$('#virtual_product_name_attribute').attr('value', fileName);
link = $("#delete_downloadable_product_attribute").attr('href');
$('#virtual_product_name_attribute').attr('value', fileName);
link = $("#delete_downloadable_product_attribute").attr('href');
$("#delete_downloadable_product_attribute").attr('href', link+"&file="+msg);
}
}
@@ -227,7 +260,7 @@ $(document).ready(function(){
//]]>
</script>
<form id="product_form" action="{$form_action}&amp;{$submit_action}=1" method="post" enctype="multipart/form-data" name="product">
<form id="product_form" action="{$form_action}" method="post" enctype="multipart/form-data" name="product">
<input type="hidden" name="id_product" value="{$id_product}" />
<input type="hidden" name="tabs" id="tabs" value="0" />
<div class="tab-pane" id="tabPane1">
@@ -256,7 +289,6 @@ $(document).ready(function(){
</div>
<input type="hidden" name="id_product_attribute" id="id_product_attribute" value="0" />
<input id="product_form_submit_btn" type="submit" value="{l s='Save'}" name="submitAdd{$table}" class="button" />
&nbsp;<input type="submit" value="{l s='Save and stay'}" name="submitAdd{$table}AndStay" class="button" />
</form>
</div>
<br/>
@@ -45,10 +45,6 @@
</tbody>
</table>
<p>&nbsp;</p>
<div class="margin-form">
<input type="submit" class="button" name="submitSuppliers" value="{l s='Update suppliers of this product'}"/>
</div>
<br />
<table cellpadding="5">
<tbody>
<tr>
@@ -93,11 +89,6 @@
{/foreach}
</div>
<p>&nbsp;</p>
<div class="margin-form">
<input type="submit" class="button" name="submitSupplierReferences" value="{l s='Update supplier reference(s)'}"/>
</div>
<script type="text/javascript">
$(function() {
var default_is_ok = false;
@@ -66,9 +66,6 @@
{/foreach}
</div>
<p>&nbsp;</p>
<div class="margin-form">
<input type="submit" class="button" name="submitProductWarehouses" value="{l s='Update warehouses locations'}" />
</div>
<script type="text/javascript">
$(function() {
+1 -1
View File
@@ -70,7 +70,7 @@
//override save and stay link label with submit button value
if (btn_submit.val().length > 0)
lbl_save_and_stay.html(btn_submit.val() + ' and stay');
lbl_save_and_stay.html(btn_submit.val() + " {l s='and stay'} ");
}
//hide standard submit button
+26 -9
View File
@@ -46,7 +46,22 @@ class AdminProductsControllerCore extends AdminController
'Quantities',
'Suppliers',
'Warehouses',
'Accounting');
'Accounting'
);
protected $tabs_toolbar_save_buttons = array(
'Informations' => true,
'Images' => true,
'Prices' => false,
'Combinations' => false,
'Features' => true,
'Customization' => false,
'Attachments' => true,
'Quantities' => false,
'Suppliers' => true,
'Warehouses' => true,
'Accounting' => true
);
public function __construct()
{
@@ -690,7 +705,7 @@ class AdminProductsControllerCore extends AdminController
}
/* Product features management */
else if (Tools::isSubmit('submitProductFeature'))
else if (Tools::isSubmit('submitFeatures') || Tools::isSubmit('submitFeaturesAndStay'))
{
if (!Feature::isFeatureActive())
return;
@@ -909,17 +924,16 @@ class AdminProductsControllerCore extends AdminController
else
$this->redirect_after = self::$currentIndex.'&'.$this->table.'Orderby=position&'.$this->table.'Orderway=asc&conf=5'.(($id_category = (!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1')) ? ('&id_category='.$id_category) : '').'&token='.Tools::getAdminTokenLite('AdminProducts');
}
else if (Tools::isSubmit('submitAccountingDetails'))
else if (Tools::isSubmit('submitAccounting') || Tools::isSubmit('submitAccountingAndStay'))
$this->postProcessFormAccounting();
//Manage suppliers
else if (Tools::isSubmit('submitSuppliers'))
else if (Tools::isSubmit('submitSuppliers') || Tools::isSubmit('submitSuppliersAndStay'))
$this->postProcessFormSuppliers();
//Manage suppliers
else if (Tools::isSubmit('submitSupplierReferences'))
$this->postProcessFormSupplierReferences();
//Manage warehouses
else if (Tools::isSubmit('submitProductWarehouses'))
else if (Tools::isSubmit('submitWarehouses') || Tools::isSubmit('submitWarehousesAndStay'))
{
$this->postProcessFormWarehouses();
}
parent::postProcess(true);
}
@@ -1587,7 +1601,7 @@ class AdminProductsControllerCore extends AdminController
foreach($this->available_tabs as $product_tab)
{
$product_tabs[$product_tab] = array(
'id' => ++$i,
'id' => ++$i.'-'.$product_tab,
'selected' => (strtolower($product_tab) == strtolower($action)),
// @todo $this->l() instead of product_tab
'name' => $product_tab,
@@ -1600,6 +1614,7 @@ class AdminProductsControllerCore extends AdminController
$this->tpl_form_vars['newproduct'] = 1;
$this->tpl_form_vars['product_tabs'] = $product_tabs;
$this->tpl_form_vars['tabs_toolbar_save_buttons'] = $this->tabs_toolbar_save_buttons;
}
@@ -1971,6 +1986,8 @@ class AdminProductsControllerCore extends AdminController
}
$this->confirmations[] = $this->l('Suppliers of the product have been updated');
$this->postProcessFormSupplierReferences();
}
}