1
votes

I am running a Magento store where someone can buy a personalized item with their name on it. Under the product, you see "Name:" with an input box where they can fill out their name. They click "Add to Cart", it ads it, I fill the order and everyone's happy.

But, in order to purchase another product with a different name, they have to go from the cart back to the product. Its a mess.

I'd like there to be a button under the "Name" field that says "Add Another". Upon click, it pulls down another field for "Name:". Now we see two name fields, I add "John" and "Joe" in the first and second fields, then click "Add to Cart".

In my cart, I now see two products added. One with Johns Name, and one with Joes.

Any and all help is greatly appreciated. I'm a Wordpress guy trying to figure out Magento!

1

1 Answers

1
votes

This is not really a simple addition, but basically you'll need to modify app/code/core/Checkout/controllers/CartController.php to call addProduct for each of the items in the form. This isn't really a trivial change, as you'll have to rip apart that method to make it load the products in sequence.

Another approach would be to use an event (such as checkout_cart_product_add_after) to keep track of when an item is added and see if extra parameters were passed, adding more items as necessary.

Alternatively, you may be able to use related products to accomplish this (since they are added to the cart as well). I haven't looked at how to approach that one, but it may be worth a look.

Hope that helps!

Thanks, Joe