mribeiro Posted April 9, 2008 Share Posted April 9, 2008 I'm trying to make a pull down menu where I can select specific categories, and then it displays only the products and prices from that category. And when whe select a product from de drop down list, we can add it to the cart. I've use the code of the products_drop contribution and tried to make a function, but it didn't show nothing, the code is below some one could help me please. I'm stuked. function tep_draw_configurator_pull_down($catid, $contents='') { $products_query = tep_db_query("select p.products_id, p.products_price, pd.products_name, c.categories_id, cd.categories_name, p2c.categories_id, p2c.products_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and c.categories_id = cd.categories_id and cd.categories_name = '" . $catid . "' and p.products_id = p2c.products_id and c.categories_id = p2c.categories_id and pd.language_id = '" . (int)$languages_id . "' and cd.language_id = '" . (int)$languages_id . "' order by p.products_price"); if ($number_of_rows = tep_db_num_rows($products_query)) { $p_id = $product['products_id']; $products_array = array(); $products_array[] = array('id' => '', 'text' => 'Select Product'); while ($products = tep_db_fetch_array($products_query)) { $products_name = $products['products_name'] . ' - ' . $products['products_price']; $products_array[] = array('id' => $products['products_id'], 'text' => $products_name); } $contents = array(); $contents[] = array('form' => tep_draw_form('products', tep_href_link(FILENAME_CONFIGURATOR, tep_get_all_get_params(array('action')) . 'action=add_product', 'NONSSL', false), 'post'), 'text' => tep_draw_pull_down_menu('products_id', $products_array, (isset($HTTP_GET_VARS['products_id']) ? $HTTP_GET_VARS['products_id'] : ''), 'onChange="this.form.submit();" size="' . MAX_PRODUCTS_LIST . '" style="width: 200"') . tep_hide_session_id()); } return $contents; } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.