Jump to content

Archived

This topic is now archived and is closed to further replies.

sackling

Dual product attributes help needed

Recommended Posts

Hi all,

 

I have been running my store by ways of an html front end that merely connects to oscommerce via sts templates for key pages like shopping cart and login. this has worked fine for a couple years but has obvious shortcomings.

 

I am in the process of revamping my store and have run into a problem. For the items I sell there are sometimes 2 drop down menus for "tall sizes" and "regular sizes".

 

The user should only be allowed to choose one drop option of the 2. I had this setup on my html pages quite easily through use of a little javascript:

 

<script type = "text/javascript">

function checkIt() {
var x = document.getElementById("first").selectedIndex;
var y = document.getElementById("second").selectedIndex;
if ((x>0) && (y>0)) {
alert ("Please select either regular or tall only");
document.getElementById("first").selectedIndex = 0;
document.getElementById("second").selectedIndex = 0;
}
}
function checkIt2() {
var x = document.getElementById("first").selectedIndex;
var y = document.getElementById("second").selectedIndex;
if ((x==0) && (y==0)) {
alert ("Please choose a size");
return false;
}
}
</script> 

 

and then my drop boxes had this: select id = "first" onchange = "checkIt()"

 

 

That worked perfectly and I would like to apply the same method to the product_info.php page.

 

Besides the fact that my php is rather limited I face a couple problems.

 

1) the first option for each drop box is an actual attribute. on my old site it was an option saying please choose and if neither was selected a warning would pop up as per the javascript above.

2) How can I give the option boxes different names through the php. so that the javascript can work?

3) How can I add the onchange code to both boxes?

 

Here are the two pages to help clarify further my issue:

 

Old page: http://bit.ly/btE5Tu

New page: http://bit.ly/aEAd11

 

Any help is greatly appreciated! I don't think there is any contribution to accomplish this or maybe I just can't find one. Thank you for your time!

 

Rob

Share this post


Link to post
Share on other sites

Thanks! I have not seen many of these. I will try to figure out a combination that will work for me!

Share this post


Link to post
Share on other sites

×