0

By Default , ADD TO CART will do 2 things.

1)Add Item to cart

2)Create new row in sales_flat_quote_item_option Table in Value column.

But We want to remove first feature & want to keep only 2nd one when we click on ADD TO CART.

current code :

<?php $buttonTitle = Mage::helper('core')->quoteEscape($this->__('Add to Cart')); ?>

<button onclick="productAddToCartForm.submit(this)"><span><span><?php echo $buttonTitle ?></span></span></button>

I tried replacing onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')" but still Product is adding to cart when we click on ADD TO CART.

But we dont want to add Product to cart when we click on ADD TO CART

Edit : skin/frontend/base/default/js/msrp.js

var cartButton = $('map-popup-button');
            if (typeof this.cartLink != 'undefined') {
                if (typeof productAddToCartForm == 'undefined' || this.notUseForm) {
                    Catalog.Map.setGotoView(cartButton, this.cartLink);
                    productAddToCartForm = $('product_addtocart_form_from_popup');
                } else {
                    if (this.qty) {
                        productAddToCartForm.qty = this.qty;
                    }
                    cartButton.stopObserving('click');
                    cartButton.href = this.cartLink;
                    Event.observe(cartButton, 'click', function(event) {
                        productAddToCartForm.action = this.href;
                        productAddToCartForm.submit(this);
                    });
                }
                productAddToCartForm.action = this.cartLink;
                var productField = $('map-popup-product-id');
                productField.value = this.product_id;
                $(cartButton).show();
                $$('.additional-addtocart-box').invoke('show');
            } else {
                $(cartButton).hide();
                $$('.additional-addtocart-box').invoke('hide');
            }

1 Answer 1

1

You can rewrite controllers function responsible for add product to cart
magento1\app\code\core\Mage\Checkout\controllers\CartController.php :: addAction

4
  • Thanks for reply, is addAction function is responsible for both feature 1 & 2 , that i posted in question ? Mar 7, 2017 at 10:33
  • You want to have row with item in cart but You don't want to display it on frontend? Can't You remove or block cart / remove cart slider? Mar 7, 2017 at 10:38
  • yes i want to have row with item in cart , but dont want to add item to cart - i am planning to do this customization for another button say ADD to cart1 because for this links requirement Mar 7, 2017 at 10:41
  • I answered there. I hope it helps;) Mar 7, 2017 at 10:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.