Forums / All Other Contributions/Addons / Product Listing Sorter Drop-Down [Support Thread]

Product Listing Sorter Drop-Down [Support Thread]

Views: 17,132

Results 21 to 40 of 78
8 Nov 2013, 2:31 PM
#21
softcorpse avatar

softcorpse

Zen Follower

Join Date:
Aug 2004
Posts:
96
Plugin Contributions:
0

Product Listing Sorter Drop-Down [Support Thread]

I don't know how to get those stupid smily's out of the post, sorry...
That's supposed to be

": p"

without the space.

It is on the Advanced Search Result listing.

8 Nov 2013, 2:52 PM
#22
softcorpse avatar

softcorpse

Zen Follower

Join Date:
Aug 2004
Posts:
96
Plugin Contributions:
0

Re: Product Listing Sorter Drop-Down [Support Thread]

Did version 1.2 of this mod work correctly as all I want to do is replace the Alpha Sorter Dropdown with your one for the Advanced Search Results page, I do not require it for anything else?

8 Nov 2013, 4:33 PM
#23
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,876
Plugin Contributions:
7

Re: Product Listing Sorter Drop-Down [Support Thread]

I did find a bug in advanced search result, but have not had time to complete testing on another aspect, so I have not uploaded it.
try this for /pages/advanced_search_result/header_php.php

<?php
//MOD Product Listing Sorter
$debug = '0';//1 or 0, show debugging information 
$debug_prefix = '('.str_replace(DIR_FS_CATALOG, '', str_replace('\\','/',__FILE__)).' line ';
/**
 * Header code file for the Advanced Search Results page
 *
 * @package page
 * @copyright Copyright 2003-2011 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: header_php.php 19702 2011-10-05 20:33:06Z wilt $
 */

// This should be first line of the script:
$zco_notifier->notify('NOTIFY_HEADER_START_ADVANCED_SEARCH_RESULTS');

if (!defined('KEYWORD_FORMAT_STRING')) define('KEYWORD_FORMAT_STRING','keywords');

require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php'));
$error = false;
$missing_one_input = false;

$_GET['keyword'] = trim($_GET['keyword']);

if ( (isset($_GET['keyword']) && (empty($_GET['keyword']) || $_GET['keyword']==HEADER_SEARCH_DEFAULT_TEXT || $_GET['keyword'] == KEYWORD_FORMAT_STRING ) ) &&
(isset($_GET['dfrom']) && (empty($_GET['dfrom']) || ($_GET['dfrom'] == DOB_FORMAT_STRING))) &&
(isset($_GET['dto']) && (empty($_GET['dto']) || ($_GET['dto'] == DOB_FORMAT_STRING))) &&
(isset($_GET['pfrom']) && !is_numeric($_GET['pfrom'])) &&
(isset($_GET['pto']) && !is_numeric($_GET['pto'])) ) {
  $error = true;
  $missing_one_input = true;
  $messageStack->add_session('search', ERROR_AT_LEAST_ONE_INPUT);
} else {
  $dfrom = '';
  $dto = '';
  $pfrom = '';
  $pto = '';
  $keywords = '';

  if (isset($_GET['dfrom'])) {
    $dfrom = (($_GET['dfrom'] == DOB_FORMAT_STRING) ? '' : $_GET['dfrom']);
  }

  if (isset($_GET['dto'])) {
    $dto = (($_GET['dto'] == DOB_FORMAT_STRING) ? '' : $_GET['dto']);
  }

  if (isset($_GET['pfrom'])) {
    $pfrom = $_GET['pfrom'];
  }

  if (isset($_GET['pto'])) {
    $pto = $_GET['pto'];
  }

  if (isset($_GET['keyword']) && $_GET['keyword'] != HEADER_SEARCH_DEFAULT_TEXT  && $_GET['keyword'] != KEYWORD_FORMAT_STRING) {
    $keywords = $_GET['keyword'];
  }

  $date_check_error = false;
  if (zen_not_null($dfrom)) {
    if (!zen_checkdate($dfrom, DOB_FORMAT_STRING, $dfrom_array)) {
      $error = true;
      $date_check_error = true;

      $messageStack->add_session('search', ERROR_INVALID_FROM_DATE);
    }
  }

  if (zen_not_null($dto)) {
    if (!zen_checkdate($dto, DOB_FORMAT_STRING, $dto_array)) {
      $error = true;
      $date_check_error = true;

      $messageStack->add_session('search', ERROR_INVALID_TO_DATE);
    }
  }

  if (($date_check_error == false) && zen_not_null($dfrom) && zen_not_null($dto)) {
    if (mktime(0, 0, 0, $dfrom_array[1], $dfrom_array[2], $dfrom_array[0]) > mktime(0, 0, 0, $dto_array[1], $dto_array[2], $dto_array[0])) {
      $error = true;

      $messageStack->add_session('search', ERROR_TO_DATE_LESS_THAN_FROM_DATE);
    }
  }

  $price_check_error = false;
  if (zen_not_null($pfrom)) {
    if (!settype($pfrom, 'float')) {
      $error = true;
      $price_check_error = true;

      $messageStack->add_session('search', ERROR_PRICE_FROM_MUST_BE_NUM);
    }
  }

  if (zen_not_null($pto)) {
    if (!settype($pto, 'float')) {
      $error = true;
      $price_check_error = true;

      $messageStack->add_session('search', ERROR_PRICE_TO_MUST_BE_NUM);
    }
  }

  if (($price_check_error == false) && is_float($pfrom) && is_float($pto)) {
    if ($pfrom > $pto) {
      $error = true;

      $messageStack->add_session('search', ERROR_PRICE_TO_LESS_THAN_PRICE_FROM);
    }
  }

  if (zen_not_null($keywords)) {
    if (!zen_parse_search_string(stripslashes($keywords), $search_keywords)) {
      $error = true;

      $messageStack->add_session('search', ERROR_INVALID_KEYWORDS);
    }
  }
}

