Zurück   xt:Commerce Webshop Shop Support > xt:Commerce Shopsoftware Community Area > Installation und Konfiguration

Antwort
 
LinkBack Themen-Optionen Ansicht
  #1 (permalink)  
Alt 12.12.2008, 13:24
taf taf ist offline
Neuer Benutzer
 
Registriert seit: 11.11.2008
Beiträge: 3
Standard Lösung: Produkte aller unteren benen in Kategorieübersicht anzeigen

xt-Commerce hat das Problem, dass in den Kategorien nur die Produkte der nächst tieferen Kategorieebene angezeigt werden. Dieses Problem konnte ich lösen und möchte diesen Lösungsansatz hier bereitstellen.

Mit dieser Lösung werden bereits in der ersten Kategorieebene die Produkte der nächsten beiden Ebenen aufgeführt. Zu ändern ist die mySQL-Anfrage in der Datei: /Includes/Modules/new_products.php. Damit keine Fehler auftreten poste ich hier die ges. Datei:

Code:
<?php


/* -----------------------------------------------------------------------------------------
   $Id: new_products.php 1292 2005-10-07 16:10:55Z mz $

   XT-Commerce - community made shopping
   http://www.xt-commerce.com

   Copyright (c) 2003 XT-Commerce
   -----------------------------------------------------------------------------------------
   based on: 
   (c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
   (c) 2002-2003 osCommerce(new_products.php,v 1.33 2003/02/12); www.oscommerce.com
   (c) 2003	 nextcommerce (new_products.php,v 1.9 2003/08/17); www.nextcommerce.org

   Released under the GNU General Public License 
   -----------------------------------------------------------------------------------------
   Third Party contributions:
   Enable_Disable_Categories 1.3        	Autor: Mikel Williams | mikel@ladykatcostumes.com

   Released under the GNU General Public License
   ---------------------------------------------------------------------------------------*/

$module_smarty = new Smarty;
$module_smarty->assign('tpl_path', 'templates/'.CURRENT_TEMPLATE.'/');

//fsk18 lock
$fsk_lock = '';
if ($_SESSION['customers_status']['customers_fsk18_display'] == '0')
	$fsk_lock = ' and p.products_fsk18!=1';

