[+] CORE : now you can choose the redirect option when your product is disable

This commit is contained in:
vAugagneur
2012-12-03 14:13:50 +01:00
parent 12cb5316ee
commit ed3e0e1a58
14 changed files with 206 additions and 26 deletions
+30 -3
View File
@@ -763,9 +763,8 @@ product_tabs['Attachments'] = new function(){
product_tabs['Informations'] = new function(){
var self = this;
this.bindAvailableForOrder = function (){
$("#available_for_order").click(function(){
$("#available_for_order").click(function()
{
if ($(this).is(':checked') || ($('input[name=\'multishop_check[show_price]\']').lenght && !$('input[name=\'multishop_check[show_price]\']').prop('checked')))
{
$('#show_price').attr('checked', true);
@@ -776,6 +775,34 @@ product_tabs['Informations'] = new function(){
$('#show_price').attr('disabled', false);
}
});
if ($('#active_on').prop('checked'))
showRedirectProductOptions(false);
else
showRedirectProductOptions(true);
$('#redirect_type').change(function () {
redirectSelectChange();
});
$('#related_product_autocomplete_input')
.autocomplete('ajax_products_list.php?excludeIds='+id_product, {
minChars: 1,
autoFill: true,
max:20,
matchContains: true,
mustMatch:true,
scroll:false,
cacheLength:0,
formatItem: function(item) {
return item[0]+' - '+item[1];
}
}).result(function(e, i){
if(i != undefined)
addRelatedProduct(i[1], i[0]);
$(this).val('');
});
addRelatedProduct(id_product_redirected, product_name_redirected);
};
this.bindTagImage = function (){
+50
View File
@@ -571,6 +571,56 @@ function toggleDraftWarning(show)
$('.draft').show();
}
function showRedirectProductOptions(show)
{
if (show)
$('.redirect_product_options').fadeIn();
else
$('.redirect_product_options').fadeOut();
redirectSelectChange();
}
function redirectSelectChange()
{
if ($('#redirect_type :selected').val() == '404')
showRedirectProductSelectOptions(false);
else
showRedirectProductSelectOptions(true);
}
function addRelatedProduct(id_product_to_add, product_name)
{
if (!id_product_to_add || id_product == id_product_to_add)
return;
$('#related_product_name').html(product_name);
$('#related_product_name').parent('p').css('margin-top', 0);
$('input[name=id_product_redirected]').val(id_product_to_add);
$('#related_product_autocomplete_input').hide();
$('#related_product_remove').show();
}
function removeRelatedProduct()
{
$('#related_product_name').html(no_related_product);
$('#related_product_name').parent('p').css('margin-top', '0.5em');
$('input[name=id_product_redirected]').val(0);
$('#related_product_remove').hide();
$('#related_product_autocomplete_input').fadeIn();
}
function showRedirectProductSelectOptions(show)
{
if (show)
$('.redirect_product_options_product_choise').show();
else
{
$('.redirect_product_options_product_choise').hide();
removeRelatedProduct();
}
}
function showOptions(show)
{
if (show)