Jump to content

Unavailable product attributes on product page


Recommended Posts

Hello

 

As the title says.... i have different combinations of products, for example jacket in color black, in sizes L, M, S and in white in size L. But, for the white combination it is displaing also the sizes M and S. In the configuration - "Display unavailable product attributes on product page" is set to "no". What is wrong please?

Presta version 1.4.4.0

Link to comment
Share on other sites

Hi tonis,

It looks to me that the combinations were generated incorrectly in this situation. Our Combination Generator function is great if you have every product in the same colors and sizes, but otherwise it is important that you create each combination individually through the Combinations tab of the product in your catalog.

 

I hope this helps.

 

-Mike

Link to comment
Share on other sites

  • 2 months later...
  • 1 month later...
  • 5 months later...

I am having an issue with the message that pops up when a certain attribute is not available ... part of the message is duplicated and I would like to know where to go to change it ... here is what it currently looks like now if you select the size that has 0 Qty

 

Availability: This product is no longer in stock with these options but is available with others with those attributes but is available with other

 

I would simply like to end the statement as follows: Availability: This product is no longer in stock with these options but is available with others

Link to comment
Share on other sites

  • 3 weeks later...

Hello, all.

This is script hide unavailable product attributes:

$(function(){

 var groupIds=new Array();
 $('select[id^="group_"]').each(function(){
groupIds.push(this.id);
 });
 var allCombinations=new Array();
 $.each(combinations,function(key,combination){
allCombinations.push(combination['idsAttributes']);
 });

 $('select[id^="group_"]').change(function(){checkCombination()});
 checkCombination();

 function checkCombination()
 {
$('select[id^="group_"] option').removeAttr('disabled');
$.each(groupIds,function(key,groupId){
  var this_select=$('select[id='+groupId+']');
  this_select.children('option').each(function(){
	if(this_select.val()!=this.value){
	  var combination=new Array();
	  combination[key]=this.value;
	  $.each(groupIds,function(key2,groupId2){
		if(key!=key2){
		  combination[key2]=$('select[id='+groupId2+']').val();
		}
	  });
	  var position=-1;
	  $.each(allCombinations,function(key1,theCombination){
		if(position==-1){
		  position=key1;
		  $.each(theCombination,function(key2,value){
			if(combination[key2]!=value)position=-1;
		  });
		}
	  });
	  if(position<0)
	  {
		this_select.children('option[value='+this.value+']').attr('disabled','disabled');
	  }
	}
  });
});
 }

});

However, the option can not be hidden. But they can be disabled.

Edited by Caracal (see edit history)
  • Like 2
Link to comment
Share on other sites

Hello, all.

This is script hide unavailable product attributes:

$(function(){

 var groupIds=new Array();
 $('select[id^="group_"]').each(function(){
groupIds.push(this.id);
 });
 var allCombinations=new Array();
 $.each(combinations,function(key,combination){
allCombinations.push(combination['idsAttributes']);
 });

 $('select[id^="group_"]').change(function(){checkCombination()});
 checkCombination();

 function checkCombination()
 {
$('select[id^="group_"] option').removeAttr('disabled');
$.each(groupIds,function(key,groupId){
  var this_select=$('select[id='+groupId+']');
  this_select.children('option').each(function(){
	if(this_select.val()!=this.value){
	  var combination=new Array();
	  combination[key]=this.value;
	  $.each(groupIds,function(key2,groupId2){
		if(key!=key2){
		  combination[key2]=$('select[id='+groupId2+']').val();
		}
	  });
	  var position=-1;
	  $.each(allCombinations,function(key1,theCombination){
		if(position==-1){
		  position=key1;
		  $.each(theCombination,function(key2,value){
			if(combination[key2]!=value)position=-1;
		  });
		}
	  });
	  if(position<0)
	  {
		this_select.children('option[value='+this.value+']').attr('disabled','disabled');
	  }
	}
  });
});
 }

});

However, the option can not be hidden. But they can be disabled.

Where to place this script?

Link to comment
Share on other sites

Where to place this script?

between tags <head> and </head> in header.tpl

<script type="text/javascript">

