No Javascript for Attributes/Variations
Hi. For my website, I will be selling t-shirts and therefore need to set up attributes for different sizes. All sizes will be the same price.
I have been able to remove all the details (availability, price, quantity) within the javascript involved in the selection of an attribute on the single product page. Only the "Add to Cart" button is left. Is it possible to remove the javascript all together and leave the "add to cart" button static on the page?
If this is possible, then there needs to be one more minor modification as well. 1) A message that pops up if the customer does not select a size OR 2) a default attribute (e.g. "medium) is selected from the beginning instead of "choose an option".
Thank you in advance!
2 Posted by Matt on 09 Nov, 2011 01:49 PM
Hi,
See if this thread can help you. A user had a similar request as you did (if I'm interpreting yours correctly!).
Matt
3 Posted by alexchan1292 on 09 Nov, 2011 05:51 PM
Thanks for the reply and the link. Is there a way to actually keep the dropdown but simply have one static "add to cart" button that registers the selected attribute? I prefer not to have an entire table with multiple cart buttons.
4 Posted by jeitnier on 09 Dec, 2011 06:44 PM
Matt,
We were just talking about this. alexchan1292 described exactly what I am looking for.
5 Posted by willthemoor on 15 Mar, 2012 06:28 AM
I got around this with a bit of a hack. It'd be really great if the JigoShop JS functions we written as jQuery plugins or attached to a global object so they could be easily overridden without hacking plugin files.
I worked it out in three steps.
1) In your theme's css file:
.variations_button { display: block !important; }2) in the plugin's script.js file, comment out this line
//jQuery('.variations_button, .single_variation').slideUp();3a) add this to your theme's js file (inside of document.ready()):
`$('.variations_button input[type=submit]').bind('click', variationCheck);
3b) and this after document.ready();
var variationCheck = function(e){
};`
1) forces the button to show on page load
2) stops the button from hiding when the select is changed
3) prevents the form from submitting if no variation has been selected
This is an old thread so maybe there's a better way around this now that I've just missed.
Will