Announcement

Collapse
No announcement yet.

Quantity Limits Module Question

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

  • lesliekirk
    replied
    Thank you Leanne.!!! LOL the title of your post should have been Quantity Limits Module Answer
    Last edited by lesliekirk; 02-28-23, 04:51 AM.

    Leave a comment:


  • Leanne
    replied
    This code requires the quanlimits item to be assigned to all pages. It checks for exception errors and updates messaging in the mini-basket or on the basket page to direct the shopper to modify their cart. It removes the option to proceed to checkout. If someone manages to get past these checks, the module will catch them on the OSEL page. The site I did this on is using the Levels theme, so the code will have to be modified accordingly.

    Code:
    Minibasket:
    
    <div id="js-mini-basket-container" class="column whole small-half large-one-third mini-basket-container">
    <div class="row mini-basket-content" data-itemcount="&mvt:global_minibasket:basket_count;" data-subtotal="&mvt:basket:formatted_total;">
    <span data-icon="&#xe051;" class="mini-basket-close" title="Close"></span>
    <h3 class="column whole np nm">Shopping Cart</h3>
    <div class="sky mini-basket-seperator">&bull;&bull;&bull;&bull;&bull;</div>
    <mvt:if expr="l.settings:global_minibasket:empty">
    <div class="breaker clear"></div>
    <p class="column whole align-center">Your cart is currently empty.</p>
    <mvt:else>
    <div class="column whole mini-basket-table-wrap custom-scrolling">
    
    <mvt:comment>Integrate Quantity Limits</mvt:comment>
    <mvt:foreach iterator="group" array="global_minibasket:groups">
    <mvt:item name="quanlimits" param="QuantityExceptionList_Load_Line( l.settings:group:group_id, l.settings:exceptions )" />
    </mvt:foreach>
    
    <mvt:assign name="g.total_count" value="miva_array_elements(l.settings:exceptions)" />
    <mvt:if expr="g.total_count GE 1">
    
    <mvt:comment>Create custom list of products in exception list to compare against. Don't display error if product already exists in list.</mvt:comment>
    <mvt:assign name="g.tqdbasket_exceptions" value="'|'" />
    
    <p class="message message-error">
    <mvt:assign name="g.counter" value="0" />
    <mvt:foreach iterator="exception" array="exceptions">
    <mvt:assign name="g.counter" value="g.counter + 1" />
    
    <mvt:comment>Exclude the exception if the product is already in the custom list of exception products</mvt:comment>
    <mvt:if expr="NOT(('|' $ l.settings:exception:product $ '|') IN g.tqdbasket_exceptions)">
    <span style="display: block;">Purchases of &mvte:exception:product; are limited to a total quantity of <b>&mvte:exception:max_quan;</b><mvt:if expr="g.counter LT g.total_count"><span></mvt:if>
    <mvt:assign name="g.purchase_exception" value="1" />
    </mvt:if>
    
    <mvt:comment>Add exception to custom list of exception products</mvt:comment>
    <mvt:assign name="g.tqdbasket_exceptions" value="g.tqdbasket_exceptions $ l.settings:exception:product $ '|'" />
    </mvt:foreach>
    <span style="display:block;">Please edit your cart.</span>
    </p>
    </mvt:if>
    
    <mvt:foreach iterator="item" array="global_minibasket:items">
    <div class="row mini-basket-row">
    <div class="column hide medium-show medium-one-fifth">
    <mvt:if expr="NOT ISNULL l.settings:item:imagetypes:main">
    <img src="&mvte:item:imagetypes:main;" alt="&mvt:item:name;" title="&mvt:item:name;" class="mini-basket-image">
    <mvt:else>
    &nbsp;
    </mvt:if>
    </div>
    <div class="column three-fourths medium-three-fifths">
    <a href="&mvte:urls:PROD:auto_sep;Product_Code=&mvta: item:code;">&mvt:item:name;</a>
    <mvt:if expr="l.settings:item:upsold">
    &nbsp;(Special Offer)
    </mvt:if>
    <br />
    <mvt:foreach iterator="option" array="item:options">
    <mvt:if expr="l.settings:option:option_id">
    &mvt:option:attr_prompt;: &mvt:option:opt_prompt;
    <mvt:elseif expr="NOT ISNULL l.settings:option:data">
    &mvt:option:attr_prompt;: &mvt:option:data;
    <mvt:elseif expr="NOT ISNULL l.settings:option:data_long">
    &mvt:option:attr_prompt;: &mvt:option:data_long;
    <mvt:else>
    &mvt:option:attr_prompt;
    </mvt:if>
    <mvt:if expr="l.settings:option:price"> &mvt:option:formatted_price;</mvt:if>
    <br />
    </mvt:foreach>
    <mvt:if expr="l.settings:item:subterm_id">
    Subscription: &mvte:item:productsubscriptionterm:descrip;<br />
    </mvt:if>
    <!-- Qty: &mvte:item:quantity; -->
    </div>
    <div class="column one-fourth medium-one-fifth align-right np">
    <mvt:if expr="l.settings:item:subtotal_base_price OR l.settings:item:subtotal">
    <mvt:if expr="l.settings:item:subtotal_base_price NE l.settings:item:subtotal">
    <s>&mvt:item:formatted_subtotal_base_price;</s><br />
    </mvt:if>
    <strong>&mvt:item:formatted_subtotal;</strong>
    <mvt:else>
    <strong>&mvt:item:formatted_subtotal_comprehensive ;</strong>
    </mvt:if>
    </div>
    </div>
    </mvt:foreach>
    </div>
    <div class="breaker clear"></div>
    <h5 class="column whole align-right normal np">Subtotal: <strong>&mvt:global_minibasket:formatted_total;</strong></h5>
    </mvt:if>
    </div>
    <mvt:if expr="NOT l.settings:global_minibasket:empty">
    <div class="row">
    <mvt:if expr="g.purchase_exception EQ 1">
    <div class="column whole np"><a href="&mvte:urls:BASK:auto;" class="nb round-bottom-left button button-block button-medium button-square bg-gray white uppercase">Edit Cart</a></div>
    <mvt:else>
    <div class="column half np"><a href="&mvte:urls:BASK:auto;" class="nb round-bottom-left button button-block button-medium button-square bg-gray white uppercase">Edit Cart</a></div>
    <div class="column half np"><a href="&mvte:urls:OINF:secure;" class="nb round-bottom-right button button-block button-medium button-square bg-green white uppercase">Checkout</a></div>
    </mvt:if>
    <mvt:comment>Reset value of purchase_exception</mvt:comment>
    <mvt:assign name="g.purchase_exception" value="0" />
    </div>
    </mvt:if>
    </div>
    
    
    BASK - Main Template above Basket Contents:
    
    <mvt:foreach iterator="group" array="basket:groups">
    <mvt:item name="quanlimits" param="QuantityExceptionList_Load_Line( l.settings:group:group_id, l.settings:exceptions )" />
    </mvt:foreach>
    
    <mvt:assign name="g.total_count" value="miva_array_elements(l.settings:exceptions)" />
    <mvt:if expr="g.total_count GE 1">
    
    <mvt:comment>Create custom list of products in exception list to compare against. Don't display error if product already exists in list.</mvt:comment>
    <mvt:assign name="g.tqdbasket_exceptions" value="'|'" />
    
    <p class="message message-error">
    <mvt:assign name="g.counter" value="0" />
    <mvt:foreach iterator="exception" array="exceptions">
    <mvt:assign name="g.counter" value="g.counter + 1" />
    
    <mvt:comment>Exclude the exception if the product is already in the custom list of exception products</mvt:comment>
    <mvt:if expr="NOT(('|' $ l.settings:exception:product $ '|') IN g.tqdbasket_exceptions)">
    <span style="display: block;">Purchases of &mvte:exception:product; are limited to a total quantity of <b>&mvte:exception:max_quan;</b></span>
    </mvt:if>
    
    <mvt:comment>Add exception to custom list of exception products</mvt:comment>
    <mvt:assign name="g.tqdbasket_exceptions" value="g.tqdbasket_exceptions $ l.settings:exception:product $ '|'" />
    </mvt:foreach>
    <mvt:if expr="g.counter EQ 1">
    <span style="display: block;">Please adjust your purchase to the maximum allowed total quantity.</span>
    <mvt:else>
    <span style="display: block;">Please adjust your purchases to the maximum allowed total quantity of each product.</span>
    </mvt:if>
    </div>
    </mvt:if>
    
    
    BASK - Basket Contents:
    
    <mvt:comment>Disable checkout button if quantity limits exception list exists</mvt:comment>
    <mvt:if expr="NOT ISNULL g.tqdbasket_exceptions">
    <p class="align-center"><a title="Proceed to Secure Checkout" class="button button-block button-square button-medium bg-green white uppercase disabled">Checkout</a></p>
    <mvt:else>
    <p class="align-center"><a href="&mvt:global:secure_sessionurl;Screen=OINF&St ore_Code=&mvte:store:code;" title="Proceed to Secure Checkout" class="button button-block button-square button-medium bg-green white uppercase">Checkout</a></p>
    </mvt:if>
    
    PROD - Product Display Layout:
    
    Inside the add to cart form:
    <mvt:item name="quanlimits" param="QuantityLimit_Load_Product( l.settings:product:id, 0, l.settings:product:limits )" />

    Leave a comment:


  • mstella1
    replied
    That would be great thank you!

    Leave a comment:


  • Leanne
    replied
    I recently implemented this module on a store and thought the customer experience and messaging were dreadful, so I made several modifications to try to improve on it. I'll dig through and find what I did and post it here later today in case it's helpful to anyone.

    Leave a comment:


  • lesliekirk
    replied
    Originally posted by Ron Frigon View Post
    We're suffering from the Great Eastern Pollination and things are a little fuzzy.
    We haven't had the attack of the yellow dust yet but I'm still recovering from the beginning of being turned into the bionic woman with a little bit of titanium inserted into my neck (doing so much better now) so I can relate to being in a fog.

    Leave a comment:


  • Ron Frigon
    replied
    based on the image from the docs.
    This is a screenshot of:

    If there are any validation errors it will take the customer back to the basket page with the errors which need to be fixed displayed.
    I seem to remember having a support ticket for this but I can't find it.

    https://www.miva.com/forums/forum/on...limits-by-miva

    There are two places the module validates the min/max:

    1. When the customer submits OCST (bill to ship to page)
    2. On the AUTH action which is the final action to process the payment

    If either of these fail it will redirect the custom back to the Basket page with an error message.

    Leave a comment:


  • mstella1
    replied
    I was under the impression it was built-in so we could add that on the BASK or OCST page based on the image from the docs.
    min-max_checkout.png (2606×1698) (miva.com)

    The error message shown is really all I needed to display and I figured since the error message I was hoping to see is in the png attached it would be pretty simple.

    Leave a comment:


  • Ron Frigon
    replied
    What does this do? QuantityExceptionList_Load_Line( line_id, exceptions var )
    That will only display the Products Min/Max settings. You could probably create some template code to disable the checkout options.

    Is this what you are referring to not working until you go to the OCST screen?
    Referring to this from the docs:

    Checkout Validation

    Miva validates the quantity limits for the basket during the ORDR action. This is when the Bill To /Ship To fields are submitted (The OCST page). If there are any validation errors it will take the customer back to the basket page with the errors which need to be fixed displayed.
    Sorry for not being too "wordy". We're suffering from the Great Eastern Pollination and things are a little fuzzy.

    Leave a comment:


  • lesliekirk
    replied
    Originally posted by Ron Frigon View Post
    To replace the EP Min/Max module use: https://apps.miva.com/quantity-limits.html

    But, this module does not validate on BASK. It validates when OCST is submitted. I don't believe that can be changed.
    I'm ready through the docs. They might be a bit misleading if you are finding the module does not work at the BASK level (or perhaps we are needing to work like the EP module)

    Important: In order to use one of these functions on any page, the quanlimits item first needs to be assigned to that page. It does not get assigned to any pages by default upon install. Common pages to use it on would be BASK and PROD.

    What does this do? QuantityExceptionList_Load_Line( line_id, exceptions var ) https://docs.miva.com/how-to-guides/...mits#functions

    Is this what you are referring to not working until you go to the OCST screen?



    Leave a comment:


  • Ron Frigon
    replied
    To replace the EP Min/Max module use: https://apps.miva.com/quantity-limits.html

    But, this module does not validate on BASK. It validates when OCST is submitted. I don't believe that can be changed.

    Leave a comment:


  • lesliekirk
    replied
    Originally posted by Ron Frigon View Post

    I don't believe this gets triggered until OCST is submitted. Not ideal...
    FYI - the EmporiumPlus Minimum and Maximum Quantity module supposed to work on the BASK screen. See item #2 of the editing requirements https://www.emporiumplus.com/v5/cim_qmin.htm

    Ron, have to figured out a way to replace the module's functionality?

    (Sorry for all the "words" - trying to make this post searchable)

    Leave a comment:


  • Ron Frigon
    replied
    I discovered the Min/Max Quantity module either isn't working at the BASK screen
    I don't believe this gets triggered until OCST is submitted. Not ideal...

    Miva validates the quantity limits for the basket during the ORDR action. This is when the Bill To /Ship To fields are submitted (The OCST page).

    Leave a comment:


  • delcorsets
    replied
    Also jumping on for the ride.. we have quite a few EP modules as well that I’m finally getting around to replacing…

    Leave a comment:


  • lesliekirk
    replied
    Originally posted by mstella1 View Post
    Oh boy Leslie hang on for the ride then :) More posts to come I am sure because I used a LOT of Bill's modules and never thought I would have to replace them.
    I'm dealing with the Coupon Redemption, Volume Pricing and Sort Shipping Plus Free Shipping Option - they are all interacting (I've got posts for each). Today I discovered the Min/Max Quantity module either isn't working at the BASK screen (or may not have been configured during a template upgrade). Another must have is the Miscellaneous Fee module. I'm sure we not the only ones who will be going through this but maybe we can smooth the road some.

    Leave a comment:


  • mstella1
    replied
    Oh boy Leslie hang on for the ride then :) More posts to come I am sure because I used a LOT of Bill's modules and never thought I would have to replace them.

    Leave a comment:

Working...
X