|
<<prev |
1 |
2 |
next>>
Auto Choices - Changing the code
Locate and comment the following line in choices.snp:
document.write("<OPTION VALUE=\"" + option[i].Price[x] + "\">" + option[i].Items[x]);
NOTE: The line above should not split onto a second line as shown here. Be sure to turn word wrap off in your text editor and then make sure this line stays all on the same line.)
Comment it using two slashes at the beginning of the line like this:
// document.write("<OPTION VALUE=\"" + option[i].Price[x] + "\">" + option[i].Items[x]);
Immediately after this line insert the following lines of code:
// begin addition for already selected choices.
if(x == 1)
{
document.write("<OPTION VALUE=\"" + option[i].Price[x] + "\" selected>" + option[i].Items[x]);
}
else
{
document.write("<OPTION VALUE=\"" + option[i].Price[x] + "\">" + option[i].Items[x]);
}
// end addition for already selected choices.
The if statement above if(x == 1) is checking to see if it is creating the first choice in a product options pull-down menu. If it is then it will write the line that contains the word selected as highlighted above. This causes the menu to be pre-set to the first choice in the list instead of == Select ==.
Since some of the lines of code displayed above are forced to wrap due to the length of the lines please view this file to see which lines are to remain inatact without wrapping. To see the entire modified choices.snp file please click here. The changes are highlighted with red type. You may download this modified choices.zip file, extract it and then save the new choices.snp file to your current theme folder called choices.snp. Rebuild your pages, republish and enjoy.
This concludes Auto Choices.
<<prev |
1 |
2 |
next>>
|