I am trying to use the getStock function from Tea Commerce in jQuery, and every try returns null.
I tried to recreate the same thing on the Tea Commerce starter kit and this would do the same thing.
The steps I took to recreate the problem in the Tea Commerce starter kit:
Made a fresh starter kit website.
Edit the stock from product: 'Garda Classico Rosso' to 5. Also made sure the property type was the 'Tea Commerce: Stock management' type.
Made a change in the file ecommerce.js from line 1:
/*************************************************************
- SUBSCRIBE TO GENERAL EVENTS
*************************************************************/
TC.bind('beforeCartUpdated', function (formData, jQForm) {
var productStock = TC.getStock({storeId: 1, productIdentifier: '1249', async: false});
alert(productStock);
//Set elements in updating mode
setUpdatingElements(jQForm);
});
The productIdentifier is the product Garda Classico Rosso wich I mentioned above.
async is set to false(default is also false).
After adding a product to the cart, the browser will display the alert with the message: null.
In the FormPost.ashx Response it will display: 5,000000.
Thanks for looking into my problem. Will there be a new version for Tea Commerce 2 in which this bug is fixed? We have multiple web shops running and we would like to use this function.
Just tried with Tea Commerce 2.3.2 and the Javascript API works. Pass in the store id and the product identifier and it returns the stock. Check the DB for what SKU is saved with the stock for your product and the be sure it is the node id you use as the product identifer for your JS call.
jQuery getStock returning null
Hi.
I am trying to use the getStock function from Tea Commerce in jQuery, and every try returns null. I tried to recreate the same thing on the Tea Commerce starter kit and this would do the same thing.
The steps I took to recreate the problem in the Tea Commerce starter kit:
After adding a product to the cart, the browser will display the alert with the message: null. In the FormPost.ashx Response it will display: 5,000000.
Hi Michel
I think we fixed that in Tea Commerce 3 that is in development. Will have a check :)
Kind regards
Anders
Hi Anders,
Thanks for looking into my problem. Will there be a new version for Tea Commerce 2 in which this bug is fixed? We have multiple web shops running and we would like to use this function.
Thanks in advance!
Hi Michel
I think we will release a v2 with minor bugfixes.
Kind regards
Anders
Hi Michel
Can you try and use the Razor API and get the stock and see if that work. Just to see if it is the java script API or the .Net api that fails.
Thanks
Anders,
I tried this before with Razor and it worked fine, it was just the JavaScript getStock that didn't work.
Just tried with Tea Commerce 2.3.2 and the Javascript API works. Pass in the store id and the product identifier and it returns the stock. Check the DB for what SKU is saved with the stock for your product and the be sure it is the node id you use as the product identifer for your JS call.
Kind regards
Anders
is working on a reply...