sandwick Posted February 14, 2013 Posted February 14, 2013 I am trying to get the instock filter to work that is written for 2.2 which does NOT work for 2.3.3 the code tells me to place this piece code echo tep_draw_checkbox_field('instock', 1, false, 'onclick="this.form.submit()"') . HEADER_INSTOCK . '</form>' . "\n"; After this piece of code in the index.php file. if (tep_db_num_rows($filterlist_query) > 1) { echo '<div>' . tep_draw_form('filter', FILENAME_DEFAULT, 'get') . '<p align="right">' . TEXT_SHOW . ' '; if (isset($HTTP_GET_VARS['manufacturers_id'])) { echo tep_draw_hidden_field('manufacturers_id', $HTTP_GET_VARS['manufacturers_id']); $options = array(array('id' => '', 'text' => TEXT_ALL_CATEGORIES)); } else { echo tep_draw_hidden_field('cPath', $cPath); $options = array(array('id' => '', 'text' => TEXT_ALL_MANUFACTURERS)); } What i get is this ... See attached file ... and it does not work, is there any other solutions to resolve this ? Thanks in advance for your help. Larry
Bob Terveuren Posted February 15, 2013 Posted February 15, 2013 Hi Works for me in 2.3.3 - index.php attached (extra stuff contained within //BT markers) - sound like maybe you've got the $listing_sql.= bit out of kilter?
sandwick Posted February 15, 2013 Author Posted February 15, 2013 When I move this code inside the PRODUCT_LIST_FILTER, it breaks the 'Manufactures" pull down menu selection. It also show ups between the "show" and "manufacture" menu and wraps the <div>. Where can this be placed so it will work, when I put it out side of the PRODUCT_LIST_FILTER, and check the box nothing happens. // BT INSTOCK ONLY echo '<div>' . tep_draw_checkbox_field('instock', 1, false, 'onclick="this.form.submit()"') . HEADER_INSTOCK . '</form></div>'; // BT I did have this code in the wrong spot, and now it is where it should be. // BT Added to display on in Stock if (isset($HTTP_GET_VARS['instock'])) { $listing_sql .= " and p.products_quantity > 0"; } // BT Any help in placing that first line of code in the index file would be appreciated. // Larry
Bob Terveuren Posted February 16, 2013 Posted February 16, 2013 Hi - can you post or attach your index.php?
sandwick Posted February 18, 2013 Author Posted February 18, 2013 Here is a copy of my index file. Thanks ! index.txt
Bob Terveuren Posted February 26, 2013 Posted February 26, 2013 Hi Sorry I was being thick - you need to adapt the new code to: echo tep_draw_checkbox_field('instock', 1, false, 'onclick="this.form.submit()"') . HEADER_INSTOCK . "\n"; i.e. there was a </form> tag in there that was breaking the manufactures dropdown and the </td> was breaking the <div> You need to place it after the tep_draw_form and before the </form> (pretty much where you want but here's an example): if (PRODUCT_LIST_FILTER > 0) { if (isset($HTTP_GET_VARS['manufacturers_id']) && !empty($HTTP_GET_VARS['manufacturers_id'])) { $filterlist_sql = "select distinct c.categories_id as id, cd.categories_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where p.products_status = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and p2c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' order by cd.categories_name"; } else { $filterlist_sql= "select distinct m.manufacturers_id as id, m.manufacturers_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by m.manufacturers_name"; } $filterlist_query = tep_db_query($filterlist_sql); if (tep_db_num_rows($filterlist_query) > 1) { echo '<div>' . [b]tep_draw_form[/b]('filter', FILENAME_DEFAULT, 'get') . '<p align="right">' . TEXT_SHOW . ' '; if (isset($HTTP_GET_VARS['manufacturers_id']) && !empty($HTTP_GET_VARS['manufacturers_id'])) { echo tep_draw_hidden_field('manufacturers_id', $HTTP_GET_VARS['manufacturers_id']); $options = array(array('id' => '', 'text' => TEXT_ALL_CATEGORIES)); } else { echo tep_draw_hidden_field('cPath', $cPath); $options = array(array('id' => '', 'text' => TEXT_ALL_MANUFACTURERS)); } //BT echo tep_draw_checkbox_field('instock', 1, false, 'onclick="this.form.submit()"') . HEADER_INSTOCK . "\n"; //BT echo tep_draw_hidden_field('sort', $HTTP_GET_VARS['sort']); while ($filterlist = tep_db_fetch_array($filterlist_query)) { $options[] = array('id' => $filterlist['id'], 'text' => $filterlist['name']); } echo tep_draw_pull_down_menu('filter_id', $options, (isset($HTTP_GET_VARS['filter_id']) ? $HTTP_GET_VARS['filter_id'] : ''), 'onchange="this.form.submit()"'); echo tep_hide_session_id() . '</p>[b]</form>[/b]</div>' . "\n"; } }
sandwick Posted March 8, 2013 Author Posted March 8, 2013 Will give it a try this weekend ! This is the last contribution I need to complete my site and go live next week. Thanks for following up on me !!!! // Larry I inserted the code you have showed me, in the same place you have in the code above and here is what I get back. The in stock on button works, but it is displayed between the "Show" and the "Manufacturers" see image
Recommended Posts
Archived
This topic is now archived and is closed to further replies.