Copied to clipboard

Flag this post as spam?

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


  • Rody 80 posts 280 karma points
    Oct 10, 2014 @ 09:11
    Rody
    0

    GetStock for multiple products

    Is there a way to select the stock of multiple products in one call? 

    We have the TC.GetStock(...) function which works perfectly for one product. However we have a case where we need to select the stock of a large amount of items. Calling TC.GetStock(..) per item will not show the products in time. Caching is no option, because the overview is about real life stock levels.  

    It would be ideal to have a method: TC.GetStock(IEnumerable<decimal> IDs) or something. Maybe it's possible to share the code of the TC.GetStock method so we can create an extended version of it? 

  • Anders Burla 2560 posts 8256 karma points
    Oct 10, 2014 @ 13:47
    Anders Burla
    0

    That would be a good idea!

    The GetStock method does this internally:

    IProductService productService = ProductService.Instance;
    decimal? stock = productService.GetStock( storeId, productService.GetSku( productIdentifier ) );
    return stock;

    Find the sku from the node id and then behind the sceen it does a DB lookup with the sku. So you can properly just make a SQL method to fetch multiple stock.

    Kind regards
    Anders

  • Rody 80 posts 280 karma points
    Oct 13, 2014 @ 08:40
    Rody
    0

    Good idea, will try this later on today for this shop. Maybe something to add to a future version?

  • Anders Burla 2560 posts 8256 karma points
    Oct 13, 2014 @ 09:14
    Anders Burla
    0

    Yeah it is added to the list of requests :)

Please Sign in or register to post replies

Write your reply to:

Draft