reformedman Posted January 22, 2009 Share Posted January 22, 2009 When you enter new products in your admin page, you enter the model in the model field. How can I make a dropdown infobox for this 'model' field? You have a manufacturer field in your admin page, and there is a pulldown menu for that already, I'd like the same for my model field. Thanks. man of a reformed faith. Link to comment Share on other sites More sharing options...
roya.k Posted January 22, 2009 Share Posted January 22, 2009 I don't know if there is already a contribution for this. [How to select Product Models from a pull down menu in admin interface] 1) make backup copy of your /admin/categories.php file 2) open /admin/categories.php in a text editor 3) Replace: <tr> <td class="main"><?php echo TEXT_PRODUCTS_MODEL; ?></td> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_model', $pInfo->products_model); ?></td> </tr> With: <tr> <td class="main"><?php echo TEXT_PRODUCTS_MODEL; ?></td> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_model', $pInfo->products_model); ?> Or Select <?php $all_models_query = tep_db_query("select products_model from " . TABLE_PRODUCTS); $all_models_array[0] = array('id' => '', 'text' => 'Please Select'); while ($all_models = tep_db_fetch_array($all_models_query)) { $all_models_array[] = array('id' => $all_models['products_model'], 'text' => $all_models['products_model']); } echo tep_draw_pull_down_menu('all_products_model', $all_models_array, $pInfo->products_model); ?></td> </tr> 4) Replace : $products_date_available = (date('Y-m-d') < $products_date_available) ? $products_date_available : 'null'; $sql_data_array = array('products_quantity' => (int)tep_db_prepare_input($HTTP_POST_VARS['products_quantity']), 'products_model' => tep_db_prepare_input($HTTP_POST_VARS['products_model']), 'products_price' => tep_db_prepare_input($HTTP_POST_VARS['products_price']), 'products_date_available' => $products_date_available, 'products_weight' => (float)tep_db_prepare_input($HTTP_POST_VARS['products_weight']), 'products_status' => tep_db_prepare_input($HTTP_POST_VARS['products_status']), 'products_tax_class_id' => tep_db_prepare_input($HTTP_POST_VARS['products_tax_class_id']), 'manufacturers_id' => (int)tep_db_prepare_input($HTTP_POST_VARS['manufacturers_id'])); with: $products_date_available = (date('Y-m-d') < $products_date_available) ? $products_date_available : 'null'; if (isset($HTTP_POST_VARS['all_products_model']) && tep_not_null($HTTP_POST_VARS['all_products_model'])) { $products_model = tep_db_prepare_input($HTTP_POST_VARS['all_products_model']); } else { $products_model = tep_db_prepare_input($HTTP_POST_VARS['products_model']); } $sql_data_array = array('products_quantity' => (int)tep_db_prepare_input($HTTP_POST_VARS['products_quantity']), 'products_model' => $products_model, 'products_price' => tep_db_prepare_input($HTTP_POST_VARS['products_price']), 'products_date_available' => $products_date_available, 'products_weight' => (float)tep_db_prepare_input($HTTP_POST_VARS['products_weight']), 'products_status' => tep_db_prepare_input($HTTP_POST_VARS['products_status']), 'products_tax_class_id' => tep_db_prepare_input($HTTP_POST_VARS['products_tax_class_id']), 'manufacturers_id' => (int)tep_db_prepare_input($HTTP_POST_VARS['manufacturers_id'])); Open source n'est pas un échange à sens unique ... La plupart du temps un simple merci ou quelques mots d'encouragement suffisent... Link to comment Share on other sites More sharing options...
reformedman Posted January 23, 2009 Author Share Posted January 23, 2009 Thank you Roya, but doesn't your code only change the admin page? I did not want to change the admin interface, I want to add an infobox that is pulldown for models. I would like an infobox like the manufacturer infobox that will list all the models as a pulldown menu. Would you happen to know how to do this? man of a reformed faith. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.