Jump to content

Hide unavailable combinations


Recommended Posts

Hi,

 

I have a problem about my PrestaShop. I'm using 1.5.6.0. When I create a product, I also create some combinations (size and color).

 

Lets say that I have the following combinations:

 

Color: Black

Sizes: 36 - 37 - 38

 

Color: Red

Sizes: 36 - 37

 

So, size 38 is only available to black color. But when I go to frontend to check the product, when I click the red color, the size 38 is there (it shouldn't). When a color is selected, I want to display only the available sizes. What can I do to fix this?

 

I have already disabled the option to "not to show the unavailable attributes" from the preferences tab.

Link to comment
Share on other sites

Prestashop can only do that with 1 attribute group.

 

If you use more than 1 group, you should check out the following module

 

http://www.prestashop.com/forums/topic/38061-module-attribute-wizard-customize-prestshop-attributes-control-the-group-and-item-order-add-group-images-descriptions-and-more/

 

A demo of it is available at http://144aw.presto-changeo.com/product.php?id_product=1

Link to comment
Share on other sites

  • 1 year later...
  • 2 years later...
3 minutes ago, jeff8899 said:

hi Redwert

i tried the module but nothing is changed!

how to get it work?

And you are using the correct Prestashop version for this to work ? This Topic is 4 years old now and for PS 1.5. The latest commit of github was in year 2015 -

 

Quote

 

Link to comment
Share on other sites

The script on github is not a module, but a script change. This was hot runner question also for PS 1.6. Did you tried forum search ?

Solution:

You can disable this on your back-office on TAB: Preferences -> Products. Into the Product page section, the option is: Display unavailable product attributes on the product page = NO

And in the Products stock section: Allow ordering of out-of-stock products = NO

Ensure that the products have the option: When out of stock -> Default (in the Quantities section) to get the Default configuration (in this case, Deny orders).

With this configuration, the unavailable stock combinations will not appear in the Product page.

And this is the same answer already given here in post #3 - https://www.prestashop.com/forums/topic/308751-hide-unavailable-combinations/?do=findComment&comment=1563026

After you changed the configuration, delete smarty cache and browser cache, for to don't see a cached site.

 

There are also paid addons doing that, if you are allowing customers to buy products that are out of stock:

https://addons.prestashop.com/en/combinaisons-customization/17711-enable-disable-a-combination-import-csv.html

https://addons.prestashop.com/en/additional-information-product-tab/22127-disable-out-of-stock-unavailable-product-combinations.html

Link to comment
Share on other sites

i followed the exact instruction but still not work. 

the non-exist attributes are still showing and display the message: This combination does not exist for this product. Please select another combination.

i m now a bit confused. the function of the setting Display unavailable product attributes on the product page = NO is for out of stock attributes only? or for those non-exist attributes??  

my meaning of non-exist attributes is following.

Size M, Color Pink

Size M, Color Blue

Size L, Color Blue.

 

there is no Size L, color Pink (never set this combination), but it still shows as an option with message This combination does not exist for this product. Please select another combination.

I am looking for a solution to complete hide all attribute combination which i have never set (just like the Size L, Color Pink).

 

Hope you understand what i mean.

Link to comment
Share on other sites

  • 1 month later...

I have the same problem as well. I sell clothing and have several colors that aren't offered in a 4XL so I left off the combination for the 4XL colors that aren't available.  On my product page when 4XL is selected it shows all colors, not just the ones available for 4XL. You have to click each color to find out which ones are available.  I get the This combination does not exist for this product. Please select another combination message as well. I have Display unavailable product attributes on the product page already set to no. Was a solution to this ever found?

Link to comment
Share on other sites

Thank you!! I have to look in to this module. I purchased your mass combination editor a few years back. It is hands down the best module I have ever purchased. I love that I can link a specific color shirt to a specific swatch color. It has made my job so much easier!!

Link to comment
Share on other sites

On 3/14/2018 at 1:03 PM, tomerg3 said:

vinefreshtees: Our Attribute Wizard module has this capability, as far as we know, there is no other fix for this, as it requires complex calculations.

I see you have a couple of different attribute wizards. Will all of them hide unavailable combinations or does just one specific one do that?

Link to comment
Share on other sites

5 hours ago, vinefreshtees said:

I see you have a couple of different attribute wizards. Will all of them hide unavailable combinations or does just one specific one do that?

We have 2 attribute wizards, both available for PS 1.6 and lower, or PS 1.7 and higher, and both support hiding of unavailable or out of stock combinations.

Attribute Wizard does not change the way combinations are handled, and offers product page flexibility.

Attribute Wizard Pro changes the way combinations are handled, which allows for a virtually unlimited number of attribute per product, with greater flexibility and functionality.

Link to comment
Share on other sites

  • 2 months later...

Hi everybody, I was able to solve this feature for my needs.
I tested on PS 1.6.1.17

Sorry for my english.

I took the base from https://github.com/redwert/prestashop-color-and-size

For a shoes sell site, I needed to manage several size attributes. (men size, women size, child size, mix size) 

I used 1 combo select and colors attribute for every product (more than one combo select is not needed for my purpose).

Example: for a product I have
Red -> 7, 8, 9, 10
Blue -> 8,9,10
White -> 7,9

When I click on Red, the combo is setting with size 7,8,9,10. Click on Blue, the combo only shows 8,9,10, etc.
The unavailable combinations doesn't shows.

The difference with https://github.com/redwert/prestashop-color-and-size is that the "ID Size attribute" may vary (men size, women size, child size, mix size). For clothes Size possibly one "ID Size attribute" is enough.

Thats why I assert dinamically the prefix "group_" for the select combo.


The code for HideUnavailableSizesnew.js is
 

var colorAttributteID='3'; // Set your color attribute ID - in my case is 3


$(document).ready(function(){
  var sizeList={};

// Get all the sizes availables from the unique combo select on screen

  $('select[name^="group_"] option').each(function(){ 
    if (sizeList[this.text]==undefined){
      sizeList[this.text]=$(this).val(); // get size list option values
    }    
  });

  var currentColor;
  currentColor=combination.attributes_values[colorAttributteID]; // get current color
  renewSizeList(sizeList, currentColor);
  
// Catch the click on color attribute  
  $('[name=group_'+ colorAttributteID +']').parent().children('ul').children('li').children('a').click(function(){
    currentColor=$(this).attr('name');
    renewSizeList(sizeList, currentColor);
  });
    
});

//Clear the combo select and set the combo with the corresponding sizes values for the choosen color
function renewSizeList(sizeList, currentColor){
  $('select[name^="group_"]').empty(); //clear list
  var theSize;
  var sizeAttrID;
  sizeAttrID = $('select[name^="group_"]').attr( 'id' ).substr(6); //Get the id of the
    
  for(var key in combinationsFromController) {
    if (combinationsFromController[key].attributes_values[colorAttributteID]==currentColor){ //if this combination with current color
      theSize=combinationsFromController[key].attributes_values[sizeAttrID];
        $('select[name^="group_"]').append('<option value="'+sizeList[theSize]+ '" title="'+theSize+ '">' +theSize+'</option>'); //build the select again
        }
  }
  
// Sort the combo list
  $(function() {
  // choose target dropdown
  var select = $('select[name^="group_"]');
  select.html(select.find('option').sort(function(x, y) {
    // to change to descending order switch "<" for ">"
    return $(x).text() > $(y).text() ? 1 : -1;
  }));

//Set the first option selected
      $('select[name^="group_"] option:first').attr('selected','selected');        
// Set the current value on screen - in PS above the combo select there is a <span> tag
    $('select[name^="group_"]').prev().text($('select[name^="group_"] option:first').text());
  });
};

 

I hope this works!! regards

 

Edited by Mariano (see edit history)
Link to comment
Share on other sites

On 1/6/2018 at 10:03 AM, Mariano said:

Hi everybody, I was able to solve this feature for my needs.
I tested on PS 1.6.1.17

Sorry for my english.

I took the base from https://github.com/redwert/prestashop-color-and-size

For a shoes sell site, I needed to manage several size attributes. (men size, women size, child size, mix size) 

I used 1 combo select and colors attribute for every product (more than one combo select is not needed for my purpose).

Example: for a product I have
Red -> 7, 8, 9, 10
Blue -> 8,9,10
White -> 7,9

When I click on Red, the combo is setting with size 7,8,9,10. Click on Blue, the combo only shows 8,9,10, etc.
The unavailable combinations doesn't shows.

The difference with https://github.com/redwert/prestashop-color-and-size is that the "ID Size attribute" may vary (men size, women size, child size, mix size). For clothes Size possibly one "ID Size attribute" is enough.

Thats why I assert dinamically the prefix "group_" for the select combo.


The code for HideUnavailableSizesnew.js is
 


var colorAttributteID='3'; // Set your color attribute ID - in my case is 3


$(document).ready(function(){
  var sizeList={};

// Get all the sizes availables from the unique combo select on screen

  $('select[name^="group_"] option').each(function(){ 
    if (sizeList[this.text]==undefined){
      sizeList[this.text]=$(this).val(); // get size list option values
    }    
  });

  var currentColor;
  currentColor=combination.attributes_values[colorAttributteID]; // get current color
  renewSizeList(sizeList, currentColor);
  
// Catch the click on color attribute  
  $('[name=group_'+ colorAttributteID +']').parent().children('ul').children('li').children('a').click(function(){
    currentColor=$(this).attr('name');
    renewSizeList(sizeList, currentColor);
  });
    
});

//Clear the combo select and set the combo with the corresponding sizes values for the choosen color
function renewSizeList(sizeList, currentColor){
  $('select[name^="group_"]').empty(); //clear list
  var theSize;
  var sizeAttrID;
  sizeAttrID = $('select[name^="group_"]').attr( 'id' ).substr(6); //Get the id of the
    
  for(var key in combinationsFromController) {
    if (combinationsFromController[key].attributes_values[colorAttributteID]==currentColor){ //if this combination with current color
      theSize=combinationsFromController[key].attributes_values[sizeAttrID];
        $('select[name^="group_"]').append('<option value="'+sizeList[theSize]+ '" title="'+theSize+ '">' +theSize+'</option>'); //build the select again
        }
  }
  
// Sort the combo list
  $(function() {
  // choose target dropdown
  var select = $('select[name^="group_"]');
  select.html(select.find('option').sort(function(x, y) {
    // to change to descending order switch "<" for ">"
    return $(x).text() > $(y).text() ? 1 : -1;
  }));

//Set the first option selected
      $('select[name^="group_"] option:first').attr('selected','selected');        
// Set the current value on screen - in PS above the combo select there is a <span> tag
    $('select[name^="group_"]').prev().text($('select[name^="group_"] option:first').text());
  });
};

 

I hope this works!! regards

 

Excellent! Thank you!!!

Link to comment
Share on other sites

Free module of the user -> https://www.prestashop.com/forums/profile/296558-w3bsolutions/

Attachment module

hideunavailablecombinations.zip

Is for Prestashop 1.6

Hide Nonexistent combinations PS 1.6

This module hides non-existent combinations of the product page in PS 1.6, they are not used to choose them. This avoids the message "this combination does not exist, please choose another one".
* It only works if all the attributes are shown as drop-down

Sorry for my English

Edited by nadie
update message (see edit history)
  • Like 1
Link to comment
Share on other sites

On 1/6/2018 at 3:03 PM, Mariano said:

Hi everybody, I was able to solve this feature for my needs.
I tested on PS 1.6.1.17

Sorry for my english.

I took the base from https://github.com/redwert/prestashop-color-and-size

For a shoes sell site, I needed to manage several size attributes. (men size, women size, child size, mix size) 

I used 1 combo select and colors attribute for every product (more than one combo select is not needed for my purpose).

Example: for a product I have
Red -> 7, 8, 9, 10
Blue -> 8,9,10
White -> 7,9

When I click on Red, the combo is setting with size 7,8,9,10. Click on Blue, the combo only shows 8,9,10, etc.
The unavailable combinations doesn't shows.

The difference with https://github.com/redwert/prestashop-color-and-size is that the "ID Size attribute" may vary (men size, women size, child size, mix size). For clothes Size possibly one "ID Size attribute" is enough.

Thats why I assert dinamically the prefix "group_" for the select combo.


The code for HideUnavailableSizesnew.js is
 


var colorAttributteID='3'; // Set your color attribute ID - in my case is 3


$(document).ready(function(){
  var sizeList={};

// Get all the sizes availables from the unique combo select on screen

  $('select[name^="group_"] option').each(function(){ 
    if (sizeList[this.text]==undefined){
      sizeList[this.text]=$(this).val(); // get size list option values
    }    
  });

  var currentColor;
  currentColor=combination.attributes_values[colorAttributteID]; // get current color
  renewSizeList(sizeList, currentColor);
  
// Catch the click on color attribute  
  $('[name=group_'+ colorAttributteID +']').parent().children('ul').children('li').children('a').click(function(){
    currentColor=$(this).attr('name');
    renewSizeList(sizeList, currentColor);
  });
    
});

//Clear the combo select and set the combo with the corresponding sizes values for the choosen color
function renewSizeList(sizeList, currentColor){
  $('select[name^="group_"]').empty(); //clear list
  var theSize;
  var sizeAttrID;
  sizeAttrID = $('select[name^="group_"]').attr( 'id' ).substr(6); //Get the id of the
    
  for(var key in combinationsFromController) {
    if (combinationsFromController[key].attributes_values[colorAttributteID]==currentColor){ //if this combination with current color
      theSize=combinationsFromController[key].attributes_values[sizeAttrID];
        $('select[name^="group_"]').append('<option value="'+sizeList[theSize]+ '" title="'+theSize+ '">' +theSize+'</option>'); //build the select again
        }
  }
  
// Sort the combo list
  $(function() {
  // choose target dropdown
  var select = $('select[name^="group_"]');
  select.html(select.find('option').sort(function(x, y) {
    // to change to descending order switch "<" for ">"
    return $(x).text() > $(y).text() ? 1 : -1;
  }));

//Set the first option selected
      $('select[name^="group_"] option:first').attr('selected','selected');        
// Set the current value on screen - in PS above the combo select there is a <span> tag
    $('select[name^="group_"]').prev().text($('select[name^="group_"] option:first').text());
  });
};

 

I hope this works!! regards

 

 

the part of the code:

I think also is combinationS and not combination, to avoid combination is not defined error

currentColor=combination.attributes_values[colorAttributteID]; // get current color

gave in console this error:

Uncaught TypeError: Cannot read property '3' of undefined.

 

I still using 1.6.1.18 version .. there is some fix or change to do?

 

Thanks

 

 

Link to comment
Share on other sites

  • 7 months later...
On 6/9/2018 at 3:31 PM, nadie said:

Free module of the user -> https://www.prestashop.com/forums/profile/296558-w3bsolutions/

Attachment module

hideunavailablecombinations.zip

Is for Prestashop 1.6

Hide Nonexistent combinations PS 1.6

This module hides non-existent combinations of the product page in PS 1.6, they are not used to choose them. This avoids the message "this combination does not exist, please choose another one".
* It only works if all the attributes are shown as drop-down

Sorry for my English

I looked at this module, it do look promising, but seems not to work for me at 1.6 - sadly the author is not going to maintain it anymore. Any had their luck with this solution for 1.6.1.20?

Maybe it is a theme related issue, i am not sure?

Link to comment
Share on other sites

  • 8 months later...
On 1/25/2019 at 12:32 PM, Casper_O said:

I looked at this module, it do look promising, but seems not to work for me at 1.6 - sadly the author is not going to maintain it anymore. Any had their luck with this solution for 1.6.1.20?

Maybe it is a theme related issue, i am not sure?

 

Hi, the module has several hundred downloads (via my website too) and I have not received any message that it is not working on PS 1.6.1.20. In fact, I am using it on several PS 1.6.1.24 installations. It could be a theme issue. 

Could you provide a link to a product page where it is not working? 

Cheers.

Link to comment
Share on other sites

  • 2 weeks later...

Hi

Its a long time since, but i just checked and the module is deactivated on that project. As far i remember we found an other solution.

I can tell you it was a clean store with "Warehouse theme", but i sadly don't have time right now to do more in depth check with it.

Best Regards
Casper

 

 

Link to comment
Share on other sites

  • 5 months later...
1 hour ago, kamjosi said:

Hello, shouldn´t this be integrated in PS1.7?

I can remember that I successfully checked this before the update, but now that the shop is almost finished I just noticed that it doesn't work again.

No, AFAIK this functionality has never been part of Prestashop core. Also not in 1.7. 

Link to comment
Share on other sites

ok, then my memory was not wrong. But I tested it today morning and it do not work anymore.

I figured out that the wright combinations appear after reloading the website but the attributes do not adjust by themself currently. need to figure out whats the problem.

 

Thanks so far.

Link to comment
Share on other sites

  • 4 months later...

My store has the regular color / size combinations and this behavior is horrible. I have this issue at version 1.7.6.7 and is causing a lot of incorrect orders since I moved from 1.6, so I went ahead and debug the code. After a while I think I'd found the bug and post a PR here: https://github.com/PrestaShop/PrestaShop/pull/20565

It is really late by now but it works. With that you only see what you can buy and it let you switch to other combinations that have stock. It also allows the "allow to order without stock" if you enable it. That part of the code was really complex to find/debug and I'm exhausted, so probably the PR will get rejected by code standards or something like that. 

If anyone is willing to test that code and post the comments in the PR or just modify it to apply the PR standards I'll really appreciate the help.

Edited by Lucas (see edit history)
Link to comment
Share on other sites

  • 1 month later...
  • 4 months later...
On 9/14/2020 at 9:28 PM, ELEGANTAL said:

There are 2 settings in Shop Parameters / Product Settings page that should be disabled:

  1. "Display unavailable product attributes on the product page" => should be NO
  2. "Allow ordering of out-of-stock products" => should be NO

 

I have set them to no both but if I enter the product page I always see the color not available. Where am I wrong?

I have 1.7.7.0 version

thanks a lot

Edited by riga75 (see edit history)
Link to comment
Share on other sites

@riga75, it looks like my patch has been pushed until 1.7.8.0....

You may apply the patch manually into your PS installation (make sure you have a good backup of controllers/front/ProductController.php before continuing)

It is only one file https://github.com/PrestaShop/PrestaShop/pull/20565/files or you can also run https://github.com/PrestaShop/PrestaShop/pull/20565.patch

Best,

Link to comment
Share on other sites

On 3/14/2018 at 9:32 PM, vinefreshtees said:

I have the same problem as well. I sell clothing and have several colors that aren't offered in a 4XL so I left off the combination for the 4XL colors that aren't available.  On my product page when 4XL is selected it shows all colors, not just the ones available for 4XL. You have to click each color to find out which ones are available.  I get the This combination does not exist for this product. Please select another combination message as well. I have Display unavailable product attributes on the product page already set to no. Was a solution to this ever found?

Damm even I am having a similar kind of issue, I have searched all over the internet and even have posted on number of threads on different forum, no solution seems to work. I am really frustrated, can anyone of you here help me resolve this issue, I am very much tired now. get-vidmate.com instasave.onl

Edited by feedtaleone (see edit history)
Link to comment
Share on other sites

  • 3 months later...
  • 2 months later...
On 6/1/2018 at 6:03 PM, Mariano said:

Hi everybody, I was able to solve this feature for my needs.
I tested on PS 1.6.1.17

Sorry for my english.

I took the base from https://github.com/redwert/prestashop-color-and-size

For a shoes sell site, I needed to manage several size attributes. (men size, women size, child size, mix size) 

I used 1 combo select and colors attribute for every product (more than one combo select is not needed for my purpose).

Example: for a product I have
Red -> 7, 8, 9, 10
Blue -> 8,9,10
White -> 7,9

When I click on Red, the combo is setting with size 7,8,9,10. Click on Blue, the combo only shows 8,9,10, etc.
The unavailable combinations doesn't shows.

The difference with https://github.com/redwert/prestashop-color-and-size is that the "ID Size attribute" may vary (men size, women size, child size, mix size). For clothes Size possibly one "ID Size attribute" is enough.

Thats why I assert dinamically the prefix "group_" for the select combo.


The code for HideUnavailableSizesnew.js is
 

var colorAttributteID='3'; // Set your color attribute ID - in my case is 3


$(document).ready(function(){
  var sizeList={};

// Get all the sizes availables from the unique combo select on screen

  $('select[name^="group_"] option').each(function(){ 
    if (sizeList[this.text]==undefined){
      sizeList[this.text]=$(this).val(); // get size list option values
    }    
  });

  var currentColor;
  currentColor=combination.attributes_values[colorAttributteID]; // get current color
  renewSizeList(sizeList, currentColor);
  
// Catch the click on color attribute  
  $('[name=group_'+ colorAttributteID +']').parent().children('ul').children('li').children('a').click(function(){
    currentColor=$(this).attr('name');
    renewSizeList(sizeList, currentColor);
  });
    
});

//Clear the combo select and set the combo with the corresponding sizes values for the choosen color
function renewSizeList(sizeList, currentColor){
  $('select[name^="group_"]').empty(); //clear list
  var theSize;
  var sizeAttrID;
  sizeAttrID = $('select[name^="group_"]').attr( 'id' ).substr(6); //Get the id of the
    
  for(var key in combinationsFromController) {
    if (combinationsFromController[key].attributes_values[colorAttributteID]==currentColor){ //if this combination with current color
      theSize=combinationsFromController[key].attributes_values[sizeAttrID];
        $('select[name^="group_"]').append('<option value="'+sizeList[theSize]+ '" title="'+theSize+ '">' +theSize+'</option>'); //build the select again
        }
  }
  
// Sort the combo list
  $(function() {
  // choose target dropdown
  var select = $('select[name^="group_"]');
  select.html(select.find('option').sort(function(x, y) {
    // to change to descending order switch "<" for ">"
    return $(x).text() > $(y).text() ? 1 : -1;
  }));

//Set the first option selected
      $('select[name^="group_"] option:first').attr('selected','selected');        
// Set the current value on screen - in PS above the combo select there is a <span> tag
    $('select[name^="group_"]').prev().text($('select[name^="group_"] option:first').text());
  });
};

 

I hope this works!! regards

 

is it available for PS 1.7. ? 
actually am not be able to upload this module to my PS website 
then i found another way to add given js to my custom.js file.

 

Edited by nimra (see edit history)
Link to comment
Share on other sites

  • 1 month later...
On 8/13/2020 at 8:20 AM, Lucas said:

My store has the regular color / size combinations and this behavior is horrible. I have this issue at version 1.7.6.7 and is causing a lot of incorrect orders since I moved from 1.6, so I went ahead and debug the code. After a while I think I'd found the bug and post a PR here: https://github.com/PrestaShop/PrestaShop/pull/20565

It is really late by now but it works. With that you only see what you can buy and it let you switch to other combinations that have stock. It also allows the "allow to order without stock" if you enable it. That part of the code was really complex to find/debug and I'm exhausted, so probably the PR will get rejected by code standards or something like that. 

If anyone is willing to test that code and post the comments in the PR or just modify it to apply the PR standards I'll really appreciate the help.

Hello, is there any solution for 1.6 ? Thanks

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...