1

In my theme (bought from themeforest) Configurable swatches is integrated technically but not working functionaly. I can see the swatches in my Product page but when I click on them upon add to cart its showing error "Please select item". When I disable the Configurable swatches then traditional drop-down field is come up and its working.

So I wanted to know why configurable watches is not working? Googled a lot but no answer. Please guys help me in that.

This is the link : https://www.myshopingkart.com/clothing/men/haute-denim-navy-blue-main.html

Configurable Swatches

This the error when I click on the swathces..

Configurable Swatches-error

2
  • check if your select is inside of <form> – zhartaunik May 4 '15 at 17:29
  • I didn't alter any code. So its definately inside the form. Disabling Magento's Native Configurable Swatch is making it work, but I want Config swatches to be worked. There must be a solution. Please help. – Westzonesolution Corp May 5 '15 at 13:20
1

You have problems with Javascript:

$('.btn-cart-single').bind("click",function(){  
        re = 1;
        proId = $("#proId").val();
        curQty = $('#qty').val();
        minQty = $('#min_qty_stock').val();
        maxQty = $('#max_qty_stock').val();
        qtyStock = $('#qty_stock').val();
        qtyStock_1 = $('#qty_stock').val();
        if ( manage_stock == 0 ){
            qtyStock = maxQty + 1;
        }
        if( minQty==''&&maxQty==''&&qtyStock=='' ){
            alert('Please, select item');
            return false;
        }....

When you try to test in console ()

        minQty = jQuery('#min_qty_stock').val();
        maxQty = jQuery('#max_qty_stock').val();
        qtyStock = jQuery('#qty_stock').val();

The 3 vars show empty "" Try to check when the elements #min_qty_stock, #max_qty_stock, #qty_stock is filled

<span class="quantity-box">

                    <input type="text" name="qty" id="qty" maxlength="12" value="1" title="Qty" class="quantity-input qty">                     
                    <input type="hidden" id="min_qty_stock" name="min_qty_stock" value="">                      
                    <input type="hidden" id="max_qty_stock" name="max_qty_stock" value="">
                    <input type="hidden" id="qty_stock" name="qty_stock" value="">
                    <input type="button" class="quantity-controls quantity-plus" onclick="$('qty').value=Number($('qty').value)+1" value="">    
                    <input type="button" class="quantity-controls quantity-minus" onclick="if(Number($('qty').value)>1){$('qty').value=Number($('qty').value)-1;}" value="">                    
                </span>
11
  • But when I disable the Configurable Swatch, its working. And the script remains same as you have stated above. Then What changes should I make to get the Configurable Swatches working? – Westzonesolution Corp May 5 '15 at 11:58
  • Can you disable? I will check it – osrecio May 5 '15 at 13:41
  • Sure. Wait a minute. Are u on Gtalk or Skype? Mine westzonesolution1@gmail.com / Skype: amitretail2008 – Westzonesolution Corp May 5 '15 at 13:51
  • The Config Swatch is disabled. – Westzonesolution Corp May 5 '15 at 13:52
  • Now when I make in console : minQty = jQuery('#min_qty_stock').val(); maxQty = jQuery('#max_qty_stock').val(); qtyStock = jQuery('#qty_stock').val(); it show me qty's. Check please my answer. "Try to check when the elements #min_qty_stock, #max_qty_stock, #qty_stock are filled" – osrecio May 5 '15 at 13:56
0

Check for the javascript error from firebug ,if there isn't any javascript bug or you are unable to debug it. Simply what you can do is disable your current configurable swatches and Try this swatches extension - https://github.com/tzyganu/Switcher

1
  • I want to use Magento's own Configurable Swatches. So what error is there in my script. – Westzonesolution Corp May 5 '15 at 12:00
0

I had the same problem. I solved by adding the following javascript code (just before the comment // validated configurable):

// validate configurable swatches
$('.swatch-link').bind("click",function(){
    id = $(this).attr('id');
    id = id.replace("swatch","");
    value = $('#minQty_'+id).val();
    $('#min_qty_stock').val(value);
    value = $('#maxQty_'+id).val();
    $('#max_qty_stock').val(value);
    value = $('#qty_stock_'+id).val();
    $('#qty_stock').val(value);
    manage_stock = $('#manage_stock_'+id).val();
});

in the following file:

app/design/frontend/[YOUR_THEME]/default/template/catalog/product/view/addtocart.phtml

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.