Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Sort Products By Dropdown Add on


Recommended Posts

I need to add a drop down for visitors to sort products from A - Z, Z - A and Price Lowest to Highest and Highest to Lowest. The add on here http://addons.oscommerce.com/info/4312/v,22 does this but also by bestseller. I have looked over the code to try to remove the bestseller option but can't figure it out. Can someone please help me remove the bestsellers from this add on? (the bestseller sort is tied to cron)

 

Thanks

Sue

Link to comment
Share on other sites

I actually got it!! for anyone else who wants this you simply add the following code (to index.php)

 

 

 

 // Additional Products Sort
     echo '<td align="center" class="dynamicMain">' . tep_draw_form('sort', FILENAME_DEFAULT, 'get') . '<b>Sort by:</b>  ';


     if (isset($HTTP_GET_VARS['manufacturers_id'])) {
         echo tep_draw_hidden_field('manufacturers_id', $HTTP_GET_VARS['manufacturers_id']);
     } else {
         echo tep_draw_hidden_field('cPath', $cPath);
     }

     $sort_list = array('1a' => 'Products Name A to Z',
                        '1d' => 'Products Name Z to A',
                        '5a' => 'Price Low to High',
                        '5d' => 'Price High to Low');
     foreach($sort_list as $id=>$text) {
      $sort_range[] = array('id' => $id, 'text' => $text);
     }

     echo tep_draw_pull_down_menu('sort', $sort_range, (isset($HTTP_GET_VARS['sort']) ? $HTTP_GET_VARS['sort'] : ''), 'onchange="this.form.submit()"');
     echo tep_draw_hidden_field('filter_id', (isset($HTTP_GET_VARS['filter_id']) ? $HTTP_GET_VARS['filter_id'] : ''));
     echo '</form></td>' . "\n";
// End Additional Products Sort

 

 

after

 

        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 '</form></td>' . "\n";
     }

 

and before

    }

 

Be sure to follow the directions from the add on here link to be sure your name and price number are correct. (All I did was remove the best sellers from the drop down and used only this code on the index.php as it appears that all of the other code for the add on had to do with the info needed for the best sellers sort)

 

Sue

Link to comment
Share on other sites

  • 1 month later...

Hi Sue,

 

when I use your code I get this error:

Parse error: syntax error, unexpected T_STRING in ..../index.php on line 341

 

Any tips to solve this?

Edited by eprom
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...