Announcement

Collapse
No announcement yet.

Difference between Product inv_available and inv_level

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

    Difference between Product inv_available and inv_level

    I'm trying to understand why
    Code:
    <mvt:if expr="l.settings:product:inv_available GT 0">
    would be used instead of
    Code:
    <mvt:if expr="l.settings:product:inv_level NE 'out'">
    . I stumbled upon the usage of
    Code:
    <mvt:if expr="l.settings:product:inv_available GT 0">
    when trying to figure out why when unchecking the Product Inventory Track Product did not allow the Add to Cart button to appear.
    Code:
    <mvt:if expr="l.settings:product:inv_available GT 0"> <button id="js-add-to-cart" class="button button-block uppercase add-to-cart button-secondary white bold">Add <span class="small-inline-block hide">to Cart</span></button> <mvt:else> <button id="js-add-to-cart" class="button button-block uppercase add-to-cart button-secondary white bold" disabled="disabled">Sold Out</button>
    If I change it to use
    Code:
    <mvt:if expr="l.settings:product:inv_level NE 'out'">
    it works as expected. I am just trying to make sure if I make this change it won't blow up on me.
    Leslie Kirk
    Miva Certified Developer
    Miva Merchant Specialist since 1997
    Previously of Webs Your Way
    (aka Leslie Nord leslienord)

    Email me: [email protected]
    www.lesliekirk.com

    Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

    #2
    lesliekirk This is how it is done in the default Shadows framework: https://github.com/mivaecommerce/sha...isplay.mvt#L87
    Nicholas Adkins
    Technical Training Specialist / Miva, Inc.
    [email protected]
    https://www.miva.com/mivalearn

    Comment


      #3
      Originally posted by Nick View Post
      lesliekirk This is how it is done in the default Shadows framework: https://github.com/mivaecommerce/sha...isplay.mvt#L87
      Yes, I know. That's where I got the code from. My question still remains - if I use the "Shadows" code, will it blow up the "Levels" code?
      Leslie Kirk
      Miva Certified Developer
      Miva Merchant Specialist since 1997
      Previously of Webs Your Way
      (aka Leslie Nord leslienord)

      Email me: [email protected]
      www.lesliekirk.com

      Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

      Comment


        #4
        lesliekirk That code is not specific to Shadows it can be used anywhere. It is just a matter of if it works for the business rules of the store.

        The l.settings:product:inv_level variable is only going to be available if the product/store has the Track Out of Stock Level setting checked. If that setting is not checked then the variable will not be available.

        So if you have a condition with the l.settings:product:inv_level variable and the Track Out of Stock Level setting unchecked then that condition will be true. If the setting is checked and the product has 0 inventory then the condition will not be true because it will equal 'out'

        The condition is basically checking if the track out of stock products is activated.
        Nicholas Adkins
        Technical Training Specialist / Miva, Inc.
        [email protected]
        https://www.miva.com/mivalearn

        Comment


          #5
          Originally posted by Nick View Post
          lesliekirk That code is not specific to Shadows it can be used anywhere. It is just a matter of if it works for the business rules of the store.

          The l.settings:product:inv_level variable is only going to be available if the product/store has the Track Out of Stock Level setting checked. If that setting is not checked then the variable will not be available.

          So if you have a condition with the l.settings:product:inv_level variable and the Track Out of Stock Level setting unchecked then that condition will be true. If the setting is checked and the product has 0 inventory then the condition will not be true because it will equal 'out'

          The condition is basically checking if the track out of stock products is activated.
          LOL, thanks Nick, the curious mind in me also wonders why it was changed
          Leslie Kirk
          Miva Certified Developer
          Miva Merchant Specialist since 1997
          Previously of Webs Your Way
          (aka Leslie Nord leslienord)

          Email me: [email protected]
          www.lesliekirk.com

          Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

          Comment


            #6
            lesliekirk In Miva you can set your out of stock level to something other than 0. So if you have the Out of Stock Level set to something greater than 0 then the check if inv_available is equal to 0 will not work. The inv_level variable is a better condition because it takes into account the Out of Stock Level setting.
            Nicholas Adkins
            Technical Training Specialist / Miva, Inc.
            [email protected]
            https://www.miva.com/mivalearn

            Comment


              #7
              Thanks, Nick - makes good sense.
              Leslie Kirk
              Miva Certified Developer
              Miva Merchant Specialist since 1997
              Previously of Webs Your Way
              (aka Leslie Nord leslienord)

              Email me: [email protected]
              www.lesliekirk.com

              Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

              Comment

              Working...
              X