Announcement

Collapse
No announcement yet.

Minimum Quantity for products

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

  • Minimum Quantity for products

    I am using Suivant ReadyTheme.

    I have certain products that require a minimum quantity of 5.
    For those products, I have created a custom filed (minqty) which I use as a conditional on the PROD page.

    What I did was add a script right below the Quantity Incrementer in the js scripts file (see below)

    On the PROD page, my conditional (if a product has a minimum of 5) does indeed call the #js-increase-quantity-5/#js-decrease-quantity-5 script.
    However, the function (increase + or decrease -) on the PRODUCT page does not work.

    Any reason for this not working?


    ORIGINAL
    // ---- Quantity Incrementer ---- //
    $('#js-increase-quantity').on('click', function () {
    var $qty = $(this).siblings('input'),
    currentVal = parseInt($qty.val());

    if (!isNaN(currentVal)) {
    $qty.val(currentVal + 1).change();
    };
    });
    $('#js-decrease-quantity').on('click', function () {
    var $qty = $(this).siblings('input'),
    currentVal = parseInt($qty.val());

    if (!isNaN(currentVal) && currentVal > 1) {
    $qty.val(currentVal - 1).change();
    };
    });

    FOR PRODUCTS NEEDING 5 OR MORE

    // ---- Minimum Quantity 5 Incrementer ---- //
    $('#js-increase-quantity-5').on('click', function () {
    var $qty = $(this).siblings('input'),
    currentVal = parseInt($qty.val());

    if (!isNaN(currentVal)) {
    $qty.val(currentVal + 1).change();
    };
    });
    $('#js-decrease-quantity-5').on('click', function () {
    var $qty = $(this).siblings('input'),
    currentVal = parseInt($qty.val());

    if (!isNaN(currentVal) && currentVal > 5) {
    $qty.val(currentVal - 1).change();
    };
    });


  • Can you post a link to the product in question?
    Matt Zimmermann
    Director of UI/UX Standards and Theme Development
    / Miva, Inc.

    Comment


    • This is the product link:

      http://www.guitarconnection.com/product/HL35002687.html


      BTW here is the conditional for that on the PROD page:

      <mvt:item name="toolkit" param="customc|word|l.all_settings:product:code|mi nqty" />
      <mvt:if expr="g.word EQ 5">
      <span id="js-decrease-quantity-5" class="bg-gray decrease-quantity" unselectable="on" data-rt-icon="&#x67;"></span>
      <input type="tel" name="Quantity" value="5" id="l-quantity" class="align-center" />
      <span id="js-increase-quantity-5" class="bg-gray increase-quantity" unselectable="on" data-rt-icon="&#x69;"></span>
      <mvt:else>
      <span id="js-decrease-quantity" class="bg-gray decrease-quantity" unselectable="on" data-rt-icon="&#x67;"></span>
      <input type="tel" name="Quantity" value="1" id="l-quantity" class="align-center" />
      <span id="js-increase-quantity" class="bg-gray increase-quantity" unselectable="on" data-rt-icon="&#x69;"></span>
      </mvt:if>

      Comment


      • That code looks correct. I have test that page in Chrome, Edge, Firefox, Internet Explorer 11, and Opera and the increment/decrement controls are working as expected. Have you tried clearing your cache?
        Matt Zimmermann
        Director of UI/UX Standards and Theme Development
        / Miva, Inc.

        Comment


        • Ah the simple things....

          Thanks Matt. That was the problem. Should have know better.

          Comment


          • Hint: on Chrome Inspector, there is an option to "Clear Cache" when inspector is open. Though I've found it best just to get a Add On that prevents caching altogether. If you have a decent connection, you won't notice, and you get a better idea of a typical customer's experiance.
            Bruce Golub
            Phosphor Media - "Your Success is our Business"

            Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
            phosphormedia.com

            Comment


            • Thanks Bruce

              Comment


              • It still lets you add what ever amount you enter in the qty field. Also you can edit the qty on the bask page. I'm gonna work on this.

                Comment


                • We did the same but limiting max qty for some products.
                  On the basket page we're showing the message asking customesr to update qty. On the ocst, osel and opay we're checking the qty again and redirecting back to basket if customer is trying to cheat.

                  Code:
                  <mvt:comment>
                  ###############################################################################
                  if limit qty isset and basket item qty > limit, redirecting back to basket
                  ###############################################################################
                  </mvt:comment>
                  <mvt:foreach iterator="item" array="basket:items">
                      <mvt:comment>Checking if product has a limited quantity per sale set</mvt:comment>
                      <mvt:assign name="g.p_sale_limit" value="''" />
                      <mvt:item name="customfields" param="Read_Product_Code(l.settings:item:code, 'limit_sale_qty', g.p_sale_limit)" />
                      <mvt:if expr="g.p_sale_limit EQ '0'">
                          <mvt:assign name="g.p_sale_limit" value="''" />
                      </mvt:if>
                  
                      <mvt:comment>If limit is set, making sure we're not over the limit</mvt:comment>
                      <mvt:if expr="NOT ISNULL g.p_sale_limit AND g.p_sale_limit GT 0 AND l.settings:item:quantity GT g.p_sale_limit">
                          <mvt:assign name="l.header" value="miva_output_header( 'Status', '302 Moved Temporarily' )" />
                          <mvt:assign name="l.header" value="miva_output_header( 'Location', '/mm5/merchant.mvc?Screen=BASK' )" />
                          <mvt:exit />
                      </mvt:if>
                  </mvt:foreach>

                  Comment


                  • Category Minimums and Maximums mod by EP works ok. We need a better solution that really works on the prod or cat page please!

                    Comment

                    Working...
                    X