Copied to clipboard

Flag this post as spam?

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


These support forums are now closed for new topics and comments.
Please head on over to http://eureka.ucommerce.net/ for support.

  • Robin Nicholl 137 posts 277 karma points
    Jun 09, 2011 @ 15:54
    Robin Nicholl
    0

    Handling InventoryOnHand

    How can InventoryOnHand be utlised? For instance, how can I:

    • display the current stock level for a given products?
    • only show a product if it's in stock?
  • Søren Spelling Lund 1797 posts 2786 karma points
    Jun 09, 2011 @ 16:16
    Søren Spelling Lund
    0

    Hi Robin,

    You can do both those things. InventoryOnHand will be returned as part of the product XML ready for use in your XSLT templates or as part of the custom properties if you're working with .NET.

    Using it from XML is very straightforward, just grab the attribute value and test on it being great than 0. XSLT makes it easy to filter out products, which don't have any inventory on hand.

    From .NET you can go product["InventoryOnHand"] and it will output the current stock level.

    Hope this helps.

  • Tracey Van Loggerenberg 3 posts 23 karma points
    Apr 23, 2013 @ 17:42
    Tracey Van Loggerenberg
    0

    If you're using Razor, you can get it with the following:

    @product.DynamicProperty().InventoryOnHand

    Assuming you've already set the product with SiteContext.Current.CatalogContext.CurrentProduct and all the rest, and there are no variants for the product.

  • Shuchita 41 posts 150 karma points
    Aug 05, 2013 @ 12:58
    Shuchita
    0

    Hey Tracey,

    What if the product has variants?

    I need it this way. Can you please help me?

  • Nickolaj Lundgreen 233 posts 1132 karma points
    Aug 07, 2013 @ 14:24
    Nickolaj Lundgreen
    0

    I guess you would have to add a custom variant property (type number) to the products, and add your own checkout + ToCancelled pipeline to keep the variant inventory numbers up to date.

  • Søren Spelling Lund 1797 posts 2786 karma points
    Aug 16, 2013 @ 10:21
    Søren Spelling Lund
    0

    InventoryOnHand is also supported on the variant level and will be handled automatically for you.

    Docs at Simple Inventory Management with uCommerce.

Please Sign in or register to post replies

Write your reply to:

Draft