// Product tab objects refactoring
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@14499 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -40,8 +40,6 @@
|
||||
<br />
|
||||
<h4>{l s='Available quantities for sale'}</h4>
|
||||
<div class="separation"></div>
|
||||
|
||||
|
||||
{if $show_quantities == true}
|
||||
<div class="warn" id="available_quantity_ajax_msg" style="display: none;"></div>
|
||||
<div class="error" id="available_quantity_ajax_error_msg" style="display: none;"></div>
|
||||
@@ -191,183 +189,57 @@
|
||||
</ul>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="separation"></div>
|
||||
<h4>{l s='Availability settings'}</h4>
|
||||
<table cellpadding="5">
|
||||
{if !$ps_stock_management}
|
||||
<div class="separation"></div>
|
||||
<h4>{l s='Availability settings'}</h4>
|
||||
<table cellpadding="5">
|
||||
{if !$ps_stock_management}
|
||||
<tr>
|
||||
<td colspan="2">{l s='The stock management is disabled'}</td>
|
||||
</tr>
|
||||
{/if}
|
||||
{if !$has_attribute}
|
||||
<tr>
|
||||
<td colspan="2">{l s='The stock management is disabled'}</td>
|
||||
<td class="col-left"><label>{l s='Minimum quantity:'}</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
<input size="3" maxlength="6" name="minimal_quantity" id="minimal_quantity" type="text" value="{$product->minimal_quantity|default:1}" />
|
||||
<p class="preference_description">{l s='The minimum quantity to buy this product (set to 1 to disable this feature)'}</p>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Displayed text when in-stock:'}</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
{include file="controllers/products/input_text_lang.tpl"
|
||||
languages=$languages
|
||||
input_value=$product->available_now
|
||||
input_name='available_now'}
|
||||
<span class="hint" name="help_box">{l s='Forbidden characters:'} <>;=#{}<span class="hint-pointer"> </span></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Displayed text when allowed to be back-ordered:'}</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
{include file="controllers/products/input_text_lang.tpl"
|
||||
languages=$languages
|
||||
input_value=$product->available_later
|
||||
input_name='available_later'}
|
||||
<span class="hint" name="help_box">{l s='Forbidden characters:'} <>;=#{}<span class="hint-pointer"> </span></span>
|
||||
</td>
|
||||
</tr>
|
||||
{if !$countAttributes}
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Available date:'}</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
<input id="available_date" name="available_date" value="{$product->available_date}" class="datepicker"
|
||||
style="text-align: center;" type="text" />
|
||||
<p>{l s='The available date when this product is out of stock'}</p>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
{if !$has_attribute}
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Minimum quantity:'}</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
<input size="3" maxlength="6" name="minimal_quantity" id="minimal_quantity" type="text" value="{$product->minimal_quantity|default:1}" />
|
||||
<p class="preference_description">{l s='The minimum quantity to buy this product (set to 1 to disable this feature)'}</p>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Displayed text when in-stock:'}</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
{include file="controllers/products/input_text_lang.tpl"
|
||||
languages=$languages
|
||||
input_value=$product->available_now
|
||||
input_name='available_now'}
|
||||
<span class="hint" name="help_box">{l s='Forbidden characters:'} <>;=#{}<span class="hint-pointer"> </span></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Displayed text when allowed to be back-ordered:'}</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
{include file="controllers/products/input_text_lang.tpl"
|
||||
languages=$languages
|
||||
input_value=$product->available_later
|
||||
input_name='available_later'}
|
||||
<span class="hint" name="help_box">{l s='Forbidden characters:'} <>;=#{}<span class="hint-pointer"> </span></span>
|
||||
</td>
|
||||
</tr>
|
||||
{if !$countAttributes}
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Available date:'}</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
<input id="available_date" name="available_date" value="{$product->available_date}" class="datepicker"
|
||||
style="text-align: center;" type="text" />
|
||||
<p>{l s='The available date when this product is out of stock'}</p>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
</table>
|
||||
</table>
|
||||
|
||||
<script type="text/javascript">
|
||||
$('.datepicker').datepicker({
|
||||
prevText: '',
|
||||
nextText: '',
|
||||
dateFormat: 'yy-mm-dd'
|
||||
});
|
||||
|
||||
var showAjaxError = function(msg)
|
||||
{
|
||||
$('#available_quantity_ajax_error_msg').html(msg);
|
||||
$('#available_quantity_ajax_error_msg').show();
|
||||
$('#available_quantity_ajax_msg').hide();
|
||||
$('#available_quantity_ajax_success_msg').hide();
|
||||
};
|
||||
|
||||
var showAjaxSuccess = function(msg)
|
||||
{
|
||||
$('#available_quantity_ajax_success_msg').html(msg);
|
||||
$('#available_quantity_ajax_error_msg').hide();
|
||||
$('#available_quantity_ajax_msg').hide();
|
||||
$('#available_quantity_ajax_success_msg').show();
|
||||
};
|
||||
|
||||
var showAjaxMsg = function(msg)
|
||||
{
|
||||
$('#available_quantity_ajax_msg').html(msg);
|
||||
$('#available_quantity_ajax_error_msg').hide();
|
||||
$('#available_quantity_ajax_msg').show();
|
||||
$('#available_quantity_ajax_success_msg').hide();
|
||||
};
|
||||
|
||||
var ajaxCall = function(data)
|
||||
{
|
||||
data.ajaxProductQuantity = 1;
|
||||
data.id_product = '{$product->id}';
|
||||
data.token = "{$token}";
|
||||
data.ajax = 1;
|
||||
data.controller = "AdminProducts";
|
||||
data.action = "productQuantity";
|
||||
showAjaxMsg('{l s='Saving data...'}');
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax-tab.php",
|
||||
data: data,
|
||||
dataType: 'json',
|
||||
async : true,
|
||||
success: function(msg)
|
||||
{
|
||||
if (msg.error)
|
||||
{
|
||||
showAjaxError(msg.error);
|
||||
return;
|
||||
}
|
||||
showAjaxSuccess('{l s='Data saved'}');
|
||||
},
|
||||
error: function(msg)
|
||||
{
|
||||
showAjaxError(msg.error);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var refreshQtyAvaibilityForm = function()
|
||||
{
|
||||
if ($('#depends_on_stock_0').attr('checked'))
|
||||
{
|
||||
$('.available_quantity').find('input').show();
|
||||
$('.available_quantity').find('span').hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
$('.available_quantity').find('input').hide();
|
||||
$('.available_quantity').find('span').show();
|
||||
}
|
||||
};
|
||||
|
||||
$('.depends_on_stock').click(function(e)
|
||||
{
|
||||
refreshQtyAvaibilityForm();
|
||||
ajaxCall( { actionQty: 'depends_on_stock', value: $(this).val() } );
|
||||
if($(this).val() == 0)
|
||||
$('.available_quantity input').trigger('change');
|
||||
});
|
||||
|
||||
$('.advanced_stock_management').click(function(e)
|
||||
{
|
||||
var val = 0;
|
||||
if ($(this).attr('checked'))
|
||||
val = 1;
|
||||
|
||||
ajaxCall( { actionQty: 'advanced_stock_management', value: val } );
|
||||
if (val == 1)
|
||||
{
|
||||
$(this).val(1);
|
||||
$('#depends_on_stock_1').attr('disabled', false);
|
||||
}
|
||||
else
|
||||
{
|
||||
$(this).val(0);
|
||||
$('#depends_on_stock_1').attr('disabled', true);
|
||||
$('#depends_on_stock_0').attr('checked', true);
|
||||
ajaxCall( { actionQty: 'depends_on_stock', value: 0} );
|
||||
refreshQtyAvaibilityForm();
|
||||
}
|
||||
refreshQtyAvaibilityForm();
|
||||
});
|
||||
|
||||
// bind enter key event on search field
|
||||
$('.available_quantity').find('input').bind('keypress', function(e) {
|
||||
var code = (e.keyCode ? e.keyCode : e.which);
|
||||
if(code == 13) { //Enter keycode
|
||||
e.stopPropagation();//Stop event propagation
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$('.available_quantity').find('input').change(function(e, init_val)
|
||||
{
|
||||
ajaxCall( { actionQty: 'set_qty', id_product_attribute: $(this).parent().attr('id').split('_')[1], value: $(this).val() } );
|
||||
});
|
||||
|
||||
$('.out_of_stock').click(function(e)
|
||||
{
|
||||
refreshQtyAvaibilityForm();
|
||||
ajaxCall( { actionQty: 'out_of_stock', value: $(this).val() } );
|
||||
});
|
||||
|
||||
refreshQtyAvaibilityForm();
|
||||
var quantities_ajax_success = '{l s='Data saved'}';
|
||||
var quantities_ajax_waiting = '{l s='Saving data...'}';
|
||||
</script>
|
||||
|
||||
{/if}
|
||||
+210
-67
@@ -27,8 +27,9 @@
|
||||
// The ProductTabsManager instance will make sure the onReady() methods of each tabs are executed once the tab has loaded
|
||||
var product_tabs = [];
|
||||
|
||||
product_tabs['Combinations'] = {
|
||||
'bindEdit' : function(){
|
||||
product_tabs['Combinations'] = new function(){
|
||||
var self = this;
|
||||
this.bindEdit = function(){
|
||||
$('table[name=list_table]').delegate('a.edit', 'click', function(e){
|
||||
e.preventDefault();
|
||||
editProductAttribute(this.href, $(this).closest('tr'));
|
||||
@@ -120,8 +121,9 @@ product_tabs['Combinations'] = {
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
'bindDefault' : function(){
|
||||
};
|
||||
|
||||
this.bindDefault = function(){
|
||||
$('table[name=list_table]').delegate('a.default', 'click', function(e){
|
||||
e.preventDefault();
|
||||
defaultProductAttribute(this.href, $(this).closest('tr'));
|
||||
@@ -161,8 +163,9 @@ product_tabs['Combinations'] = {
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
'bindDelete' : function() {
|
||||
};
|
||||
|
||||
this.bindDelete = function() {
|
||||
$('table[name=list_table]').delegate('a.delete', 'click', function(e){
|
||||
e.preventDefault();
|
||||
deleteProductAttribute(this.href, $(this).closest('tr'));
|
||||
@@ -191,8 +194,9 @@ product_tabs['Combinations'] = {
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
'bindToggleAddCombination' : function (){
|
||||
};
|
||||
|
||||
this.bindToggleAddCombination = function (){
|
||||
$('#desc-product-newCombination').click(function() {
|
||||
if ($('.process-icon-newCombination').hasClass('toolbar-new'))
|
||||
removeButtonCombination('add');
|
||||
@@ -217,13 +221,14 @@ product_tabs['Combinations'] = {
|
||||
$('#desc-product-newCombination div').html(msg_new_combination);
|
||||
}
|
||||
});
|
||||
},
|
||||
'onReady' : function(){
|
||||
product_tabs['Combinations'].bindEdit();
|
||||
product_tabs['Combinations'].bindDefault();
|
||||
product_tabs['Combinations'].bindDelete();
|
||||
product_tabs['Combinations'].bindToggleAddCombination();
|
||||
}
|
||||
};
|
||||
|
||||
this.onReady = function(){
|
||||
self.bindEdit();
|
||||
self.bindDefault();
|
||||
self.bindDelete();
|
||||
self.bindToggleAddCombination();
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -322,19 +327,22 @@ function handleSaveButtonsForPack()
|
||||
return "";
|
||||
}
|
||||
|
||||
product_tabs['Seo'] = {
|
||||
product_tabs['Seo'] = new function(){
|
||||
var self = this;
|
||||
// Enable writing of the product name when the friendly url field in tab SEO is loaded
|
||||
'enableProductName' : function (){
|
||||
this.enableProductName = function (){
|
||||
$('.copy2friendlyUrl').removeAttr('disabled');
|
||||
},
|
||||
'onReady' : function() {
|
||||
product_tabs['Seo'].enableProductName();
|
||||
}
|
||||
};
|
||||
|
||||
this.onReady = function() {
|
||||
self.enableProductName();
|
||||
};
|
||||
}
|
||||
|
||||
product_tabs['Prices'] = {
|
||||
product_tabs['Prices'] = new function(){
|
||||
var self = this;
|
||||
// Bind to show/hide new specific price form
|
||||
'toggleSpecificPrice' : function (){
|
||||
this.toggleSpecificPrice = function (){
|
||||
$('#show_specific_price').click(function()
|
||||
{
|
||||
$('#add_specific_price').slideToggle();
|
||||
@@ -355,7 +363,8 @@ product_tabs['Prices'] = {
|
||||
$('#show_specific_price').show();
|
||||
return false;
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Ajax call to delete a specific price
|
||||
*
|
||||
@@ -363,7 +372,7 @@ product_tabs['Prices'] = {
|
||||
* @param token
|
||||
* @param parent
|
||||
*/
|
||||
'deleteSpecificPrice' : function (url, parent){
|
||||
this.deleteSpecificPrice = function (url, parent){
|
||||
$.ajax({
|
||||
url: url,
|
||||
data: {
|
||||
@@ -383,23 +392,26 @@ product_tabs['Prices'] = {
|
||||
showErrorMessage(data.message);
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
// Bind to delete specific price link
|
||||
'bindDelete' : function(){
|
||||
this.bindDelete = function(){
|
||||
$('#specific_prices_list').delegate('a[name="delete_link"]', 'click', function(e){
|
||||
e.preventDefault();
|
||||
product_tabs['Prices'].deleteSpecificPrice(this.href, $(this).parents('tr'));
|
||||
self.deleteSpecificPrice(this.href, $(this).parents('tr'));
|
||||
})
|
||||
},
|
||||
'onReady' : function(){
|
||||
product_tabs['Prices'].toggleSpecificPrice();
|
||||
product_tabs['Prices'].deleteSpecificPrice();
|
||||
product_tabs['Prices'].bindDelete();
|
||||
}
|
||||
};
|
||||
|
||||
this.onReady = function(){
|
||||
self.toggleSpecificPrice();
|
||||
self.deleteSpecificPrice();
|
||||
self.bindDelete();
|
||||
};
|
||||
}
|
||||
|
||||
product_tabs['Associations'] = {
|
||||
'initAccessoriesAutocomplete' : function (){
|
||||
product_tabs['Associations'] = new function(){
|
||||
var self = this;
|
||||
this.initAccessoriesAutocomplete = function (){
|
||||
$('#product_autocomplete_input')
|
||||
.autocomplete('ajax_products_list.php', {
|
||||
minChars: 1,
|
||||
@@ -428,11 +440,11 @@ product_tabs['Associations'] = {
|
||||
|
||||
return ids;
|
||||
}
|
||||
},
|
||||
};
|
||||
/**
|
||||
* Update the manufacturer select element with the list of existing manufacturers
|
||||
*/
|
||||
'getManufacturers' : function(){
|
||||
this.getManufacturers = function(){
|
||||
$.ajax({
|
||||
url: 'ajax-tab.php',
|
||||
cache: false,
|
||||
@@ -456,15 +468,17 @@ product_tabs['Associations'] = {
|
||||
$("select#id_manufacturer").replaceWith("<p id=\"id_manufacturer\">[TECHNICAL ERROR] ajaxProductManufacturers: "+textStatus+"</p>");
|
||||
}
|
||||
});
|
||||
},
|
||||
'onReady' : function(){
|
||||
product_tabs['Associations'].initAccessoriesAutocomplete();
|
||||
product_tabs['Associations'].getManufacturers();
|
||||
};
|
||||
|
||||
this.onReady = function(){
|
||||
self.initAccessoriesAutocomplete();
|
||||
self.getManufacturers();
|
||||
}
|
||||
}
|
||||
|
||||
product_tabs['Attachments'] = {
|
||||
'bindAttachmentEvents' : function (){
|
||||
product_tabs['Attachments'] = new function(){
|
||||
var self = this;
|
||||
this.bindAttachmentEvents = function (){
|
||||
$("#addAttachment").live('click', function() {
|
||||
$("#selectAttachment2 option:selected").each(function(){
|
||||
var val = $('#arrayAttachments').val();
|
||||
@@ -495,14 +509,16 @@ product_tabs['Attachments'] = {
|
||||
$(this).attr("selected", "selected");
|
||||
});
|
||||
});
|
||||
},
|
||||
'onReady' : function(){
|
||||
product_tabs['Attachments'].bindAttachmentEvents();
|
||||
}
|
||||
};
|
||||
|
||||
this.onReady = function(){
|
||||
self.bindAttachmentEvents();
|
||||
};
|
||||
}
|
||||
|
||||
product_tabs['Informations'] = {
|
||||
'bindAvailableForOrder' : function (){
|
||||
product_tabs['Informations'] = new function(){
|
||||
var self = this;
|
||||
this.bindAvailableForOrder = function (){
|
||||
$("#available_for_order").click(function(){
|
||||
if ($(this).is(':checked'))
|
||||
{
|
||||
@@ -514,8 +530,9 @@ product_tabs['Informations'] = {
|
||||
$('#show_price').attr('disabled', '');
|
||||
}
|
||||
});
|
||||
},
|
||||
'bindTagImage' : function (){
|
||||
};
|
||||
|
||||
this.bindTagImage = function (){
|
||||
function changeTagImage(){
|
||||
var smallImage = $('input[name=smallImage]:checked').attr('value');
|
||||
var leftRight = $('input[name=leftRight]:checked').attr('value');
|
||||
@@ -542,8 +559,9 @@ product_tabs['Informations'] = {
|
||||
i = 0;
|
||||
}
|
||||
});
|
||||
},
|
||||
'switchProductType' : function(){
|
||||
};
|
||||
|
||||
this.switchProductType = function(){
|
||||
if (product_type == product_type_pack)
|
||||
{
|
||||
$('#pack_product').attr('checked', 'checked');
|
||||
@@ -629,7 +647,7 @@ product_tabs['Informations'] = {
|
||||
// this handle the save button displays and warnings
|
||||
handleSaveButtons();
|
||||
});
|
||||
},
|
||||
};
|
||||
/*'setup_tinymce': function(){
|
||||
// change each by click to load only on click
|
||||
$(".autoload_rte").each(function(e){
|
||||
@@ -662,15 +680,16 @@ product_tabs['Informations'] = {
|
||||
});
|
||||
});
|
||||
},*/
|
||||
'onReady' : function(){
|
||||
product_tabs['Informations'].bindAvailableForOrder();
|
||||
product_tabs['Informations'].bindTagImage();
|
||||
product_tabs['Informations'].switchProductType();
|
||||
}
|
||||
this.onReady = function(){
|
||||
self.bindAvailableForOrder();
|
||||
self.bindTagImage();
|
||||
self.switchProductType();
|
||||
};
|
||||
}
|
||||
|
||||
product_tabs['Pack'] = {
|
||||
'bindPackEvents' : function (){
|
||||
product_tabs['Pack'] = new function(){
|
||||
var self = this;
|
||||
this.bindPackEvents = function (){
|
||||
if ($('#ppack').attr('checked'))
|
||||
{
|
||||
$('#ppack').attr('disabled', 'disabled');
|
||||
@@ -801,18 +820,142 @@ product_tabs['Pack'] = {
|
||||
ids = ids.replace(/\,$/,'');
|
||||
return ids;
|
||||
}
|
||||
},
|
||||
'onReady' : function(){
|
||||
product_tabs['Pack'].bindPackEvents();
|
||||
};
|
||||
|
||||
this.onReady = function(){
|
||||
self.bindPackEvents();
|
||||
}
|
||||
}
|
||||
|
||||
product_tabs['Features'] = {
|
||||
'onReady' : function(){
|
||||
product_tabs['Features'] = new function(){
|
||||
this.onReady = function(){
|
||||
displayFlags(languages, id_language, allowEmployeeFormLang);
|
||||
}
|
||||
}
|
||||
|
||||
product_tabs['Quantities'] = new function(){
|
||||
var self = this;
|
||||
this.ajaxCall = function(data){
|
||||
data.ajaxProductQuantity = 1;
|
||||
data.id_product = id_product;
|
||||
data.token = token;
|
||||
data.ajax = 1;
|
||||
data.controller = "AdminProducts";
|
||||
data.action = "productQuantity";
|
||||
showAjaxMsg(quantities_ajax_waiting);
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax-tab.php",
|
||||
data: data,
|
||||
dataType: 'json',
|
||||
async : true,
|
||||
success: function(msg)
|
||||
{
|
||||
if (msg.error)
|
||||
{
|
||||
showAjaxError(msg.error);
|
||||
return;
|
||||
}
|
||||
showAjaxSuccess(quantities_ajax_success);
|
||||
},
|
||||
error: function(msg)
|
||||
{
|
||||
showAjaxError(msg.error);
|
||||
}
|
||||
});
|
||||
|
||||
function showAjaxError(msg)
|
||||
{
|
||||
$('#available_quantity_ajax_error_msg').html(msg);
|
||||
$('#available_quantity_ajax_error_msg').show();
|
||||
$('#available_quantity_ajax_msg').hide();
|
||||
$('#available_quantity_ajax_success_msg').hide();
|
||||
}
|
||||
|
||||
function showAjaxSuccess(msg)
|
||||
{
|
||||
$('#available_quantity_ajax_success_msg').html(msg);
|
||||
$('#available_quantity_ajax_error_msg').hide();
|
||||
$('#available_quantity_ajax_msg').hide();
|
||||
$('#available_quantity_ajax_success_msg').show();
|
||||
}
|
||||
|
||||
function showAjaxMsg(msg)
|
||||
{
|
||||
$('#available_quantity_ajax_msg').html(msg);
|
||||
$('#available_quantity_ajax_error_msg').hide();
|
||||
$('#available_quantity_ajax_msg').show();
|
||||
$('#available_quantity_ajax_success_msg').hide();
|
||||
}
|
||||
};
|
||||
|
||||
this.refreshQtyAvailabilityForm = function()
|
||||
{
|
||||
if ($('#depends_on_stock_0').attr('checked'))
|
||||
{
|
||||
$('.available_quantity').find('input').show();
|
||||
$('.available_quantity').find('span').hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
$('.available_quantity').find('input').hide();
|
||||
$('.available_quantity').find('span').show();
|
||||
}
|
||||
};
|
||||
|
||||
this.onReady = function(){
|
||||
$('#available_date').datepicker({
|
||||
prevText: '',
|
||||
nextText: '',
|
||||
dateFormat: 'yy-mm-dd'
|
||||
});
|
||||
|
||||
$('.depends_on_stock').click(function(e)
|
||||
{
|
||||
self.refreshQtyAvailabilityForm();
|
||||
self.ajaxCall( { actionQty: 'depends_on_stock', value: $(this).val() } );
|
||||
if($(this).val() == 0)
|
||||
$('.available_quantity input').trigger('change');
|
||||
});
|
||||
|
||||
$('.advanced_stock_management').click(function(e)
|
||||
{
|
||||
var val = 0;
|
||||
if ($(this).attr('checked'))
|
||||
val = 1;
|
||||
|
||||
self.ajaxCall({actionQty: 'advanced_stock_management', value: val});
|
||||
if (val == 1)
|
||||
{
|
||||
$(this).val(1);
|
||||
$('#depends_on_stock_1').attr('disabled', false);
|
||||
}
|
||||
else
|
||||
{
|
||||
$(this).val(0);
|
||||
$('#depends_on_stock_1').attr('disabled', true);
|
||||
$('#depends_on_stock_0').attr('checked', true);
|
||||
self.ajaxCall({actionQty: 'depends_on_stock', value: 0});
|
||||
self.refreshQtyAvailabilityForm();
|
||||
}
|
||||
self.refreshQtyAvailabilityForm();
|
||||
});
|
||||
|
||||
$('.available_quantity').find('input').change(function(e, init_val)
|
||||
{
|
||||
self.ajaxCall({actionQty: 'set_qty', id_product_attribute: $(this).parent().attr('id').split('_')[1], value: $(this).val()});
|
||||
});
|
||||
|
||||
$('.out_of_stock').click(function(e)
|
||||
{
|
||||
self.refreshQtyAvailabilityForm();
|
||||
self.ajaxCall({actionQty: 'out_of_stock', value: $(this).val()});
|
||||
});
|
||||
|
||||
self.refreshQtyAvailabilityForm();
|
||||
};
|
||||
}
|
||||
|
||||
var tabs_manager = new ProductTabsManager();
|
||||
tabs_manager.setTabs(product_tabs);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user