if (empty($dfrom) && empty($dto) && empty($pfrom) && empty($pto) && empty($keywords)) {
  $error = true;
  // redundant should be able to remove this
  if (!$missing_one_input) {
    $messageStack->add_session('search', ERROR_AT_LEAST_ONE_INPUT);
  }
}

if ($error == true) {

  zen_redirect(zen_href_link(FILENAME_ADVANCED_SEARCH, zen_get_all_get_params(), 'NONSSL', true, false));
}


$define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL,
                     'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME,
                     'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER,
                     'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE,
                     'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY,
                     'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT,
                     'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE);

asort($define_list);

$column_list = array();
reset($define_list);
while (list($column, $value) = each($define_list)) {
  if ($value) $column_list[] = $column;
}

$select_column_list = '';

for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
  if (($column_list[$col] == 'PRODUCT_LIST_NAME') || ($column_list[$col] == 'PRODUCT_LIST_PRICE')) {
    continue;
  }

  if (zen_not_null($select_column_list)) {
    $select_column_list .= ', ';
  }

  switch ($column_list[$col]) {
    case 'PRODUCT_LIST_MODEL':
    $select_column_list .= 'p.products_model';
    break;
    case 'PRODUCT_LIST_MANUFACTURER':
    $select_column_list .= 'm.manufacturers_name';
    break;
    case 'PRODUCT_LIST_QUANTITY':
    $select_column_list .= 'p.products_quantity';
    break;
    case 'PRODUCT_LIST_IMAGE':
    $select_column_list .= 'p.products_image';
    break;
    case 'PRODUCT_LIST_WEIGHT':
    $select_column_list .= 'p.products_weight';
    break;
  }
}
/*
// always add quantity regardless of whether or not it is in the listing for add to cart buttons
if (PRODUCT_LIST_QUANTITY < 1) {
  $select_column_list .= ', p.products_quantity ';
}
*/

// always add quantity regardless of whether or not it is in the listing for add to cart buttons
if (PRODUCT_LIST_QUANTITY < 1) {
  if (empty($select_column_list)) {
    $select_column_list .= ' p.products_quantity ';
  } else  {
    $select_column_list .= ', p.products_quantity ';
  }
}

