josheli Posted May 15, 2003 Posted May 15, 2003 i must be missing something, but for some reason, osC has a setting to define "PULL_DOWN_DEFAULT" for drop down menus, but then never seems to use it (on the products attribute lists for instance). Well, here's how I use it: in /catalog/includes/functions/html_output.php change the function declaration from this.... function tep_draw_pull_down_menu($name, $values, $default = '', $parameters = '', $required = false) to this (adding '$label=false').... function tep_draw_pull_down_menu($name, $values, $default = '', $parameters = '', $required = false, $label = false) and then in the function itself, find this.... if (empty($default) && isset($GLOBALS[$name])) $default = $GLOBALS[$name]; and after it, add this... if($label === true) $field .= '<option value="">' . PULL_DOWN_DEFAULT . '</option>'; now, in the page you want to use it, call the function with $label set to true. remember to have 6 arguments in the function call (notice the empty and false values, respectively, for $parameters and $required), with $label being the last one, like this example from product_info.php which is displaying the attributes... echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']], '', false, true); You can add JavaScript validation, or change the value of the option to something like '-1' and check with PHP after the form is submitted. you can see an example here: http://www.austinbeads.com/product_info.ph...&products_id=38
nana Posted July 9, 2004 Posted July 9, 2004 this is great i did everything and i almost got it working but i don,t know how to do the last part You can add JavaScript validation, or change the value of the option to something like '-1' and check with PHP after the form is submitted.i am now getting a -: for unchosen attributes can you help i really need this since some of my items have up to 20 attributes
Recommended Posts
Archived
This topic is now archived and is closed to further replies.