// Upgrade specific price deletion

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@13378 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
tDidierjean
2012-02-16 09:45:47 +00:00
parent f1cde3f661
commit 89c1909c66
3 changed files with 67 additions and 12 deletions
+39
View File
@@ -368,6 +368,36 @@ function toggleSpecificPrice()
});
}
/**
* Ajax call to delete a specific price
*
* @param ids
* @param token
* @param parent
*/
function deleteSpecificPrice(url, parent)
{
$.ajax({
url: url,
data: {
ajax: true
},
context: document.body,
dataType: 'json',
context: this,
async: false,
success: function(data) {
if (data.status == 'ok')
{
showSuccessMessage(data.message);
parent.remove();
}
else
showErrorMessage(data.message);
}
});
}
/**
* Execute a callback function when a specific tab has finished loading or right now if the tab is already loaded
*
@@ -402,5 +432,14 @@ $(document).ready(function() {
// Enable writing of the product name when the friendly url field in tab SEO is loaded
onTabLoad('Seo', enableProductName);
// Bind to show/hide new specific price form
onTabLoad('Prices', toggleSpecificPrice);
// Bind to delete specific price link
onTabLoad('Prices', function(){
$('#specific_prices_list').delegate('a[name="delete_link"]', 'click', function(){
deleteSpecificPrice(this.href, $(this).parents('tr'));
return false;
})
});
});