- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Magento 1.9 pop-up modal/alert on add to cart
Hi guys, I am working to create a theme based on the rwd theme, and I would like a modal pop-up or a simple alert box when the add to cart is clicked. I know how id' achieve this in normal websites with bootstrap etc. But, lost as how to achieve this in magento.
If anyone could even guide me to the location of the code responsible for the add to cart function: where the product gets added and redirected to the shopping cart page; i'd be extremely grateful.
Update
<script type="text/javascript"> //<![CDATA[ var productAddToCartForm = new VarienForm('product_addtocart_form'); productAddToCartForm.submit = function(button, url) { if (this.validator.validate()) { var form = this.form; var oldUrl = form.action; if (url) { form.action = url; } var e = null; try { this.form.submit(); } catch (e) { } this.form.action = oldUrl; if (e) { throw e; } if (button && button != 'undefined') { button.disabled = true; } } }.bind(productAddToCartForm); productAddToCartForm.submitLight = function(button, url){ if(this.validator) { var nv = Validation.methods; delete Validation.methods['required-entry']; delete Validation.methods['validate-one-required']; delete Validation.methods['validate-one-required-by-name']; // Remove custom datetime validators for (var methodName in Validation.methods) { if (methodName.match(/^validate-datetime-.*/i)) { delete Validation.methods[methodName]; } } if (this.validator.validate()) { if (url) { this.form.action = url; } this.form.submit(); } Object.extend(Validation.methods, nv); } }.bind(productAddToCartForm); //]]> </script>
This is the code I believe handling the 'Add to cart' function. Now, I need to figure out how if 'valid' then alert.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Magento 1.9 pop-up modal/alert on add to cart
lots of free extension available for this
https://www.magentocommerce.com/magento-connect/ajax-cart-popup.html
Magento Programmer | Was my answer helpful? You can accept it as a solution.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Magento 1.9 pop-up modal/alert on add to cart
Came across that extension before: Would I be able to customise the modal pop-up?
I just need the pop-up to be as such:
Would you also like to order product B?
[No] [Yes]
-IF no go to checkout
-IF YES go to product B product page.