// update tab "attributes" in smarty template + update action in list in ajax
This commit is contained in:
@@ -23,6 +23,115 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
function deleteProductAttribute(ids, token, parent)
|
||||
{
|
||||
var id = ids.split('||');
|
||||
$.ajax({
|
||||
url: 'index.php',
|
||||
data: {
|
||||
id_product: id[0],
|
||||
id_product_attribute: id[1],
|
||||
controller: 'AdminProducts',
|
||||
token: token,
|
||||
action: 'deleteProductAttribute',
|
||||
ajax: true
|
||||
},
|
||||
context: document.body,
|
||||
dataType: 'json',
|
||||
context: this,
|
||||
async: false,
|
||||
success: function(data) {
|
||||
if (data.status == 'ok')
|
||||
{
|
||||
showSuccessMessage(data.message);
|
||||
parent.hide();
|
||||
}
|
||||
else
|
||||
showErrorMessage(data.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function defaultProductAttribute(ids, token, parent)
|
||||
{
|
||||
var id = ids.split('||');
|
||||
$.ajax({
|
||||
url: 'index.php',
|
||||
data: {
|
||||
id_product: id[0],
|
||||
id_product_attribute: id[1],
|
||||
controller: 'AdminProducts',
|
||||
token: token,
|
||||
action: 'defaultProductAttribute',
|
||||
ajax: true
|
||||
},
|
||||
context: document.body,
|
||||
dataType: 'json',
|
||||
context: this,
|
||||
async: false,
|
||||
success: function(data) {
|
||||
if (data.status == 'ok')
|
||||
{
|
||||
showSuccessMessage(data.message);
|
||||
$('table.table').find('tr').each(function(){
|
||||
$(this).attr('style', '');
|
||||
});
|
||||
parent.find('a.default').hide();
|
||||
parent.css('background','#BDE5F8');
|
||||
}
|
||||
else
|
||||
showErrorMessage(data.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function editProductAttribute(ids, token)
|
||||
{
|
||||
var id = ids.split('||');
|
||||
$.ajax({
|
||||
url: 'index.php',
|
||||
data: {
|
||||
id_product: id[0],
|
||||
id_product_attribute: id[1],
|
||||
controller: 'AdminProducts',
|
||||
token: token,
|
||||
action: 'editProductAttribute',
|
||||
ajax: true
|
||||
},
|
||||
context: document.body,
|
||||
dataType: 'json',
|
||||
context: this,
|
||||
async: false,
|
||||
success: function(data) {
|
||||
$('#add_new_combination').show();
|
||||
console.log(data[0]);
|
||||
console.log(data[1]);
|
||||
for(i=0;i<data.length;i++)
|
||||
{
|
||||
$('#product_att_list').append('<option value='+data[i]['id_attribute']+' groupid='+data[i]['id_attribute_group']+'>'+data[i]['group_name']+' : '+data[i]['attribute_name']+'</option>');
|
||||
$('#attribute_reference').val(data[i]['reference']);
|
||||
$('#attribute_ean13').val(data[i]['ean13']);
|
||||
$('#attribute_upc').val(data[i]['upc']);
|
||||
$('#attribute_wholesale_price').val(Math.abs(data[i]['wholesale_price']));
|
||||
$('#attribute_price').val(Math.abs(data[i]['price']));
|
||||
$('#attribute_priceTI').val(data[i]['attribute_reference']);
|
||||
$('#attribute_weight').val(Math.abs(data[i]['weight']));
|
||||
$('#attribute_unity').val(Math.abs(data[i]['unit_price_impact']));
|
||||
if ($('#attribute_ecotax').length != 0)
|
||||
$('#attribute_ecotax').val(data[i]['ecotax']);
|
||||
$('#minimal_quantity').val(data[i]['minimal_quantity']);
|
||||
$('#attribute_minimal_quantity').val(data[i]['minimal_quantity']);
|
||||
$('#available_date').val(data[i]['available_date']);
|
||||
|
||||
if (data[i]['default_on'] == 1)
|
||||
$('#attribute_default').checked = true;
|
||||
else
|
||||
$('#attribute_default').checked = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function addPackItem()
|
||||
{
|
||||
if ($('#curPackItemId').val() == '' || $('#curPackItemName').val() == '')
|
||||
|
||||
Reference in New Issue
Block a user