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?
Need to be able to add multiple products to the cart at the same time
-
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
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.
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.
You do not have the required permissions to view the files attached to this post.
Re: Need to be able to add multiple products to the cart at the same time
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
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
Re: Need to be able to add multiple products to the cart at the same time
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.
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.