Announcement

Collapse
No announcement yet.

Difference between Product inv_available and inv_level

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

  • lesliekirk
    replied
    Thanks, Nick - makes good sense.

    Leave a comment:


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

    Leave a comment:


  • lesliekirk
    replied
    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

    Leave a comment:


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

    Leave a comment:


  • lesliekirk
    replied
    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?

    Leave a comment:


  • Nick
    replied
    lesliekirk This is how it is done in the default Shadows framework: https://github.com/mivaecommerce/sha...isplay.mvt#L87

    Leave a comment:


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