VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: thewolf79 on October 24, 2012, 12:46:22 PM

Title: Add multiple items to cart in one click
Post by: thewolf79 on October 24, 2012, 12:46:22 PM
Dear all,

Is it possible to add an 'Add To Cart' button to the Category View? I've searched a lot, and I've come across some solutions that were close, but not quite there yet.
I do not mean a per-product button, but a button that adds all products in current view with quantity larger than '0'. I'm not looking for a solution like "Product Builder" or the "Multi Product Express Order Form Content Plugin" as well, as these are not flexible enough (i.e. when I add a new product or remove a discontineud product I will need to change all forms manually).

I want my shoppers to be able to say "I want 1 bread, 5 drinks and 2 meat, now add all of these to the cart."

Basically, I want to change this: (link no longer working) http://www.leenmenken.com/vmfiles/Knipsel1.JPG (http://www.leenmenken.com/vmfiles/Knipsel1.JPG)
into a working version of this: (link no longer working) http://www.leenmenken.com/vmfiles/Knipsel2.JPG (http://www.leenmenken.com/vmfiles/Knipsel2.JPG)

Any help is much appreciated!

I use VM 2.0.12f with Joomla 2.5.7
I have average knowledge of HTML, CSS.
(I'm able to understand basic PHP and JS, however, writing from scratch is a challenge)

Kind regards
Title: Re: Add multiple items to cart in one click
Post by: luizwbr on October 24, 2012, 12:54:35 PM
Hi @thewolf79, i made a plugin which to that.

Just look this plugin in post "VM - Custom, Multiple Products to Cart": http://forum.virtuemart.net/index.php?topic=107834.msg360564#msg360564 (http://forum.virtuemart.net/index.php?topic=107834.msg360564#msg360564)

But if I had a way to do this natively, would be better.
Title: Re: Add multiple items to cart in one click
Post by: thewolf79 on October 24, 2012, 13:10:16 PM
Quote from: luizwbr on October 24, 2012, 12:54:35 PM
Hi @thewolf79, i made a plugin which to that.

Just look this plugin in post "VM - Custom, Multiple Products to Cart": http://forum.virtuemart.net/index.php?topic=107834.msg360564#msg360564 (http://forum.virtuemart.net/index.php?topic=107834.msg360564#msg360564)

But if I had a way to do this natively, would be better.

Thank you luizwbr,

During my search I saw your solution as well. I understand you can make use of parent-child connections, however, my products do not have parent products.
For clarification, this is a part of my category tree. I don't see how I could use parent-child product relations in here.

Restaurant Chain X
|_Food
   |_Frozen
      |_Bread
         |_ product A
         |_ product B
         |_ ...
      |_Meat
         |_ product C
         |_ product D
         |_ ...
      |_...
   |_Chilled
      |_Vegetables
         |_ product E
         |_ ...
      |_...
   |_Ambient
      |_Drinks
         |_ product F
         |_ ...
      |_...
|_Non-Food
   |_Cleaning
      |_ product G
      |_ ...
   |_...

Or should I use the category name as a parent product?

Thanks again!

Kin regards
Title: Re: Add multiple items to cart in one click
Post by: balai on October 24, 2012, 16:14:11 PM
Quote from: thewolf79 on October 24, 2012, 12:46:22 PM
I'm not looking for a solution like "Product Builder" or the "Multi Product Express Order Form Content Plugin" as well, as these are not flexible enough (i.e. when I add a new product or remove a discontineud product I will need to change all forms manually).

Im don't think that this happens with Product Builder.
It follows all the Virtuemart rules like the checkstock. Also connecting a group with a category,will display all the current products of that category (even the new).
Title: Re: Add multiple items to cart in one click
Post by: thewolf79 on October 24, 2012, 16:58:05 PM
Thank you balai,

But I'm stil not sure if Product Builder is what I need, but maybe I'm missing something here ...

Is it possible, with Product Builder, to select a certain category, and see all of its products in that category and subcategories, so I can build my order from that?
When I select 'Bread', for example, I want to able to order 6x White Bread  -AND-  4x Brown Bread.
I do not want to choose between White or Brown, so groups are no use to me.
Or do I need to make a non-editable group for each product then?

Thanks,

Kind regards
Title: Re: Add multiple items to cart in one click
Post by: balai on October 24, 2012, 18:01:06 PM
QuoteOr do I need to make a non-editable group for each product then?
For your project i think that this is the case
Title: Re: Add multiple items to cart in one click
Post by: thewolf79 on October 24, 2012, 21:12:33 PM
Quote from: balai on October 24, 2012, 18:01:06 PM
For your project i think that this is the case

I assume that creating a group for each product is not done automatically when adding or uploading a new product?
In that case, unfortunately, Product Builder is not what I'm looking for. But thank you anyway!

Is there anyone with a better solution?
So far I've managed to create a custom category view that builds a single form in a table, with all products in that category, and each product with its own quantity box. Now I need the code to loop through each quantity box on that form and add the product and amount to the cart if amount > 0
I've read somewhere that you can use arrays to send multiple product id's and amounts to the cart, but my PHP and JS coding skills are insufficient for this ... Is there anyone who can point me in the right direction, or is this simply not possible?
Title: Re: Add multiple items to cart in one click
Post by: marcelmarnix on December 08, 2013, 10:16:52 AM
How did you solve this?

I want to do the same for a takeaway.