Show all product variations in a table on single product template
Continuing the discussion from http://jigoshop.com/topic/show-all-product-variations-in-a-table-on... regarding showing a table of all available product variations instead of the select/dropdown.
I was able to make this work by overriding the function
jigoshop_variable_add_to_cart, since every product in
the site is displayed this way. Thanks to jigoshop for allowing
overrides on these functions.
I ended up having to remove some actions in
jigoshop_template_single_summary, then added back in
the ones I needed.
I'm going to keep working on this and hopefully split it out of my theme's functions.php file to provide better separation. I'm hoping to put it into a plugin or add on of sorts, make it portable for myself and others to use.
2 Posted by Matt on 04 Nov, 2011 03:00 AM
What was the override you used? :)
3 Posted by jevets on 04 Nov, 2011 03:54 PM
When moving it a plugin and out of my theme, I ran into issues with the override. So instead I just defined my own function to avoid dealing with that override. This is good anyway, since I'm planning on creating some kind of per-product setting that allows the user to choose to show the variations table on a per-product level.
So here's a first stab at the plugin. Note the TODOs. This isn't much different than
jigoshop_variable_add_to_cart.4 Posted by jevets on 04 Nov, 2011 03:57 PM
By the way, here's an example showing what this does.
5 Posted by jevets on 09 Nov, 2011 11:25 PM
If you use the plugin I've added above, a slight change needs to be made to support multiple attribute sets on a given product (i.e. Size, Color, Sleeve Length)
In the plugin file around line 130, modify the hidden input that looks like
<input type="hidden" name="<?php echo $att ?>" value="<?php echo $val ?>" />and replace that whole line with:
This provided the appropriate hidden input to allow adding to cart.
6 Posted by Aina on 16 Nov, 2011 07:30 PM
Great plugin!!!
Thks to share it!
7 Posted by Casey on 04 Dec, 2011 09:32 PM
Hello-
Awesome plug-in...
I am having issues with the variation (title) showing up in the table... do you have any suggestions?
8 Posted by jevets on 07 Dec, 2011 01:39 AM
@Casey, could you elaborate on what you're problem is?
9 Posted by jeitnier on 09 Dec, 2011 07:10 PM
Jevets, I just posted a similar request and Matt pointed me at this post. I am looking for something that will keep my drop-down variations intact but instead of animating a jQuery price variable on every variation change (sliding up then down every time), I just want the price to stay static in one spot. What do you propose?
10 Posted by cyberpundit on 10 Dec, 2011 04:49 AM
This functionality is exactly what I'm looking for, except a different display format. A simple dropdown of variations instead of laundry list in a table with so many Add to Cart buttons.
Is it possible to show just one "Add to Cart" and show the variations in a dropdown menu? The Add to Cart should not work until a specific variation has been selected from this menu.
Showing a gazillion variations in a table is not good design at all.
Welcome thoughts on how to do this..
(Btw, theming of a cart should really be much easier than all these functions and removing/adding back functionality).
Thanks!
11 Posted by jeitnier on 10 Dec, 2011 03:00 PM
cyberpundit, if I don't get a response from jevets today I'm going to try to tackle this on my own. I will probably load his plugin to start and take it from there. My Javascript skills are just terrible though :( I will keep progress updated as I go along.
12 Posted by jevets on 10 Dec, 2011 03:18 PM
@Jared, you'll probably have to duplicate and modify the javascript used to display the prices. It's probably as simple as changing the slide effect to a different effect or removing the effect altogether.
@cyber, it's not UNfriendly. It's good design, especially when considering the purpose of the plugin. The whole point of the plugin is to show all variations in a table so the user can scan vertically; also it's a very usable fallback for when the user's browser doesn't support javascript, as this plugin requires no javascript.
This is the default jigoshop behavior; you won't need to use this plugin.
13 Posted by cyberpundit on 10 Dec, 2011 03:23 PM
"This is the default jigoshop behavior; you won't need to use this plugin."
Wait, this has me confused. Is the plugin you're referring to JigoShop? Or some other plugin? Or the Wordpress plugin called JigoShop has some other plugins inside it?
I use JigoTheme and I need a simple functionality: for some products I need a variation of color or something else. How should I add this to the cart functionality? Showing it inside a dropdown is the single most user-friendly way and it does NOT require javascript.
Also, this dropdown should appear somewhere around the Add to Cart button so the shopper can select a variation to buy. As such, showing it as a list in a table is UTTERLY USELESS.
Welcome your thoughts.
14 Posted by jevets on 10 Dec, 2011 03:43 PM
@cyber, jigoshop is a plugin for WordPress. This forum thread is about a tiny plugin I wrote that modifies jigoshop's output, to show all product variations in a table, each with an image, title and add to cart button. My client's project required this behavior, so I kindly shared what I've built.
To do what you're looking to do, see jigoshop docs on creating variable/configurable products. This built-in behavior of jigoshop will show variations in a dropdown (i.e. Color: red, blue, green; Size: s, m, l, xl)
http://forum.jigoshop.com/kb/setting-up-your-store/setting-up-confi...
My plugin is not useless; it just doesn't apply to your needs. Don't use it.
My client's use case is certainly justified and with some css customization, it's actually quite a nice shopping experience.
15 Posted by Dusan on 04 Apr, 2012 03:09 PM
Hi, is the plugin up to date? I cant seem to get it work on my site properly. After activating the plugin all I get on my product page is a link "available configurations" but there aren't any shown.
Could you please provide an exact "howto" to make it work?
Thanks and thumb up for providing the plugin to community!
Support Staff 16 Posted by ivica on 04 Apr, 2012 03:12 PM
Link to see it?
17 Posted by Dusan on 04 Apr, 2012 03:21 PM
Yep, of course :-)
http://www.cajovnazarohom.sk/e-shop/keemun-yi-hong-fop
I cant keep the plugin activated for too long because its crippling my product page but I will it keep it active for some time so you can have a look at the problem.
THANX
18 Posted by jevets on 04 Apr, 2012 03:31 PM
I have not updated this plugin for the latest version of jigoshop. I probably will at some point in the future, but no plans nor time to do so for now.
19 Posted by Dusan on 04 Apr, 2012 03:38 PM
Thanx for your reply jevets!
Is there any other way to display variations with their prices on a product page?
I badly need the customers to be able to see the price of the variation on the product page and I cant afford to write it manually in the description.
At least, is there a way to show the variation price next to the variation name in the drop-down variation selection?
Thanx for your ideas!
Support Staff 20 Posted by ivica on 04 Apr, 2012 05:52 PM
"At least, is there a way to show the variation price next to the variation
name in the drop-down variation selection?"
It would be possible to write the price next to all variation quantities
(e.g. 100 g (10 EUR)), if all products would have the same prices for
particular variations, but this is impossible... It would be needed some
new (technical) solution/customization.
21 Posted by Dusan on 05 Apr, 2012 12:02 PM
Thanx Ivica for your reply.
Well, as you wrote yourself, I cant have the same prices for different products, for now Ill have to write the prices per variations in the description field on the product page and have customers choose the variation from a dropdown selection.
Ivica, I thought I've seen you writing something about you building a tea e-shop, could you please provide a link so I could check your work?
Thank you!
Support Staff 22 Posted by ivica on 05 Apr, 2012 03:35 PM
No pro Dusan, as for other question you are right, here it is link (shop is
messy as a lot of testings were done, with some bugs to be solved :-))
23 Posted by Dusan on 05 Apr, 2012 04:30 PM
Ivica, I am afraid I cant see a link to your site, maybe it was reformatted by forums default formatting. If its ok with you you could send it to my email address: [email blocked]
Thanx and maybe we could help each other out with something.
24 Posted by Dusan on 05 Apr, 2012 04:32 PM
oops, lets try this: d u s a n b l a h o @ y a h o o . c o . u k
25 Posted by sandra harries on 04 May, 2012 11:52 AM
Hi I have the same issue as Dusan
After activating the plugin all I get on my product page is a link "available configurations" but there aren't any shown.
Is there something I can do to make it work. My client really wants this feature.
Here is a link to see the page.
http://lovizart.lotzasigns.com.au/shop/example-print-2/
26 Posted by sandra harries on 04 May, 2012 11:42 PM
Just looked at your site Dusan. Just wondering how you solved the plugin issue. Any help would be greatly appreciated.
27 Posted by dusan on 05 May, 2012 06:33 PM
Hi Sandra,
What you have seen on my site is all done by using grouped products. Its not an ideal solution but it works.
Hope this helps, if not let us now.
Dusan
28 Posted by sandra harries on 06 May, 2012 01:42 AM
Thanks for your reply Dusan. I will have a look at product grouping
29 Posted by mainpart on 21 Sep, 2012 06:11 AM
Found error and suggesting fix:
function gwd_jigoshop_vt_add_to_cart() {....$children = $_product->get_children();return array of STRINGS.
array(2) { [0]=> string(3) "402" [1]=> string(3) "403" }
which makes useless following usage of:
foreach($children as $child) {$variation = $child->product;INSTEAD USE on last string: