Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

sort by List, not by drop down in index


ringo667

Recommended Posts


   <?php 
   
// optional Product List Filter
  
      if (isset($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) {
		  
?>	<div class="panel-body text-center">
 
     <?
	  if (isset($HTTP_GET_VARS['manufacturers_id'])) {	   echo '<div class="panel panel-default" style="width:100%"><div class="panel-heading gradient"><center><h1>' . $catname. '</h1></center></div><br> <div class="">';} else {	   echo '<div class="panel panel-default" style="width:100%"><div class="panel-heading gradient"><center><h1>' . $catname . '</h1></center></div> <br><div class="">';}

	 
                if (isset($HTTP_GET_VARS['manufacturers_id'])) { ?>
             
                  <a class="btn btn-default" href="<?=tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'])?>"><?=TEXT_ALL_CATEGORIES?></a>
                  <?
                } else { ?>
                
              <a class="btn btn-default" href="<?=tep_href_link(FILENAME_DEFAULT, 'cPath=' . $cPath)?>"><?=TEXT_ALL_MANUFACTURERS?></a>

                  <?
                }
                while ($filterlist = tep_db_fetch_array($filterlist_query)) {
                  if (isset($HTTP_GET_VARS['manufacturers_id'])) {
                        $filter_keys = 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'];
                  } else {
                          $filter_keys = 'cPath=' . $cPath;
                  }
                  $filter_keys .= '&sort=' . $HTTP_GET_VARS['sort'];
                  $filter_keys .= '&filter_id=' . $filterlist['id'];
                  ?>
                  
                   <a class="btn btn-<? if(isset($_GET['filter_id']) && $_GET['filter_id'] == $filterlist['id']) {echo 'gradient';} else { echo 'default';} ?>" href="<?=tep_href_link(FILENAME_DEFAULT, $filter_keys)?>"><span class="filter_name"><?=$filterlist['name']?></span></a>
                  
                 
                  <?
                }
                ?>
                <br> <br>
              </div></div></div>
                
 <?php    

	   
} 	
?>


So  it works for me in the index.php with Buttons...

 

Maybe someone can use this.

 

 

 

 

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...