defender39 Posted May 25, 2004 Share Posted May 25, 2004 I have been using a product_listing_col.php instead of the rows listing and I like it's look but I recently noticed that you cannot sort by price or stock. With the regular product_listing.php module you get a header with sort option. I want to create a dropdown menu with sort options but I am having an impossible time trying to create a tep_draw_drop_down_menu with the proper array. My array is always empty. I havent written an array from scratch and all my attempts using examples from php.net still create an empty drop down list. Can someone give me a hand on this one? Here is the original contrib I am using. http://www.oscommerce.com/community/contributions,112 Quote Link to comment Share on other sites More sharing options...
defender39 Posted May 25, 2004 Author Share Posted May 25, 2004 Here is what I have but it just uses the first letter. I know I am not even close to getting this correct. <tr> <td> <?php $sort = array( 'price', 'date', 'name', ); echo tep_draw_pull_down_menu('sort', $sort,'',''); ?> </td> </tr> Quote Link to comment Share on other sites More sharing options...
defender39 Posted May 25, 2004 Author Share Posted May 25, 2004 OK well this is what I have that's working now as a drop down menu. <tr> <td> <?php echo tep_draw_pull_down_menu('sort', array(array('id' => 'ALA', 'text' => 'ALA'), array('id' => 'Price', 'text' => 'Sort by Price')), 'Price'); ?> </td> </tr> the problem is that I am unable to get it to submit onchange. Do I have to create a tep_draw_form? Quote Link to comment Share on other sites More sharing options...
defender39 Posted May 25, 2004 Author Share Posted May 25, 2004 My latest attempt is much better: <tr> <td> <?php echo tep_draw_form('sort', '', 'post'); echo tep_draw_pull_down_menu('sort', array(array('id' => '3a', 'text' => 'Name'), array('id' => '4d', 'text' => 'Sort by Price')), '', 'onchange="this.form.submit()"'); ?> </form> </td> </tr> While this now submits the page doesnt actually work. I have the sort options correct as 3a and 4d to try to force results but neither seems to take. Hmm..any new ideas? Once this is fixed up some it can be added to the contrib so that others who use column display can have more sort options. Quote Link to comment Share on other sites More sharing options...
noisebox Posted June 2, 2004 Share Posted June 2, 2004 Dear jesse try this: http://www.oscommerce.com/forums/index.php?sho...=0entry257221 Quote Link to comment Share on other sites More sharing options...
defender39 Posted June 5, 2004 Author Share Posted June 5, 2004 That's not working for me. I am on MS1... I keep getting really close but there is always something not working right. This is the closest I got now. echo '<tr><td>'; $sort_array = array(); $sort_array = array(); $sort_array[] = array('id' => '4a', 'text' => 'Product Name Ascending'); $sort_array[] = array('id' => '4d', 'text' => 'Product Name Descending'); $sort_array[] = array('id' => '3a', 'text' => 'Product Price Ascending'); $sort_array[] = array('id' => '3d', 'text' => 'Product Price Descending'); echo tep_draw_form('sort', '', 'post'); echo tep_draw_pull_down_menu('sort', $sort_array, (isset($HTTP_GET_VARS['sort']) ? $HTTP_GET_VARS['sort'] : ''), 'onChange="this.form.submit();"'); echo '</form></td></tr>'; I added this to my index.php but I am using SEF urls. So lets say I am here: http://www.videogamedeals.com/index.php/so...th/87_19/page/2 Well when I make a change it makes the url this: http://www.videogamedeals.com/index.php/so.../page/2?sort=4d As you can see it quickly starts to make a mess of the url. So does anyone know how I might correct this? 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.