Please refer to TemplateMonster Support for any issues surrounding TemplateMonster/TemplateTuning Themes – thanks, Jigoshop Team

No Javascript for Attributes/Variations

alexchan1292's Avatar

alexchan1292

09 Nov, 2011 03:35 AM

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!

  1. 2 Posted by Matt on 09 Nov, 2011 01:49 PM

    Matt's Avatar

    Hi,

    See if this thread can help you. A user had a similar request as you did (if I'm interpreting yours correctly!).

    Matt

  2. 3 Posted by alexchan1292 on 09 Nov, 2011 05:51 PM

    alexchan1292's Avatar

    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.

  3. 4 Posted by jeitnier on 09 Dec, 2011 06:44 PM

    jeitnier's Avatar

    Matt,

    We were just talking about this. alexchan1292 described exactly what I am looking for.

  4. 5 Posted by willthemoor on 15 Mar, 2012 06:28 AM

    willthemoor's Avatar

    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){

    if($('.variations').length){
        // make sure something is selected
        if($('.variations select>option:eq(0)').is(':selected')){
            // show an error if not and stop the form submit
            $('.summary').before('<div class="jigoshop_error">Please choose a product type…</div>');
            e.preventDefault();
    
            // hide the error on change because that's what your mother would want.
            $('.variations select').change(function(){
                $('.summary').prev('.jigoshop_error').remove();
            });
        }
    }
    

    };`

    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

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.