History: API Tracker Update Demo
Preview of version: 5
Try this API Tracker Update Demo?itemId=2745
Copy to clipboard
$(".stockAdmin.minus, .stockAdmin.plus") .css("cursor", "pointer") .on( "click", function () { let itemId = location.href.match(/itemId=(\d+)/); if (itemId) { itemId = itemId[1]; } else { alert("No product id found"); return; } const $stockAdmin = $(".stockAdmin.number"); $stockAdmin.tikiModal(" "); let stock = $stockAdmin.text(); if ($(this).hasClass("minus")) { stock--; } else { stock++; } $.ajax( $.service("tracker", "update_item"), { type: 'POST', dataType: 'json', data: { fields: { productsStock: stock }, itemId: itemId, trackerId: 1 }, success: function (data) { if (!data) { alert("Oops, something went wrong, sorry"); } else { $stockAdmin.text(stock); } $(".stockAdmin.number").tikiModal(); } } ); return false; })