if (zen_not_null($select_column_list)) {
  $select_column_list .= ', ';
}

// Notifier Point
$zco_notifier->notify('NOTIFY_SEARCH_COLUMNLIST_STRING');


//  $select_str = "select distinct " . $select_column_list . " m.manufacturers_id, p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, IF(s.status = 1, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status = 1, s.specials_new_products_price, p.products_price) as final_price ";
$select_str = "SELECT DISTINCT " . $select_column_list .
              " m.manufacturers_id, p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_price_sorter, p.products_qty_box_status, p.master_categories_id ";

if ((DISPLAY_PRICE_WITH_TAX == 'true') && ((isset($_GET['pfrom']) && zen_not_null($_GET['pfrom'])) || (isset($_GET['pto']) && zen_not_null($_GET['pto'])))) {
  $select_str .= ", SUM(tr.tax_rate) AS tax_rate ";
}

// Notifier Point
$zco_notifier->notify('NOTIFY_SEARCH_SELECT_STRING');


//  $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";
$from_str = "FROM (" . TABLE_PRODUCTS . " p
             LEFT JOIN " . TABLE_MANUFACTURERS . " m
             USING(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c )
             LEFT JOIN " . TABLE_META_TAGS_PRODUCTS_DESCRIPTION . " mtpd
             ON mtpd.products_id= p2c.products_id
             AND mtpd.language_id = :languagesID";

$from_str = $db->bindVars($from_str, ':languagesID', $_SESSION['languages_id'], 'integer');

if ((DISPLAY_PRICE_WITH_TAX == 'true') && ((isset($_GET['pfrom']) && zen_not_null($_GET['pfrom'])) || (isset($_GET['pto']) && zen_not_null($_GET['pto'])))) {
  if (!$_SESSION['customer_country_id']) {
    $_SESSION['customer_country_id'] = STORE_COUNTRY;
    $_SESSION['customer_zone_id'] = STORE_ZONE;
  }
  $from_str .= " LEFT JOIN " . TABLE_TAX_RATES . " tr
                 ON p.products_tax_class_id = tr.tax_class_id
                 LEFT JOIN " . TABLE_ZONES_TO_GEO_ZONES . " gz
                 ON tr.tax_zone_id = gz.geo_zone_id
                 AND (gz.zone_country_id IS null OR gz.zone_country_id = 0 OR gz.zone_country_id = :zoneCountryID)
                 AND (gz.zone_id IS null OR gz.zone_id = 0 OR gz.zone_id = :zoneID)";

  $from_str = $db->bindVars($from_str, ':zoneCountryID', $_SESSION['customer_country_id'], 'integer');
  $from_str = $db->bindVars($from_str, ':zoneID', $_SESSION['customer_zone_id'], 'integer');
}

// Notifier Point
$zco_notifier->notify('NOTIFY_SEARCH_FROM_STRING');

$where_str = " WHERE (p.products_status = 1
               AND p.products_id = pd.products_id
               AND pd.language_id = :languagesID
               AND p.products_id = p2c.products_id
               AND p2c.categories_id = c.categories_id ";

$where_str = $db->bindVars($where_str, ':languagesID', $_SESSION['languages_id'], 'integer');

// reset previous selection
if (!isset($_GET['inc_subcat'])) {
  $_GET['inc_subcat'] = '0';
}
if (!isset($_GET['search_in_description'])) {
  $_GET['search_in_description'] = '0';
}
$_GET['search_in_description'] = (int)$_GET['search_in_description'];

