Announcement

Collapse
No announcement yet.

Pull in inventory info on variants?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Pull in inventory info on variants?

    I'm trying to pull in information about inventory on product variants, but I don't see anything in the attributes/options tokens that are listed? You can pull in the total available rolled up on the parent level, but I need to be able to see if a specific variant is sold out or not.

    Ex: size S has 10 available, but M has 0 (or 'out', either works) etc.

    How would I pull in this info?

    #2
    If it's not already in the variant structure you can manually load it via api functions. This will probably do the job:

    <mvt:do file="g.Module_Feature_INV_RT" name="l.success" value="Inventory_Load_Variant(l.settings:product, variant_id)" />

    variant_id will be whatever id the variant product is, maybe l.setting:product:id depending on what's going on in the template.

    The product structure will then contain a bunch of variant info, including:

    product:inv_available
    product:inv_instock
    product:inv_short
    product:inv_long
    M.A.D.* since 1997

    http://www.scotsscripts.com

    *miva application developers

    Comment


      #3
      Hmm, either I'm not getting this to load right, or I'm not calling it right... Or both.

      <mvt:do file="g.Module_Feature_INV_RT" name="l.success" value="Inventory_Load_Variant(l.settings:product:c ode, l.settings:var_id)" />
      Test load: &mvte:success

      Comment


        #4
        Inventory_Load_Variant(l.settings:product:c ode, l.settings:var_id)

        You don't need l.settings:product:c code (c code is a typo anyway), you just need to load it into l.settings:product

        I don't know what your l.settings:var_id is supposed to be, you need to figure it out from the page. If you already have l.settings:product then you can try l.settings:product:id

        Anyway, l.settings:var_id needs to be the variable for the variant product id. You might be able to use the tokens thing to see what that variable name is.
        M.A.D.* since 1997

        http://www.scotsscripts.com

        *miva application developers

        Comment

        Working...
        X