if ((!isset ($new_products_category_id)) || ($new_products_category_id == '0')) {
	if (GROUP_CHECK == 'true')
		$group_check = " and p.group_permission_".$_SESSION['customers_status']['customers_status_id']."=1 ";

	$new_products_query = "SELECT * FROM
	                                         ".TABLE_PRODUCTS." p,
	                                         ".TABLE_PRODUCTS_DESCRIPTION." pd WHERE
	                                         p.products_id=pd.products_id and
	                                         p.products_startpage = '1'
	                                         ".$group_check."
	                                         ".$fsk_lock."
	                                         and p.products_status = '1' and pd.language_id = '".(int) $_SESSION['languages_id']."'
	                                         order by p.products_startpage_sort ASC limit ".MAX_DISPLAY_NEW_PRODUCTS;
} else {

	if (GROUP_CHECK == 'true')
		$group_check = "and p.group_permission_".$_SESSION['customers_status']['customers_status_id']."=1 ";

	if (MAX_DISPLAY_NEW_PRODUCTS_DAYS != '0') {
		$date_new_products = date("Y.m.d", mktime(1, 1, 1, date(m), date(d) - MAX_DISPLAY_NEW_PRODUCTS_DAYS, date(Y)));
		$days = " and p.products_date_added > '".$date_new_products."' ";
	}
	
	// Neue Anfrage / Änderung
		$new_products_query = "
		 SELECT *
FROM (
(

SELECT p. * , 
pd.language_id, pd.products_name, pd.products_description, pd.products_short_description, pd.products_keywords, pd.products_meta_title, pd.products_meta_description, pd.products_meta_keywords, pd.products_url, pd.products_viewed , c.categories_id, c.categories_image, c.parent_id, c.categories_status, c.categories_template,  c.listing_template, c.sort_order, c.products_sorting, c.products_sorting2, c.date_added, c.last_modified
FROM 
				".TABLE_PRODUCTS." p,
	            ".TABLE_PRODUCTS_DESCRIPTION." pd,
	            ".TABLE_PRODUCTS_TO_CATEGORIES." p2c,
	            ".TABLE_CATEGORIES." c
WHERE c.categories_status = '1'
AND p.products_id = p2c.products_id
AND p.products_id = pd.products_id
AND p2c.categories_id = c.categories_id
AND c.parent_id = '".$new_products_category_id."'
AND p.products_status = '1'
AND pd.language_id = '".(int) $_SESSION['languages_id']."'
)
UNION ALL 
(
SELECT p. * , pd.language_id, pd.products_name, pd.products_description, pd.products_short_description, pd.products_keywords, pd.products_meta_title, pd.products_meta_description, pd.products_meta_keywords, pd.products_url, pd.products_viewed , c.categories_id, c.categories_image, c.parent_id, c.categories_status, c.categories_template,  c.listing_template, c.sort_order, c.products_sorting, c.products_sorting2, c.date_added, c.last_modified
FROM
 				".TABLE_PRODUCTS." p,
	            ".TABLE_PRODUCTS_DESCRIPTION." pd,
	            ".TABLE_PRODUCTS_TO_CATEGORIES." p2c,
	            ".TABLE_CATEGORIES." c,
	            ".TABLE_CATEGORIES." c2
WHERE c.parent_id = c2.categories_id
AND c.categories_status = '1'
AND p.products_id = p2c.products_id
AND p.products_id = pd.products_id
AND p2c.categories_id = c.categories_id
AND c2.parent_id = '".$new_products_category_id."'
AND p.products_status = '1'
AND pd.language_id = '".(int) $_SESSION['languages_id']."'
)
)t3
WHERE NOT (products_shippingtime = 3 or products_shippingtime = 5)  LIMIT ".MAX_DISPLAY_NEW_PRODUCTS.";";	
/* ALTE ANFRAGE:
		SELECT * FROM
	                                        ".TABLE_PRODUCTS." p,
	                                        ".TABLE_PRODUCTS_DESCRIPTION." pd,
	                                        ".TABLE_PRODUCTS_TO_CATEGORIES." p2c,
	                                        ".TABLE_CATEGORIES." c,
											".TABLE_CATEGORIES." c2
	                                   WHERE 
										(
											c.categories_status='1'
	                                        and p.products_id = p2c.products_id and p.products_id=pd.products_id
	                                        and p2c.categories_id = c.categories_id
	                                        ".$group_check."
	                                        ".$fsk_lock."
	                                        and c.parent_id = '".$new_products_category_id."'
	                                        and p.products_status = '1' and pd.language_id = '".(int) $_SESSION['languages_id']."'
										) or (
											c2.parent_id = c.categories_id 
											and c2.categories_status='1'
	                                        and p.products_id = p2c.products_id and p.products_id=pd.products_id
	                                        and p2c.categories_id = c2.categories_id
	                                        ".$group_check."
	                                        ".$fsk_lock."
	                                        and c.parent_id = '".$new_products_category_id."'
	                                        and p.products_status = '1' and pd.language_id = '".(int) $_SESSION['languages_id']."'
										) ORDER BY p.products_date_added DESC limit ".MAX_DISPLAY_NEW_PRODUCTS;
								
*/
}
$row = 0;
$module_content = array ();
$new_products_query = xtDBquery($new_products_query);
while ($new_products = xtc_db_fetch_array($new_products_query, true)) {
	$module_content[] = $product->buildDataArray($new_products);

}
if (sizeof($module_content) >= 1) {
	$module_smarty->assign('language', $_SESSION['language']);
	$module_smarty->assign('module_content', $module_content);
	
	// set cache ID
	 if (!CacheCheck()) {
		$module_smarty->caching = 0;
		if ((!isset ($new_products_category_id)) || ($new_products_category_id == '0')) {
			$module = $module_smarty->fetch(CURRENT_TEMPLATE.'/module/new_products_default.html');
		} else {
			$module = $module_smarty->fetch(CURRENT_TEMPLATE.'/module/new_products.html');
		}
	} else {
		$module_smarty->caching = 1;
		$module_smarty->cache_lifetime = CACHE_LIFETIME;
		$module_smarty->cache_modified_check = CACHE_CHECK;
		$cache_id = $new_products_category_id.$_SESSION['language'].$_SESSION['customers_status']['customers_status_name'].$_SESSION['currency'];
		if ((!isset ($new_products_category_id)) || ($new_products_category_id == '0')) {
			$module = $module_smarty->fetch(CURRENT_TEMPLATE.'/module/new_products_default.html', $cache_id);
		} else {
			$module = $module_smarty->fetch(CURRENT_TEMPLATE.'/module/new_products.html', $cache_id);
		}
	}
	$default_smarty->assign('MODULE_new_products', $module);
}
?>

Ich hoffe, dass es einigen Arbeit spart !
taf

Geändert von taf (12.12.2008 um 13:40 Uhr)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
Antwort

Lesezeichen

Stichworte
anzeigen, benen, kategorieübersicht, lösung, produkte, unteren

Themen-Optionen
Ansicht

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are aus
Pingbacks are aus
Refbacks are aus


Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
Produkte von Unterrubrik in Oberrubrik anzeigen byff Template System 0 09.04.2007 15:44
Bei Auflistung Produkte eines Herstellers Logo anzeigen Roespompoes Allgemeine Diskussionen 0 02.04.2007 23:06
Unter Hauptkategorie alle Produkte anzeigen, trotz Unterkategorieren ideefix Template System 1 06.03.2007 11:08
Produkte des Monats/der Woche und die auch auf anderer Webseite anzeigen? DieMilchMachts Allgemeine Diskussionen 2 02.08.2006 10:16


Alle Zeitangaben in WEZ +1. Es ist jetzt 14:58 Uhr.

Copyright © 2011 xt:Commerce GmbH / xt:Commerce International Ltd. - All Rights Reserved

xt:Commerce is a SafeCharge brand