Announcement

Collapse
No announcement yet.

Basket Refresh Timing When Changing Quantity

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

    Basket Refresh Timing When Changing Quantity

    Hi Everyone,
    We are currently experiencing a pretty big issue with our cart using the shadows theme. We are able to trick the cart into processing negative quantities. This is done by rapidly typing numbers in the quantity field for a product. Do you know where the JavaScript code is located for the auto submit timer on keystroke of the quantity field? I am going to slow this auto submit time down and put in some negative number checks into it. I just cannot seem to find where that code gets run from to process the new quantities. Thank you so much!
    --Scott

    #2
    Hi Scott,

    I have not heard of this before. Depending on which version of Shadows you are using, the function you are looking for is called "quantify". It will be located in either the "extensions" or "quantify" JavaScript Resources.
    Matt Zimmermann

    Miva Web Developer
    Alchemy Web Development
    https://www.alchemywebdev.com
    Site Development - Maintenance - Consultation

    Miva Certified Developer
    Miva Professional Developer

    https://www.dev4web.net | Twitter

    Comment


      #3
      Originally posted by Matt Zimmermann View Post
      Hi Scott,

      I have not heard of this before. Depending on which version of Shadows you are using, the function you are looking for is called "quantify". It will be located in either the "extensions" or "quantify" JavaScript Resources.
      Thanks Matt,
      I actually already took a look at this file and it seems to only have the increment and decrement functions in it. The trigger for auto submitting the text box upon keystoke is not in there. Any thoughts on where this could be? Thank you so much!
      --Scott

      Comment


        #4
        Hi Scott,

        The event listeners are near the bottom of that function:
        Code:
        if (quantities) {
        for (let id = 0; id < quantities.length; id++) {
        let quantityLine = quantities[id];
        let updateTimeout = null;
        
        toggleRemove(quantityLine, quantityLine.value);
        
        quantityLine.addEventListener('change', function (event) {
        let input = this;
        
        clearTimeout(updateTimeout);
        updateTimeout = setTimeout(function () {
        toggleRemove(input, input.value);
        groupSubmit(event, input);
        }, 250);
        });
        
        quantityLine.addEventListener('input', function (event) {
        let input = this;
        
        clearTimeout(updateTimeout);
        updateTimeout = setTimeout(function () {
        toggleRemove(input, input.value);
        groupSubmit(event, input);
        }, 250);
        });
        }
        }
        Matt Zimmermann

        Miva Web Developer
        Alchemy Web Development
        https://www.alchemywebdev.com
        Site Development - Maintenance - Consultation

        Miva Certified Developer
        Miva Professional Developer

        https://www.dev4web.net | Twitter

        Comment


          #5
          Originally posted by Matt Zimmermann View Post
          Hi Scott,

          The event listeners are near the bottom of that function:
          Code:
          if (quantities) {
          for (let id = 0; id < quantities.length; id++) {
          let quantityLine = quantities[id];
          let updateTimeout = null;
          
          toggleRemove(quantityLine, quantityLine.value);
          
          quantityLine.addEventListener('change', function (event) {
          let input = this;
          
          clearTimeout(updateTimeout);
          updateTimeout = setTimeout(function () {
          toggleRemove(input, input.value);
          groupSubmit(event, input);
          }, 250);
          });
          
          quantityLine.addEventListener('input', function (event) {
          let input = this;
          
          clearTimeout(updateTimeout);
          updateTimeout = setTimeout(function () {
          toggleRemove(input, input.value);
          groupSubmit(event, input);
          }, 250);
          });
          }
          }
          Well, that explains it! I do not have all of that code in my quantify JavaScript code! Thank you Matt, I will report back if I was able to fix this. I should also probably look to make sure I have everything else updated in this file as well to the latest and greatest version. Thank you,
          --Scott

          Comment


            #6
            Hey Matt,
            OK, I updated our quantify.js file to the latest and greatest from GitHub. I am still able to trick negative numbers into the text box by typing the same 3 digit quantity over and over again. It looks like there is some math being done somewhere here. This is very odd behavior. Any suggestions? Thank you,
            --Scott

            Comment


              #7
              Hi Scott,

              It shouldn't be possible to have a negative basket quantity. Can you post a clip of what you are seeing as you do that?
              Matt Zimmermann

              Miva Web Developer
              Alchemy Web Development
              https://www.alchemywebdev.com
              Site Development - Maintenance - Consultation

              Miva Certified Developer
              Miva Professional Developer

              https://www.dev4web.net | Twitter

              Comment

              Working...
              X