Sorted Products - Customization
Posted: Mon Apr 18, 2011 1:19 pm
Hi.
I have been implementing the customization code for the sorted products add-on.
I have entered the following lines of code into the JavaScript in the appropriate places.
[/color]
The scripting is basically working but with a few exceptions.
I have entered these customizations in order to sort my products depending on their capacity in Kg.
When I use the sort by capacity funtion the list puts things in order starting from 9 Kg, then 8 Kg and so on as expected. However, items with 11 Kg or 12 Kg capacity are listed at the bottom of the list, probably because the value begins with 1.
I tried altering the code to:
[/color]
but this did not work. Any ideas on how I can get my list into order would be great.
I have been implementing the customization code for the sorted products add-on.
I have entered the following lines of code into the JavaScript in the appropriate places.
Code: Select all
capacity: spans[i].getAttribute('capacity'),
if ( seqtype == 'capacity' ) prodlines.sort(function(a,b){return (b.capacity <= a.capacity) ? -1 : 1;});
spanids[i].setAttribute('capacity', prodlines[i].capacity);
The scripting is basically working but with a few exceptions.
I have entered these customizations in order to sort my products depending on their capacity in Kg.
When I use the sort by capacity funtion the list puts things in order starting from 9 Kg, then 8 Kg and so on as expected. However, items with 11 Kg or 12 Kg capacity are listed at the bottom of the list, probably because the value begins with 1.
I tried altering the code to:
Code: Select all
capacity: spans[i].getAttribute('capacity'),
if ( seqtype == 'highlow' ) prodlines.sort(function(a,b){return (b.capacity <= a.capacity) ? -1 : 1;});
spanids[i].setAttribute('capacity', prodlines[i].capacity);
but this did not work. Any ideas on how I can get my list into order would be great.