if (isset($_GET['categories_id']) && zen_not_null($_GET['categories_id'])) {
  if ($_GET['inc_subcat'] == '1') {
    $subcategories_array = array();
    zen_get_subcategories($subcategories_array, $_GET['categories_id']);
    $where_str .= " AND p2c.products_id = p.products_id
                    AND p2c.products_id = pd.products_id
                    AND (p2c.categories_id = :categoriesID";

    $where_str = $db->bindVars($where_str, ':categoriesID', $_GET['categories_id'], 'integer');

    if (sizeof($subcategories_array) > 0) {
      $where_str .= " OR p2c.categories_id in (";
      for ($i=0, $n=sizeof($subcategories_array); $i<$n; $i++ ) {
        $where_str .= " :categoriesID";
        if ($i+1 < $n) $where_str .= ",";
        $where_str = $db->bindVars($where_str, ':categoriesID', $subcategories_array[$i], 'integer');
      }
      $where_str .= ")";
    }
    $where_str .= ")";
  } else {
    $where_str .= " AND p2c.products_id = p.products_id
                    AND p2c.products_id = pd.products_id
                    AND pd.language_id = :languagesID
                    AND p2c.categories_id = :categoriesID";

    $where_str = $db->bindVars($where_str, ':categoriesID', $_GET['categories_id'], 'integer');
    $where_str = $db->bindVars($where_str, ':languagesID', $_SESSION['languages_id'], 'integer');
  }
}

if (isset($_GET['manufacturers_id']) && zen_not_null($_GET['manufacturers_id'])) {
  $where_str .= " AND m.manufacturers_id = :manufacturersID";
  $where_str = $db->bindVars($where_str, ':manufacturersID', $_GET['manufacturers_id'], 'integer');
}

if (isset($keywords) && zen_not_null($keywords)) {
  if (zen_parse_search_string(stripslashes($_GET['keyword']), $search_keywords)) {
    $where_str .= " AND (";
    for ($i=0, $n=sizeof($search_keywords); $i<$n; $i++ ) {
      switch ($search_keywords[$i]) {
        case '(':
        case ')':
        case 'and':
        case 'or':
        $where_str .= " " . $search_keywords[$i] . " ";
        break;
        default:
        $where_str .= "(pd.products_name LIKE '%:keywords%'
                                         OR p.products_model
                                         LIKE '%:keywords%'
                                         OR m.manufacturers_name
                                         LIKE '%:keywords%'";

        $where_str = $db->bindVars($where_str, ':keywords', $search_keywords[$i], 'noquotestring');
        // search meta tags
        $where_str .= " OR (mtpd.metatags_keywords
                        LIKE '%:keywords%'
                        AND mtpd.metatags_keywords !='')";

        $where_str = $db->bindVars($where_str, ':keywords', $search_keywords[$i], 'noquotestring');

        $where_str .= " OR (mtpd.metatags_description
                        LIKE '%:keywords%'
                        AND mtpd.metatags_description !='')";

        $where_str = $db->bindVars($where_str, ':keywords', $search_keywords[$i], 'noquotestring');

        if (isset($_GET['search_in_description']) && ($_GET['search_in_description'] == '1')) {
          $where_str .= " OR pd.products_description
                          LIKE '%:keywords%'";

          $where_str = $db->bindVars($where_str, ':keywords', $search_keywords[$i], 'noquotestring');
        }
        $where_str .= ')';
        break;
      }
    }
    $where_str .= " ))";
  }
}
if (!isset($keywords) || $keywords == "") {
  $where_str .= ')';
}
  if (isset($_GET['alpha_filter_id']) && (int)$_GET['alpha_filter_id'] > 0) {
    $alpha_sort = " and (pd.products_name LIKE '" . chr((int)$_GET['alpha_filter_id']) . "%') ";
    $where_str .= $alpha_sort;
  } else {
    $alpha_sort = '';
    $where_str .= $alpha_sort;
  }
//die('I SEE ' . $where_str);

//MOD Product Listing Sorter
  if (isset($_GET['product_listing_sorter_id']) && (int)$_GET['product_listing_sorter_id'] > 0) {
      $multi_sort_list_search = explode(';', '0:reset_placeholder;' . PRODUCT_LISTING_SORTER_LIST);
      for ($j=0, $n=sizeof($multi_sort_list_search); $j<$n; $j++) {
        if ((int)$_GET['product_listing_sorter_id'] == $j) {
          $elements_multi = explode(':', $multi_sort_list_search[$j]);
          $pattern_multi = str_replace(',', '', $elements_multi[1]);
          $multi_sort = " order by " . $pattern_multi;
          if ($debug) echo $debug_prefix.__LINE__.') '.'$multi_sort='.$multi_sort.'<br />'; 
          break;
        }
      }

  } else {
      $multi_sort = '';
  }