$(function(){

var groupIds=new Array();
$('select[id^="group_"]').each(function(){
groupIds.push(this.id);
});
var allCombinations=new Array();
$.each(combinations,function(key,combination){
allCombinations.push(combination['idsAttributes']);
});

$('select[id^="group_"]').change(function(){checkCombination()});
checkCombination();

function checkCombination()
{
$('select[id^="group_"] option').removeAttr('disabled');
$.each(groupIds,function(key,groupId){
var this_select=$('select[id='+groupId+']');
this_select.children('option').each(function(){
if(this_select.val()!=this.value){
var combination=new Array();
combination[key]=this.value;
$.each(groupIds,function(key2,groupId2){
if(key!=key2){
combination[key2]=$('select[id='+groupId2+']').val();
}
});
var position=-1;
$.each(allCombinations,function(key1,theCombination){
if(position==-1){
position=key1;
$.each(theCombination,function(key2,value){
if(combination[key2]!=value)position=-1;
});
}
});
if(position<0)
{
this_select.children('option[value='+this.value+']').attr('disabled','disabled');
}
}
});
});
}

});
</script>

However, this is not so important.

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

  • 9 months later...
  • 3 months later...

between tags <head> and </head> in header.tpl

<script type="text/javascript">

$(function(){

var groupIds=new Array();
$('select[id^="group_"]').each(function(){
groupIds.push(this.id);
});
var allCombinations=new Array();
$.each(combinations,function(key,combination){
allCombinations.push(combination['idsAttributes']);
});

$('select[id^="group_"]').change(function(){checkCombination()});
checkCombination();

function checkCombination()
{
$('select[id^="group_"] option').removeAttr('disabled');
$.each(groupIds,function(key,groupId){
var this_select=$('select[id='+groupId+']');
this_select.children('option').each(function(){
if(this_select.val()!=this.value){
var combination=new Array();
combination[key]=this.value;
$.each(groupIds,function(key2,groupId2){
if(key!=key2){
combination[key2]=$('select[id='+groupId2+']').val();
}
});
var position=-1;
$.each(allCombinations,function(key1,theCombination){
if(position==-1){
position=key1;
$.each(theCombination,function(key2,value){
if(combination[key2]!=value)position=-1;
});
}
});
if(position<0)
{
this_select.children('option[value='+this.value+']').attr('disabled','disabled');
}
}
});
});
}

});
</script>
However, this is not so important.

 

hello!

 

I put this code in the header.tpl and the result is a blank page. I tried both in PS 149 and 152. What am I doing wrong? It will be great to make this work.

Link to comment
Share on other sites

  • 1 month later...
  • 3 months later...
  • 1 year later...

between tags <head> and </head> in header.tpl

<script type="text/javascript">

$(function(){

var groupIds=new Array();
$('select[id^="group_"]').each(function(){
groupIds.push(this.id);
});
var allCombinations=new Array();
$.each(combinations,function(key,combination){
allCombinations.push(combination['idsAttributes']);
});

$('select[id^="group_"]').change(function(){checkCombination()});
checkCombination();

function checkCombination()
{
$('select[id^="group_"] option').removeAttr('disabled');
$.each(groupIds,function(key,groupId){
var this_select=$('select[id='+groupId+']');
this_select.children('option').each(function(){
if(this_select.val()!=this.value){
var combination=new Array();
combination[key]=this.value;
$.each(groupIds,function(key2,groupId2){
if(key!=key2){
combination[key2]=$('select[id='+groupId2+']').val();
}
});
var position=-1;
$.each(allCombinations,function(key1,theCombination){
if(position==-1){
position=key1;
$.each(theCombination,function(key2,value){
if(combination[key2]!=value)position=-1;
});
}
});
if(position<0)
{
this_select.children('option[value='+this.value+']').attr('disabled','disabled');
}
}
});
});
}

});
</script>
However, this is not so important.

 

 

 

Just trying to get this to work on PS 1.6 and having no luck.

 

Does anyone know how to hide product attributes when they don't exist for a product?

 

My store is still showing all possible attributes and when selecting one that isn't possible you get the annoying message "combination doesn't exist for this attribute"...

Link to comment
Share on other sites

×
×
  • Create New...