disable Shopping Cart drop-down

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cway
    Mivite

    • Aug 2007
    • 403

    #1

    disable Shopping Cart drop-down

    Hello, everyone. I thought there was a quick way to disable the Shopping Cart from dropping-down when you added an item to your basket. Can anyone remind me?
    Thank you!
    Trent Studios, LLC
    Graphic Design, Website Design
    TrentStudios.com
    (970) 568-8652
  • Brennan
    Super Moderator









    • Jun 2009
    • 3481

    #2
    It is done via JavaScript. The best way is to edit the scripts.js file and remove the ajax add to cart code. This will make it so when someone clicks add to cart it will take them to the basket page and the mini-cart will not display.
    Brennan Heyde
    VP Product
    Miva, Inc.
    [email protected]
    https://www.miva.com

    Comment

    • cway
      Mivite

      • Aug 2007
      • 403

      #3
      Remove this?:

      Code:
              // ---- AJAX Add To Cart ---- //
              function addToCart () {
                  $('#js-add-to-cart').on('click', function (e) {
                      var purchaseForm = $('#js-purchase-product');
                      // Check the form is not currently submitting
                      if (purchaseForm.data('formstatus') !== 'submitting') {
                          // Set up variables
                          var form = purchaseForm,
                              formData = form.serialize(),
                              randomNo = Math.ceil(Math.random() * 1000000), // IE Hack: Creating random number to refresh ajax call
                              formUrl = form.attr('action') + '&v=' + randomNo,
                              formMethod = form.attr('method'),
                              responseMessage = $('#js-purchase-message'),
                              miniBasket = $('#js-mini-basket-container'),
                              processingImage = $('#js-processing-purchase'),
                              purchaseButton = $(this);
      
                          // Add status data to form
                          form.data('formstatus', 'submitting');
      
                          // Show processing message
                          processingImage.show();
                          purchaseButton.toggleDisabled().val('Processing...');
                          responseMessage.html('').hide();
      
                          // Send data to server for validation
                          $.ajax({
                              url: formUrl,
                              type: formMethod,
                              data: formData,
                              success: function(data, textStatus, jqXHR) {
                                  if (data.search(/id="js-BASK"/i) != -1) {
                                      $('html, body').animate({scrollTop: '0px'}, 250);
                                      var responseMiniBasket = $(data).find('#js-mini-basket-container'),
                                          miniBasketCount = responseMiniBasket.contents()[1].getAttribute('data-itemcount'),
                                          miniBasketSubtotal = ' ' + responseMiniBasket.contents()[1].getAttribute('data-subtotal'),
                                          miniBasketLinkCount = $('#js-mini-basket-count, #js-mobile-basket-button .notification'),
                                          miniBasketLinkSubtotal = $('#js-mini-basket-subtotal');
      
                                      miniBasketLinkCount.text(miniBasketCount); // Update basket quantity (display only)
                                      miniBasketLinkSubtotal.text(miniBasketSubtotal); // Update basket subtotal (display only)
      
                                      miniBasket.html(responseMiniBasket.contents()).addClass('open');
                                      setTimeout(function () {
                                          miniBasket.removeClass('open');
                                      }, 5000);
      
                                      // Re-Initialize Attribute Machine (if it is active)
                                      if (typeof attrMachCall !== 'undefined') {
                                          attrMachCall.Initialize();
                                      };
                                  }
                                  else if(data.search(/id="js-PATR"/i) != -1) {
                                      var missingAttrs = [];
                                      form.find('.required').each(function () {
                                          missingAttrs.push(' ' + $(this).attr('title'));
                                      });
                                      responseMessage.html('All <em class="red">Required</em> options have not been selected.<br />Please review the following options: <span class="red">' + missingAttrs + '</span>.').fadeIn().delay(5000).fadeOut();
                                  }
                                  else if(data.search(/id="js-PLMT"/i) != -1) {
                                      responseMessage.html('We do not have enough of the Size/Color you have selected.<br />Please adjust your quantity.').fadeIn().delay(3000).fadeOut();
                                  }
                                  else if(data.search(/id="js-POUT"/i) != -1) {
                                      responseMessage.html('The Size/Color you have selected is out of stock.<br />Please review your options or check back later.').fadeIn().delay(3000).fadeOut();
                                  }
                                  else {
                                      responseMessage.html('Please review options.').fadeIn().delay(3000).fadeOut();
                                  };
      
                                  // Hide processing message and reset formstatus
                                  processingImage.hide();
                                  purchaseButton.toggleDisabled().val('Add to Cart');
                                  form.data('formstatus', 'idle');
                              },
                              error: function (jqXHR, textStatus, errorThrown) {
                              }
                          });
                      };
                      // Prevent form from submitting
                      e.preventDefault();
                  });
              };
      Thanks!
      Last edited by cway; 05-18-17, 01:06 PM.
      Trent Studios, LLC
      Graphic Design, Website Design
      TrentStudios.com
      (970) 568-8652

      Comment

      • Kent Multer
        Mega Mivite









        • Mar 2006
        • 3256

        #4
        I seem to recall that there's a simple shortcut for this. There's an element on the PROD page with an ID of "js-" something, and you just remove the "js-" from the ID, and that disables the dropdown box without changing anything else. It has the advantage of being easy to un-do in case you change your mind. Maybe someone else can fill in the details I've forgotten?
        Kent Multer
        Magic Metal Productions
        http://TheMagicM.com
        * Web developer/designer
        * E-commerce and Miva
        * Author, The Official Miva Web Scripting Book -- available on-line:
        http://www.amazon.com/exec/obidos/IS...icmetalproducA

        Comment

        • Bruce - PhosphorMedia
          Developer Partner











          • Mar 2006
          • 11257

          #5
          So long as the rest of the form post variables are still present (screen/action) that should work, but it probably depends on how the ajax call was implement. easy enough to test. Just look for the element tagged with id of js-add-to-cart and just add an x to it.
          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

          Working...
          X