The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

Error in cart if you add no items

drwagner13drwagner13 Member
in Help edited November 2008
In attempting to make it possible to add items to the cart using checkboxes, I have found that if the user presses the submit button with no items selected (no checkboxes checked, the cart comes up and says:

ERROR:
You must specify a name to add a product to your shopping cart.

What would be the most elegant way to handle this situation? Use some js and an alert onclick, and then somehow prevent the cart form coming up?

(Incidentally, this is a huge amount of work I'm doing for such a simple, and I daresay common, bit of online store functionality).
Comments
  • brettbrett FoxyCart Team
    edited November 2008
    You can use the fc_PreProcess() function to prevent the cart from loading if no products are selected:
    http://wiki.foxycart.com/docs:json

    Let me know if that's what you're looking for.

    What behavior would you like to see on an empty add-to-cart request? Just load up the cart without an error?
Sign In or Register to comment.