$order_str = $multi_sort;
if ($debug) echo $debug_prefix.__LINE__.') '.'$order_str=' . $order_str . '<br>';
if (isset($_GET['dfrom']) && zen_not_null($_GET['dfrom']) && ($_GET['dfrom'] != DOB_FORMAT_STRING)) {
  $where_str .= " AND p.products_date_added >= :dateAdded";
  $where_str = $db->bindVars($where_str, ':dateAdded', zen_date_raw($dfrom), 'date');
}

if (isset($_GET['dto']) && zen_not_null($_GET['dto']) && ($_GET['dto'] != DOB_FORMAT_STRING)) {
  $where_str .= " and p.products_date_added <= :dateAdded";
  $where_str = $db->bindVars($where_str, ':dateAdded', zen_date_raw($dto), 'date');
}

$rate = $currencies->get_value($_SESSION['currency']);
if ($rate) {
  $pfrom = $_GET['pfrom'] / $rate;
  $pto = $_GET['pto'] / $rate;
}

if (DISPLAY_PRICE_WITH_TAX == 'true') {
  if ($pfrom) {
    $where_str .= " AND (p.products_price_sorter * IF(gz.geo_zone_id IS null, 1, 1 + (tr.tax_rate / 100)) >= :price)";
    $where_str = $db->bindVars($where_str, ':price', $pfrom, 'float');
  }
  if ($pto) {
    $where_str .= " AND (p.products_price_sorter * IF(gz.geo_zone_id IS null, 1, 1 + (tr.tax_rate / 100)) <= :price)";
    $where_str = $db->bindVars($where_str, ':price', $pto, 'float');
  }
} else {
  if ($pfrom) {
    $where_str .= " and (p.products_price_sorter >= :price)";
    $where_str = $db->bindVars($where_str, ':price', $pfrom, 'float');
  }
  if ($pto) {
    $where_str .= " and (p.products_price_sorter <= :price)";
    $where_str = $db->bindVars($where_str, ':price', $pto, 'float');
  }
}


// Notifier Point
$zco_notifier->notify('NOTIFY_SEARCH_WHERE_STRING');


if ((DISPLAY_PRICE_WITH_TAX == 'true') && ((isset($_GET['pfrom']) && zen_not_null($_GET['pfrom'])) || (isset($_GET['pto']) && zen_not_null($_GET['pto'])))) {
  $where_str .= " group by p.products_id, tr.tax_priority";
}

// set the default sort order setting from the Admin when not defined by customer
if (!isset($_GET['sort']) and PRODUCT_LISTING_DEFAULT_SORT_ORDER != '') {
  $_GET['sort'] = PRODUCT_LISTING_DEFAULT_SORT_ORDER;
}
//die('I SEE ' . $_GET['sort'] . ' - ' . PRODUCT_LISTING_DEFAULT_SORT_ORDER);
if (!isset($_GET['product_listing_sorter_id']) || (int)$_GET['product_listing_sorter_id'] == 0) {//MOD Product Listing Sorter

if ((!isset($_GET['sort'])) || (!preg_match('/[1-8][ad]/', $_GET['sort'])) || (substr($_GET['sort'], 0 , 1) > sizeof($column_list))) {
  for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
    if ($column_list[$col] == 'PRODUCT_LIST_NAME') {
      $_GET['sort'] = $col+1 . 'a';
      $order_str = ' order by pd.products_name';
      break;
    } else {
      // sort by products_sort_order when PRODUCT_LISTING_DEFAULT_SORT_ORDER ia left blank
      // for reverse, descending order use:
      //       $listing_sql .= " order by p.products_sort_order desc, pd.products_name";
      $order_str .= " order by p.products_sort_order, pd.products_name";
      break;
    }
  }
  // if set to nothing use products_sort_order and PRODUCTS_LIST_NAME is off
  if (PRODUCT_LISTING_DEFAULT_SORT_ORDER == '') {
    $_GET['sort'] = '20a';
  }
} else {
  $sort_col = substr($_GET['sort'], 0, 1);
  $sort_order = substr($_GET['sort'], -1);
  $order_str = ' order by ';
  switch ($column_list[$sort_col-1]) {
    case 'PRODUCT_LIST_MODEL':
    $order_str .= "p.products_model " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name";
    break;
    case 'PRODUCT_LIST_NAME':
    $order_str .= "pd.products_name " . ($sort_order == 'd' ? "desc" : "");
    break;
    case 'PRODUCT_LIST_MANUFACTURER':
    $order_str .= "m.manufacturers_name " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name";
    break;
    case 'PRODUCT_LIST_QUANTITY':
    $order_str .= "p.products_quantity " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name";
    break;
    case 'PRODUCT_LIST_IMAGE':
    $order_str .= "pd.products_name";
    break;
    case 'PRODUCT_LIST_WEIGHT':
    $order_str .= "p.products_weight " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name";
    break;
    case 'PRODUCT_LIST_PRICE':
    //        $order_str .= "final_price " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name";
    $order_str .= "p.products_price_sorter " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name";
    break;
  }     if ($debug) echo $debug_prefix.__LINE__.') $order_str='.$order_str.'<br>';
}
  }
