Need to be able to add multiple products to the cart at the same time

If it doesn't quite fit in the other areas, put it here...
Post Reply
Blaine
Member
Posts: 6
Joined: Wed Mar 12, 2025 1:46 pm
Phoenix Version:

Need to be able to add multiple products to the cart at the same time

Post by Blaine »

I am struggling with being able to select multiple products on a page (already handled this part) and adding them all to the cart at the same time (can't figure this part out). I believe this would involve a new action that would loop through the selected products and add them to the cart with the specified quantities.

What would be the proper way to go about handling this?


Join The Code Co-op to get access to your library in the Code Co-op Forum
Omar_one
Senior Contributor
Posts: 676
Joined: Fri Oct 25, 2019 5:06 pm
Phoenix Version: v1.0.8.16
Has thanked: 100 times
Been thanked: 56 times

Re: Need to be able to add multiple products to the cart at the same time

Post by Omar_one »

Hi @Blaine
I am working on something like this.. It’s working smoothly for products without attributes right now! I'm still troubleshooting an issue where products with attributes aren't triggering correctly.
shop2.JPG
shop3.JPG
You do not have the required permissions to view the files attached to this post.
Blaine
Member
Posts: 6
Joined: Wed Mar 12, 2025 1:46 pm
Phoenix Version:

Re: Need to be able to add multiple products to the cart at the same time

Post by Blaine »

How were you able to accomplish this? Did you have to create a new action and/or class?
Omar_one
Senior Contributor
Posts: 676
Joined: Fri Oct 25, 2019 5:06 pm
Phoenix Version: v1.0.8.16
Has thanked: 100 times
Been thanked: 56 times

Re: Need to be able to add multiple products to the cart at the same time

Post by Omar_one »

Blaine wrote: Thu Jul 23, 2026 2:27 pm How were you able to accomplish this? Did you have to create a new action and/or class?
You need to create a new class. to allows you to pass either a single product ID or an array of product IDs,
check out add_product.php on actions folder includes/actions
Blaine
Member
Posts: 6
Joined: Wed Mar 12, 2025 1:46 pm
Phoenix Version:

Re: Need to be able to add multiple products to the cart at the same time

Post by Blaine »

Awesome, that's the path we were looking at taking. I am also having to override the shopping_cart class to handle MAP (minimum advertised price) rules as most of the things I sell have MAP protections on them from manufacturers.

That is something that PHX should look at implementing as it's becoming more and more common. I have added additional columns to the products table for this, products_map_price, and the plan is for the class file to evaluate the products_map_price vs the normal products_price and choose the correct price to pass to the cart. I'm coming off of an old v2.3.4.1 CE shop where those variables were set and passed directly to the cart from the product page so it's a bit of an adventure piecing all of this together. I've already handled the displaying of the MAP price on the front end modules.


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply