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

              Working...
              X