Chaima Posted August 19, 2015 Share Posted August 19, 2015 Hi, I have a dropdown list for the colors of the products of my online shop ! What I want to do is to add a new color who will be for all products the color by default ? Where can I find the code to add it ? or how? Link to comment Share on other sites More sharing options...
Gauravs Posted August 20, 2015 Share Posted August 20, 2015 Check out this link. HTH Best Regards,Gaurav Link to comment Share on other sites More sharing options...
Chaima Posted August 20, 2015 Author Share Posted August 20, 2015 Hello, Thanks for the tuto but I want 1. the default option not cliquable I want it to be a message for example for color <please select your color> 2.the default option for all combinations like color and siez etc .. Link to comment Share on other sites More sharing options...
Gauravs Posted August 20, 2015 Share Posted August 20, 2015 Sorry, the requirement wasn't specified in the first post...hence I pointed to the tutorial for adding the attribute. Typically the first option is taken as default, so if you have inserted colors as blue, black, white.. blue will always be the default color that will show up. If you want to make it non-clickable.. you will have to modify the code, first add a color attribute with your required text such as "Select Color". If user doesn't select any color, you will have to run a check and return error message to user to select a color from the drop down... before adding the item to the cart. You may explore using javascript to do this at the client side instead of adding traffic to the site... As of now, I don't see a default prompt / setting for this in Osc. HTH Best Regards,Gaurav Link to comment Share on other sites More sharing options...
Chaima Posted August 20, 2015 Author Share Posted August 20, 2015 Hello, Yes indeed! But I didn"t find the specific file ! I'm new in oscommerce and there's too many files ! Have you any idea in which file ther's the code of the form so I can change it and I prepared this as js ! is this right if { function initialiseSelect() { var selectCouleur = document.getElementsByTagName('select')[1]; var option = document.createElement('option'); option.text = 'Choisissez une couleur'; option.setAttribute('selected', 'selected'); selectCouleur.insertBefore(option, selectCouleur.firstChild); } else if { var selectTaille = document.getElementsByTagName('select')[2]; var option = document.createElement('option'); option.text = 'Choisissez une taille'; option.setAttribute('selected', 'selected'); selectCouleur.insertBefore(option, selectCouleur.firstChild); } } window.addEventListener("load", initialiseSelect,false); Link to comment Share on other sites More sharing options...
Gauravs Posted August 20, 2015 Share Posted August 20, 2015 HI Chaima, Typically all information is gathered in product_info.php when it is displayed - suggest you start from there with your debugging messages to confirm and than use the js to do the client side check. I am sorry, I am not very confident on js part, will have to execute and check it for validity and if it serves the desired purpose Thx Best Regards,Gaurav Link to comment Share on other sites More sharing options...
Chaima Posted August 20, 2015 Author Share Posted August 20, 2015 Thanks a lot for your answers Chaima Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.