//$_GET['keyword'] = zen_output_string_protected($_GET['keyword']);

$listing_sql = $select_str . $from_str . $where_str . $order_str;
// Notifier Point
$zco_notifier->notify('NOTIFY_SEARCH_ORDERBY_STRING', $listing_sql);
$breadcrumb->add(NAVBAR_TITLE_1, zen_href_link(FILENAME_ADVANCED_SEARCH));
$breadcrumb->add(NAVBAR_TITLE_2);


$result = new splitPageResults($listing_sql, MAX_DISPLAY_PRODUCTS_LISTING, 'p.products_id', 'page');
if ($result->number_of_rows == 0) {
  $messageStack->add_session('search', TEXT_NO_PRODUCTS, 'caution');
  zen_redirect(zen_href_link(FILENAME_ADVANCED_SEARCH, zen_get_all_get_params('action')));
}
// This should be last line of the script:
$zco_notifier->notify('NOTIFY_HEADER_END_ADVANCED_SEARCH_RESULTS', $keywords);
//EOF

I don't know how to get those stupid smily's out of the post, sorry...
Use the php or quote tages in this html editor

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

8 Nov 2013, 4:40 PM
#24
softcorpse avatar

softcorpse

Zen Follower

Join Date:
Aug 2004
Posts:
96
Plugin Contributions:
0

Re: Product Listing Sorter Drop-Down [Support Thread]

Thank you! That seems to work for the most part, one thing you could perhaps look at in the future is the "price low to high" and vice versa, it doesn't take into account "sales" or "discounted" prices and lists in the order of it's original pricing. But otherwise this works for what I need, thanks so much once again for the mod and the temp fix ;)

8 Nov 2013, 5:00 PM
#25
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,876
Plugin Contributions:
7

Re: Product Listing Sorter Drop-Down [Support Thread]

it doesn't take into account "sales" or "discounted" prices and lists in the order of it's original pricing.
It should, thanks to this bit

Price (low to high):p.products_price_sorter;
Price (high to low):p.products_price_sorter DESC;

Run admin->tools->storemanager->Update ALL Products Price Sorter
see if that corrects the listing.

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

8 Nov 2013, 5:23 PM
#26
softcorpse avatar

softcorpse

Zen Follower

Join Date:
Aug 2004
Posts:
96
Plugin Contributions:
0

Re: Product Listing Sorter Drop-Down [Support Thread]

Ah okay, yes that seemed to work, is that something I need to run often, weird I never knew about those options and have been using zen for donkeys years :D

Thanks!

8 Nov 2013, 5:30 PM
#27
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,876
Plugin Contributions:
7

Re: Product Listing Sorter Drop-Down [Support Thread]

is that something I need to run often
Who knows. That field should not get out of sync with the manipulations done by specials and sales discounting but evidently it does.

The main culprit is bulk product imports or Osc/Zen Cart connectors from other software that don't take account of this field when importing price changes.

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

12 Nov 2013, 2:35 PM
#28
softcorpse avatar

