Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Michel Collard 44 posts 264 karma points c-trib
    Nov 13, 2014 @ 12:45
    Michel Collard
    2

    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:

    • 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.

  • Anders Burla 2560 posts 8256 karma points
    Nov 14, 2014 @ 15:17
    Anders Burla
    0

    Hi Michel

    I think we fixed that in Tea Commerce 3 that is in development. Will have a check :)

    Kind regards
    Anders

  • Michel Collard 44 posts 264 karma points c-trib
    Nov 18, 2014 @ 15:26
    Michel Collard
    0

    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!

  • Anders Burla 2560 posts 8256 karma points
    Dec 03, 2014 @ 13:56
    Anders Burla
    100

    Hi Michel

    I think we will release a v2 with minor bugfixes.

    Kind regards
    Anders

  • Anders Burla 2560 posts 8256 karma points
    Dec 05, 2014 @ 12:28
    Anders Burla
    0

    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

  • Michel Collard 44 posts 264 karma points c-trib
    Dec 05, 2014 @ 13:23
    Michel Collard
    0

    Anders,

    I tried this before with Razor and it worked fine, it was just the JavaScript getStock that didn't work.

  • Anders Burla 2560 posts 8256 karma points
    Dec 15, 2014 @ 10:43
    Anders Burla
    0

    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

Please Sign in or register to post replies

Write your reply to:

Draft