Jump to content
xt:Commerce Community Forum

Aufsteigend Und Absteigend Sortieren


nom

Recommended Posts

Hallo,

brauche Rat, wie kann man Produkte nach Preis sortieren mit Dropdownmenu? Habe folgendes:

default.php


  // optional Product List Filter Price

  if (PRODUCT_LIST_FILTER > 0) {

   if (isset($_GET['products_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)$_SESSION['languages_id'] . "' and p.products_id = '" . (int)$_GET['products_id'] . "' order by cd.products_price";

   } else {

    $filterlist_sql = "select distinct m.products_id as id, m.products_price as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_PRODUCTS . " m where p.products_status = '1' and p.products_id = m.products_id and p.products_id = p2c.products_id and p2c.categories_id = '" . $current_category_id . "' order by m.products_price";

   }

   $filterlist_query = xtc_db_query($filterlist_sql);

   if (xtc_db_num_rows($filterlist_query) > 1) {

    $price_dropdown= xtc_draw_form('filter', FILENAME_DEFAULT, 'GET') .'';

    if (isset($_GET['products_id'])) {

     $price_dropdown.= xtc_draw_hidden_field('products_id', $_GET['products_id']);

     $options = array(array('text' => TEXT_ALL_CATEGORIES));

    } else {

     $price_dropdown.= xtc_draw_hidden_field('cPath', $cPath);

     $options = array(array('text' => TEXT_AUFSTEIGEND));

    }

    $price_dropdown.= xtc_draw_hidden_field('sort', $_GET['sort']);

    while ($filterlist = xtc_db_fetch_array($filterlist_query)) {

     $options[] = array('id' => $filterlist['id'], 'text' => $filterlist['name']);

    }

    $price_dropdown.= xtc_draw_pull_down_menu('filter_id', $options, $_GET['filter_id'], 'onchange="this.form.submit()"');

    $price_dropdown.= '</form>' . "\n";

   }

  }

Habe das Menu aber mit Preisen drin.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
  • Create New...