if (isset($_GET["perPage"])) {
$output_header .= tep_draw_hidden_field('perPage', $_GET['perPage']);
}
if (isset($_GET["keywords"])) {
$output_header .= tep_draw_hidden_field('keywords', $_GET['keywords']);
}
$output_header .= '
';
$output_header .= '| ';
// create column list
$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,
'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW);
asort($define_list);
$column_list = array();
reset($define_list);
while (list($key, $value) = myEach($define_list)) {
if ($value > 0) $column_list[] = $key;
}
$select_column_list = '';
for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
switch ($column_list[$i]) {
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;
}
}
$languages_id = 2;
$select_str = "select distinct " . $select_column_list . " p.products_model, pd.products_description, m.manufacturers_id, p.products_date_added, p.products_id, pd.products_name, p.wawi_manufacturer, p.products_availability, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price ";
if ( (DISPLAY_PRICE_WITH_TAX == 'true') && (tep_not_null($pfrom) || tep_not_null($pto)) ) {
$select_str .= ", SUM(tr.tax_rate) as tax_rate ";
}
$from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id) left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id";
if ( (DISPLAY_PRICE_WITH_TAX == 'true') && (tep_not_null($pfrom) || tep_not_null($pto)) ) {
if (!tep_session_is_registered('customer_country_id')) {
$customer_country_id = STORE_COUNTRY;
$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 = '" . (int)$customer_country_id . "'";
}
$from_str .= ", " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";
$where_str = " where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id ";
if ( (DISPLAY_PRICE_WITH_TAX == 'true') && (tep_not_null($pfrom) || tep_not_null($pto)) ) {
$where_str .= ' AND gz.geo_zone_id is not null ';
}
if (isset($_GET['categories_id']) && tep_not_null($_GET['categories_id'])) {
if (isset($_GET['inc_subcat']) && ($_GET['inc_subcat'] == '1')) {
$subcategories_array = array();
tep_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 = '" . (int)$_GET['categories_id'] . "'";
for ($i=0, $n=sizeof($subcategories_array); $i<$n; $i++ ) {
$where_str .= " or p2c.categories_id = '" . (int)$subcategories_array[$i] . "'";
}
$where_str .= ")";
} else {
$where_str .= " and p2c.products_id = p.products_id and p2c.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$_GET['categories_id'] . "'";
}
}
if (isset($_GET['manufacturers_id']) && tep_not_null($_GET['manufacturers_id'])) {
$where_str .= " and m.manufacturers_id = '" . (int)$_GET['manufacturers_id'] . "'";
}
if (isset($search_keywords) && (sizeof($search_keywords) > 0)) {
if ( strpos( $keywords, 'utor:' ) > 0 ) {
$where_str .= "AND (lower(p.products_author) LIKE '%" . strtolower(substr($keywords, 6)) . "%')";
}
else {
$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:
$keyword = str_replace( "*", "", tep_db_prepare_input($search_keywords[$i]));
$where_str .= "(pd.products_name like '%" . tep_db_input($keyword) . "%' or p.products_model like '%" . tep_db_input($keyword) . "%' or m.manufacturers_name like '%" . tep_db_input($keyword) . "%'";
if (isset($_GET['search_in_description']) && ($_GET['search_in_description'] == '1')) $where_str .= " or pd.products_description like '%" . tep_db_input($keyword) . "%'";
$where_str .= ')';
break;
}
}
$where_str .= " )";
}
}
if (tep_not_null($dfrom)) {
$where_str .= " and p.products_date_added >= '" . tep_date_raw($dfrom) . "'";
}
if (tep_not_null($dto)) {
$where_str .= " and p.products_date_added <= '" . tep_date_raw($dto) . "'";
}
if (tep_not_null($pdate)) {
$where_str .= " and p.products_addition = '" . $pdate . "'";
}
if (tep_not_null($designer)) {
$where_str .= " and lower(p.products_author) LIKE '%" . strtolower($designer) . "%'";
}
if (tep_not_null($autor)) {
$where_str .= " and p.products_author = '" . $autor . "'";
}
if (tep_not_null($age)) {
$where_str .= " and p.products_age > 0 AND p.products_age <= '" . $age . "'";
}
if (tep_not_null($artist)) {
$where_str .= " and lower(p.products_grafik) LIKE '%" . strtolower($artist) . "%'";
}
if (tep_not_null($cfrom)) {
$where_str .= " and p.products_count_from >= '" . $cfrom . "' and p.products_count_to <= '" . $cto . "'";
}
if (tep_not_null($cto)) {
$cto .= " and p.products_count_to = '" . $cto . "'";
}
if (tep_not_null($pfrom)) {
if ($currencies->is_set($currency)) {
$rate = $currencies->get_value($currency);
$pfrom = $pfrom / $rate;
}
}
if (tep_not_null($pto)) {
if (isset($rate)) {
$pto = $pto / $rate;
}
}
if (DISPLAY_PRICE_WITH_TAX == 'true') {
if ($pfrom > 0) $where_str .= " and (IF(s.status, s.specials_new_products_price, p.products_price) * if(gz.geo_zone_id is null, 1, 1 + (tr.tax_rate / 100) ) >= " . (double)$pfrom . ")";
if ($pto > 0) $where_str .= " and (IF(s.status, s.specials_new_products_price, p.products_price) * if(gz.geo_zone_id is null, 1, 1 + (tr.tax_rate / 100) ) <= " . (double)$pto . ")";
} else {
if ($pfrom > 0) $where_str .= " and (IF(s.status, s.specials_new_products_price, p.products_price) >= " . (double)$pfrom . ")";
if ($pto > 0) $where_str .= " and (IF(s.status, s.specials_new_products_price, p.products_price) <= " . (double)$pto . ")";
}
$filter_str = '';
if (isset($_GET['filter_id']) && tep_not_null($_GET['filter_id'])) {
$filter_str = " and p.manufacturers_id = '" . $_GET['filter_id'] . "'";
}
if ( (DISPLAY_PRICE_WITH_TAX == 'true') && (tep_not_null($pfrom) || tep_not_null($pto)) ) {
//$where_str .= " group by p.products_id, tr.tax_priority";
$group_str .= " group by p.products_id";
}
if ( (!isset($_GET['sort'])) || (!preg_match('/[1-8][ad]/i', $_GET['sort'])) || (substr($_GET['sort'], 0, 1) > sizeof($column_list)) ) {
for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
if ($column_list[$i] == 'PRODUCT_LIST_NAME') {
$_GET['sort'] = $i+1 . 'a';
$order_str = ' order by pd.products_name';
break;
}
}
} else {
$sort_col = substr($_GET['sort'], 0 , 1);
$sort_order = substr($_GET['sort'], 1);
$order_str = ' order by ';
$logdatei=fopen("logfile_s.txt","a");
fputs($logdatei, date("d.m.Y, H:i:s",time()) . ": case: " . $column_list[$sort_col-1] . "\n");
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";
break;
}
}
$listing_sql = $select_str . $from_str . $where_str . $filter_str . $group_str . $order_str;
$logdatei=fopen("logfile_s.txt","a");
fputs($logdatei, date("d.m.Y, H:i:s",time()) . ": " . $listing_sql . "\n");
fclose($logdatei);
?>
$filterlist_sql= "select distinct m.manufacturers_id as id, m.manufacturers_name as name from " . TABLE_PRODUCTS . " p LEFT JOIN " . TABLE_MANUFACTURERS . " m ON p.manufacturers_id = m.manufacturers_id where p.products_id IN (SELECT p.products_id " . $from_str . $where_str . $group_str . ") order by m.manufacturers_name";
$filterlist_query = tep_db_query($filterlist_sql);
if (isset($_REQUEST['newest']) || tep_db_num_rows($filterlist_query) > 1) {
if (isset($HTTP_GET_VARS['manufacturers_id'])) {
echo tep_draw_hidden_field('manufacturers_id', $HTTP_GET_VARS['manufacturers_id']);
$options = array(array('id' => '', 'text' => TEXT_ALL_CATEGORIES));
} else {
echo tep_draw_hidden_field('cPath', $cPath);
$options = array(array('id' => '', 'text' => TEXT_ALL_MANUFACTURERS));
}
echo tep_draw_form('advanced_search', FILENAME_ADVANCED_SEARCH_RESULT, 'get');
echo $hiddenFields;
while ($filterlist = tep_db_fetch_array($filterlist_query)) {
$options[] = array('id' => $filterlist['id'], 'text' => $filterlist['name']);
}
echo '' . tep_draw_pull_down_menu('filter_id', $options, (isset($_GET['filter_id']) ? $_GET['filter_id'] : ''), 'onchange="this.form.submit()"') . '';
}
?>
require(DIR_WS_MODULES . 'product_listing.php');
// Search enhancement mod start
$search_enhancements_keywords = $_GET['keywords'];
$search_enhancements_keywords = strip_tags($search_enhancements_keywords);
$search_enhancements_keywords = addslashes($search_enhancements_keywords);
if ( $search_enhancements_keywords != $last_search_insert && strlen($search_enhancements_keywords) > 4 ) {
tep_db_query("insert into search_queries (search_text, last_modified, search_count) values ('" . $search_enhancements_keywords . "', now(), " . $listing_split->get_count() . ")");
tep_session_register('last_search_insert');
$last_search_insert = $search_enhancements_keywords;
}
// Search enhancement mod end
?>
Über 9.000 Artikel
|
Mehr als 1.000 Verlage
|
Persönliche Empfehlungen
|
Schneller Versand
|
Schneller Versand
|
Der Artikel wurde ihrem Warenkorb hinzugefügt.
|