karrde2xl Posted March 11, 2009 Report Share Posted March 11, 2009 Hallo, habe ein Problem mit meinem Shop. Benutze die aktuellste Version xt:Commerce v3.0.4 SP2.1 Besitze einen Artikel, den ich in mehreren Unterkategorien verlinkt habe. Wenn ich die Seite dieser Kategorie darüber aufrufe, dann sehe ich unter neue Artikel diesen doppelt, da dieser in derzeit 2 Unterkategorien eingestellt ist. Wie kann ich verhindern, das dieser Artikel dort mehrmals zu sehen ist ? Bin in PHP nicht so bewandert und würde mich freuen wenn mir jemand damit helfen könnte. Danke schon mal im voraus. Link to comment Share on other sites More sharing options...
karrde2xl Posted March 11, 2009 Author Report Share Posted March 11, 2009 Hab im Forum einen Eintrag gefunden, aber wenn ich das einsetze erhalte ich einen Fehler und keine Produkte werden angezeigt. http://www.xt-commerce.com/forum/showthread.php?t=35691&highlight=distinct Hier mal der Code von new_products.php <?php /* ----------------------------------------------------------------------------------------- $Id: new_products.php 1292 2005-10-07 16:10:55Z mz $ XT-Commerce - community made shopping http://www.xt-commerce.com Copyright © 2003 XT-Commerce ----------------------------------------------------------------------------------------- based on: © 2000-2001 The Exchange Project (earlier name of osCommerce) © 2002-2003 osCommerce(new_products.php,v 1.33 2003/02/12); www.oscommerce.com © 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 | [email protected] 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."' "; } $new_products_query = "SELECT * 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 ".$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 = "select distinct p.products_id, p.products_fsk18, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id ".$fsk_lock." and pd.language_id = '" . (int)$_SESSION['languages_id'] . "' where c.categories_status=1 and p.products_id = p2c.products_id and c.categories_id = p2c.categories_id and products_status = '1' ".$group_check." ".$fsk_lock." ".$days." and c.parent_id = '".$new_products_category_id."' order by p.products_date_added DESC limit ".MAX_DISPLAY_NEW_PRODUCTS; 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); } ?> Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.