Jump to content

Ajax Add to Cart Not Working Properly


Recommended Posts

Hello,

 

Current dev site: www.rcplanet.info

 

Problem: My add to cart ajax works if your cart is zero and or have not refreshed when you do have an item, however if you refresh or visit another category page and try to add to the cart the popup will not appear. Debugger says: TypeError: domIdProduct is undefined (line 451 of ajax-cart.js) this document is the original. I have only modified the blockcart tpl file and css via the theme directory. The ajax post looks correct.

 

How to replicate:

1) Visit any category.

 

2) Click "Add to Cart" on any product on the category page, the ajax popup will work as expect. As long as you stay on this page without refreshing you can continue to add products without problem.

 

3) Refresh the page or visit another category page.

 

4) Click "Add to Cart" on any product, nothing will happen except the number in the header cart status will update but it will not have the new product details in the mouseoverlay and no popup will appear.

 

It seems like it is having trouble deleting or replacing something in the cart but I don't know why it would be trying to remove a product while trying to add one? I don't know much about this module so I thought I would ask here, thank you in advanced for any assistance.

Edited by kendo101 (see edit history)
Link to comment
Share on other sites

I solved my problem. The reason was in the blockcart.tpl file I modified the area where it listed products and added a header element as a <dl> class. Apparently the ajax-cart.js will see as an actual product and try to handle it, thus throwing the error when it can't do anything to it (I think it was trying to remove it from the cart). I had to move my table header outside of that div for it to function properly.

Edited by kendo101 (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...