softcorpse

Zen Follower

Join Date:
Aug 2004
Posts:
96
Plugin Contributions:
0

Re: Product Listing Sorter Drop-Down [Support Thread]

I just came across another problem, I am guessing it is because I am on Zen-Cart 1.3.8a, if I click on any of my categories, the page breaks and fails to list the products, I have found that the index_filters > default_filter.php and modules > pages > index > main_template_vars.php is the reason for it not working as when I rename those two the categories all work again. Is there a quick fix for these two files or am I s**t out of luck with this one? :D

12 Nov 2013, 2:44 PM
#29
softcorpse avatar

softcorpse

Zen Follower

Join Date:
Aug 2004
Posts:
96
Plugin Contributions:
0

Re: Product Listing Sorter Drop-Down [Support Thread]

Okay, I managed to edit main_template_vars.php as there was only one change made to that file, but the other one, default_filter.php has been heavily modified and I am not sure I can winmerge that one.

12 Nov 2013, 3:03 PM
#30
softcorpse avatar

softcorpse

Zen Follower

Join Date:
Aug 2004
Posts:
96
Plugin Contributions:
0

Re: Product Listing Sorter Drop-Down [Support Thread]

SoftCorpse:

Okay, I managed to edit main_template_vars.php as there was only one change made to that file, but the other one, default_filter.php has been heavily modified and I am not sure I can winmerge that one.

Okay I think I was able to winmerge the important bits of the default_filter.php as it seems to be working now haha, I left out all the pieces of code which refers to:

if ($debug) echo $debug_prefix.LINE.') etc etc etc.

Is it okay for me to have left that code out? Is that there purely in case of the site breaking and the need for debugging?

13 Nov 2013, 8:51 AM
#31
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,876
Plugin Contributions:
7

Re: Product Listing Sorter Drop-Down [Support Thread]

if ($debug) echo $debug_prefix.LINE.') etc etc etc. Is it okay for me to have left that code out? Is that there purely in case of the site breaking and the need for debugging?
Yes.

And of course you must now received the obligatory telling-off: why on earth are you wasting time on modifying an insecure version of Zen Cart when it could be hacked at any moment? It WILL be hacked, it is only a matter of time.

I am in transit these days so cannot check into this, but I would not anyway...not for an old version.

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

25 Feb 2014, 3:10 PM
#32
clikchic avatar

clikchic

New Zenner

Join Date:
Oct 2005
Posts:
58
Plugin Contributions:
0

Re: Product Listing Sorter Drop-Down [Support Thread]

Is it possible to some how use this plugin in conjunction with the column layout grid plugin? If so what modifications would I need to make?

25 Feb 2014, 5:38 PM
#33
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,876
Plugin Contributions:
7

Re: Product Listing Sorter Drop-Down [Support Thread]

anything is possible but I have no time to try it.

Install this on a new install with the bugfixes above and then install the column mod, merging carefully and see what problems you get.

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

10 Feb 2015, 7:29 PM
#34
time111 avatar

time111

New Zenner

Join Date:
Sep 2008
Posts:
95
Plugin Contributions:
0

Re: Product Listing Sorter Drop-Down [Support Thread]

Hi,

Im trying to use it on 1.5.4v and im getting this error in advance search, no matter what option I choose, Name (asc),Name (desc),Model (asc),Model (desc) etc:

WARNING: An Error occurred, please refresh the page and try again.

Its working fine in product listing but not in Search option. Is it zen cart version issue or im missing something? When this error show, only header of template4 is visible and rest page is white with this error in center nothing else.

~Time

12 Jun 2016, 1:07 PM
#35
ladyofthecave avatar

ladyofthecave

Zen Follower

Join Date:
Jan 2016
Location:
Netherlands
Posts:
150
Plugin Contributions:
0

Re: Product Listing Sorter Drop-Down [Support Thread]

Hi all,

I have a question. I have just installed the Product Listing Sorter, but it messed up completely the layout of my website. Do you happen to know what to do about this? Or is is not possible to use with a column mod?

Attachment 16418

14 Jun 2016, 2:42 PM
#36
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,876
Plugin Contributions:
7

