hxiao Posted February 1, 2007 Posted February 1, 2007 Although I have no problems with basic PHP and HTML and such, I have a problem that I haven't been able to come up with the solution to: I have a PHP wizard that works, that the user can use to figure out which products they would like to order. At the end of the wizard, I would like for those products to be added to the shopping cart all at once. I can get the product IDs, but I'm not sure how I'd go about adding all of them to the shopping cart at the same time with basically a button click. Does anyone have any idea on how to get this done, or if it can be done? Any help would be greatly appreciated. Thanks!
wheeloftime Posted February 1, 2007 Posted February 1, 2007 Although I have no problems with basic PHP and HTML and such, I have a problem that I haven't been able to come up with the solution to: I have a PHP wizard that works, that the user can use to figure out which products they would like to order. At the end of the wizard, I would like for those products to be added to the shopping cart all at once. I can get the product IDs, but I'm not sure how I'd go about adding all of them to the shopping cart at the same time with basically a button click. Does anyone have any idea on how to get this done, or if it can be done? Any help would be greatly appreciated. Thanks! Create a loop where inside you mimick the buy now button.
Velveeta Posted February 1, 2007 Posted February 1, 2007 Although I have no problems with basic PHP and HTML and such, I have a problem that I haven't been able to come up with the solution to: I have a PHP wizard that works, that the user can use to figure out which products they would like to order. At the end of the wizard, I would like for those products to be added to the shopping cart all at once. I can get the product IDs, but I'm not sure how I'd go about adding all of them to the shopping cart at the same time with basically a button click. Does anyone have any idea on how to get this done, or if it can be done? Any help would be greatly appreciated. Thanks! Yeah you can just make a form with one button that says Finish or whatever (since you said this is a wizard-style interface), and that form could just be populated with hidden values of the product_id's that you want to add like this: <form method="post" action="index.php?action=add_all_to_cart"> <input type="hidden" name="products_id[]" value="32"> <input type="hidden" name="products_id[]" value="47"> <input type="hidden" name="products_id[]" value="27"> <input type="hidden" name="products_id[]" value="61"> <input type="hidden" name="products_id[]" value="173"> <input type="submit" name="submit" value="Finish"> </form> Then you just add a new section to application_top.php that processes the "add_all_to_cart" just like it does the add_product or buy_now sections, but loop through $HTTP_POST_VARS['products_id'] and make a call to the cart function to add it for each individual value, then redirect to the shopping cart page or wherever you want to dump them afterward... Richard Richard Lindsey
hxiao Posted February 2, 2007 Author Posted February 2, 2007 Thanks very much for the tip. I'll get working on it.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.