Announcement

Collapse
No announcement yet.

Quantity Limits by Miva

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

    #16
    Old post but to build of what Bruce - PhosphorMedia posted, I thought this might be helpful.

    On a site not using page builder:

    Code:
    <mvt:item name="quanlimits" param="QuantityLimit_Load_Product( l.settings:product:id, 0, l.settings:product:limits )" />
    
    <mvt:if expr="l.settings:product:limits:max_quan AND l.settings:product:limits:min_quan">
    
        You must order between &mvt:product:limits:min_quan; AND &mvt:product:limits:max_quan;.
        <input type="number" id="quantity" name="Quantity" min="&mvt:product:limits:min_quan;" max="&mvt:product:limits:max_quan;" />
    
    <mvt:elseif expr="l.settings:product:limits:max_quan AND NOT(l.settings:product:limits:min_quan)">
    
        This product is limited to &mvt:product:limits:max_quan; items.
        <input type="number" id="quantity" name="Quantity" max="&mvt:product:limits:max_quan;" />
    
    <mvt:elseif expr="NOT(l.settings:product:limits:max_quan) AND (l.settings:product:limits:min_quan)">
    
        You must order at least &mvt:product:limits:min_quan;.
        <input type="number" id="quantity" name="Quantity" min="&mvt:product:limits:min_quan;" />
    
    <mvt:else>
    
        <input type="number" id="quantity" name="Quantity"  />
    
    </mvt:if>
    As far as the best way to do this in page builder? At the moment, I'm not totally sure. I see the PROD page now uses page builder.

    I'd assume somthing would have to be added to the Product Details Flex Component or a Fragment can be used but maybe Nick can shed more light on this.

    Or perhaps a future release will give us control over setting the min and max values of the quantity input in page builder. With the option to use the Quantity Limits module to set those values... hint hint ;)
    Nick Harkins
    www.loveisarose.com

    Comment


      #17
      Originally posted by SidFeyDesigns View Post
      Old post but to build of what Bruce - PhosphorMedia posted, I thought this might be helpful.

      On a site not using page builder:

      Code:
      <mvt:item name="quanlimits" param="QuantityLimit_Load_Product( l.settings:product:id, 0, l.settings:product:limits )" />
      
      <mvt:if expr="l.settings:product:limits:max_quan AND l.settings:product:limits:min_quan">
      
      You must order between &mvt:product:limits:min_quan; AND &mvt:product:limits:max_quan;.
      <input type="number" id="quantity" name="Quantity" min="&mvt:product:limits:min_quan;" max="&mvt:product:limits:max_quan;" />
      
      <mvt:elseif expr="l.settings:product:limits:max_quan AND NOT(l.settings:product:limits:min_quan)">
      
      This product is limited to &mvt:product:limits:max_quan; items.
      <input type="number" id="quantity" name="Quantity" max="&mvt:product:limits:max_quan;" />
      
      <mvt:elseif expr="NOT(l.settings:product:limits:max_quan) AND (l.settings:product:limits:min_quan)">
      
      You must order at least &mvt:product:limits:min_quan;.
      <input type="number" id="quantity" name="Quantity" min="&mvt:product:limits:min_quan;" />
      
      <mvt:else>
      
      <input type="number" id="quantity" name="Quantity" />
      
      </mvt:if>
      As far as the best way to do this in page builder? At the moment, I'm not totally sure. I see the PROD page now uses page builder.

      I'd assume somthing would have to be added to the Product Details Flex Component or a Fragment can be used but maybe Nick can shed more light on this.

      Or perhaps a future release will give us control over setting the min and max values of the quantity input in page builder. With the option to use the Quantity Limits module to set those values... hint hint ;)
      Just an FYI - you don't "have" to use PageBuilder but you will need to use "old code" to do so.
      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


        #18
        Originally posted by lesliekirk View Post

        Just an FYI - you don't "have" to use PageBuilder but you will need to use "old code" to do so.
        Although Leslie is correct it is strongly recommended to use PageBuilder as new features are going to be focused around that functionality.

        SidFeyDesigns That being said there are still some hurdles currently which we will be updating soon. For that code to be added to the Product Details flex component you would need to add the code to a page fragment and assign the item to the fragment. Unfortunately, only modules that utilize the ComponentModule_Initialize_Fragment function can be assigned to a fragment and that module does not. I have submitted a request to update the module but we don't have a timeline for that yet.

        Additionally, we have another request submitted to allow for Fragment assignments in Page Builder to have an additional setting for the Share attribute, which will allow additional data to be shared with the fragment. Once this has been added to the flex components you will be able to add the item to the PROD page then pass in the product:limits data so it can be available within the fragment and render in Page Builder.

        Currently, the best option would be to store that data in a product custom field and use Page Builder to display the custom field.
        Nicholas Adkins
        Technical Training Specialist / Miva, Inc.
        [email protected]
        https://www.miva.com/mivalearn

        Comment

        Working...
        X