Re: Product Listing Sorter Drop-Down [Support Thread]

Or is is not possible to use with a column mod?
Which column mod?
I have a similar page layout, which works ok. The layout should not matter.

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

15 Jun 2016, 1:55 PM
#37
ladyofthecave avatar

ladyofthecave

Zen Follower

Join Date:
Jan 2016
Location:
Netherlands
Posts:
150
Plugin Contributions:
0

Re: Product Listing Sorter Drop-Down [Support Thread]

Hi Torvista,

That is a good question, I have installed it a long time ago.. I will check :)

15 Jun 2016, 2:06 PM
#38
ladyofthecave avatar

ladyofthecave

Zen Follower

Join Date:
Jan 2016
Location:
Netherlands
Posts:
150
Plugin Contributions:
0

Re: Product Listing Sorter Drop-Down [Support Thread]

Hi again, it was Column layout grid..

I have tried to install the mod two times, just in case I missed something the first time, but both times, it changed the column layout,

15 Jun 2016, 9:17 PM
#39
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,876
Plugin Contributions:
7

Re: Product Listing Sorter Drop-Down [Support Thread]

Ok, I have just spent my non-existent spare time checking this.
I dropped the Column Grid Layout into a ZC155a vanilla installation, merging the ZC155 changes. Worked first time.

I checked my files for PLS in my development ZC155 shop with those uploaded and made a new fileset ready to drop into a ZC155 install so all the template directories are named classic.

I merged the two filesets (Column Grid Layout and Product Listing Sorter) and made this
https://dl.dropboxusercontent.com/u/57111073/column_layout_grid_2_3_1_PLS_merged.zip

I dropped this into a vanilla ZC155 and it worked ok as far as I could see. How it plays with your customised shops is another matter....

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

7 Aug 2018, 3:03 PM
#40
marton_1 avatar

marton_1

Totally Zenned

Join Date:
Apr 2013
Location:
eglisau switzerland
Posts:
568
Plugin Contributions:
0

Re: Product Listing Sorter Drop-Down [Support Thread]

Hi, I have been using this addon for some time and am happy with it.
I have zencart 155f, standard green template and PHP 5.6

When I select a category then the sorter enter field shows up and I can sort fine.

But if I select a set of products using the built in zen cart search option, like, for example, "coat" then the relevant 46 products and the sorter enter field show up fine.
But when I try to sort I get a PHP error

[07-Aug-2018 17:00:38 Europe/Zurich] PHP Fatal error:  1064:You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'order by p.products_sort_order, pd.products_name limit 20' at line 1 :: SELECT DISTINCT p.products_image, p.products_quantity ,  p.products_sort_order, m.manufacturers_id, p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_price_sorter, p.products_qty_box_status, p.master_categories_id FROM (products p              LEFT JOIN manufacturers m              USING(manufacturers_id), products_description pd, categories c, products_to_categories p2c )              LEFT JOIN meta_tags_products_description mtpd              ON mtpd.products_id= p2c.products_id              AND mtpd.language_id = 1 WHERE (p.products_status = 1                AND p.products_id = pd.products_id                AND pd.language_id = 1                AND p.products_id = p2c.products_id                AND p2c.categories_id = c.categories_id  AND ((pd.products_name LIKE '%coat%'                                          OR p.products_model                                          LIKE '%coat%'                                          OR m.manufacturers_name                                          LIKE '%coat%' OR (mtpd.metatags_keywords                         LIKE '%coat%'                         AND mtpd.metatags_keywords !='') OR (mtpd.metatags_description                         LIKE '%coat%'                         AND mtpd.metatags_description !='') OR pd.products_description                           LIKE '%coat%') )) order by p.products_price_sorter order by p.products_sort_order, pd.products_name limit 20 ==> (as called by) /home/httpd/vhosts/simmar.ch/httpdocs/catalog/includes/modules/responsive_simmar/product_listing.php on line 117 <== in /home/httpd/vhosts/simmar.ch/httpdocs/catalog/includes/classes/db/mysql/query_factory.php on line 171

My website is https://www.simmar.ch/catalog

You may want to select "english language"