Hallo, wie oben beschrieben, möchten wir eine Ausgabe der MPN in den Artikeldetails. EAN haben wir bereits geschafft. Allerdings scheint das nicht mit der MPN zu funktionieren. Hat jemand eine Idee? Danke im Voraus FMJ
Hallo, keiner eine Idee? ich glaube ich spezifiziere das noch einmal. Wir haben Gambio GX2 v2.0.8 SP 1.2 r5611 installiert. Da gibt es im Backend bei der Artikeleinpflege die Felder EAN und MPN. EAN haben wir folgendermaßen dazu gebracht, beim Artikel angezeigt zu werden: PHP: {if $PRODUCTS_EAN!=''} <dt>EAN:</dt> <dd>{$PRODUCTS_EAN}</dd> {/if} Nun funktioniert das aber irgendwie nicht mit der MPN.... Hat da jemand eine Idee? Danke im Voraus FMJ p.s.: wir sind keine Programmierer
Die neuen Informationen (z.B. MPN, ISBN...) werden nicht an das Template weiter gereicht..... Da muss man programmieren, um die zu bekommen.
Ehrlich gesagt finde ich, dass das eine Katastrophe ist, dass fundamental wichtige Informationen, wie eine Herstellernummer, nicht ausgegeben werden können. Gerade im Elektronikbereich ist das ein "Must have" Hier MUSS Gambio unbedingt nachlegen.... Grüße und schöne Ostern FMJ
Das Schöne an der neuen Gambio-SP-Version ist ja, dass man (in weiten Teilen) nicht mehr darauf warten muss, bis das in einem neuen Release standardmäßig enthalten ist, sondern man das mit Hilfe der Klassenüberladung schnell selbst machen kann. Ich habe das mal realisiert, dass nun die neuen Felder 'PRODUCTS_ISBN', 'PRODUCTS_UPC', 'PRODUCTS_MPN', 'PRODUCTS_JAN', 'PRODUCTS_BRAND_NAME' im Template (updatesicher) zur Verfügung stehen... Dazu den folgenden Code nach "user_classes\overloads\ProductInfoContentView\pt_pic_ProductInfoContentView.inc.php" kopieren. PHP: <?php/* Extend ProductInfoContentView to add various new product item codes to the template Copyright (c) 2012: Avenger, entwicklung@powertemplate.de*/class pt_pic_ProductInfoContentView extends pt_pic_ProductInfoContentView_parent{ function get_html($p_coo_product, $p_current_category_id = 0) { $products_id=$p_coo_product->data['products_id']; if ($products_id) { $sql=' SELECT * FROM products_item_codes WHERE products_id='.$products_id; $res=xtc_db_query($sql); while ($products_item_codes=xtc_db_fetch_array($res)) { $this->set_content_data('PRODUCTS_ISBN', $products_item_codes['code_isbn']); $this->set_content_data('PRODUCTS_UPC', $products_item_codes['code_upc']); $this->set_content_data('PRODUCTS_MPN', $products_item_codes['code_mpn']); $this->set_content_data('PRODUCTS_JAN', $products_item_codes['code_jan']); $this->set_content_data('PRODUCTS_BRAND_NAME', $products_item_codes['brand_name']); } } return parent::get_html($p_coo_product, $p_current_category_id); }}?> Dann die Caches löschen und die neuen Felder im Template einbauen, und schon kann man die neuen Daten verwenden.
Das ist ja schon ganz schön, aber es wäre natürlich noch schöner, wenn man auch nach diesen Feldern suchen könnte... Da das Suchmodul "advanced_search_result.php" leider noch nicht als Klasse "refactored" wurde, müsste man die notwendige Erweiterung direkt dort einbauen, und nicht updatesicher arbeiten... Da das total uncool ist, habe ich die Suche neu gestaltet, mit dem Ziel, die Generierung des Such-SQL zu trennen vom Programm-Rahmen, und die Generierung des Such-SQL in eine neue Klasse auszulagern. Und dabei so zu gestalten, dass man durch Klassenüberladung eigene Tabellen, Suchfelder und Suchbedingungen dazu packen kann, und dabei updatesicher zu bleiben.... Die Generierung des Such-SQL wurde in die Klasse "system\controls\AdvancedSearchResult.inc.php" ausgelagert (und codemäßig etwas bereinigt...). Diese Klasse sieht jetzt wie folgt aus: PHP: <?php/* --------------------------------------------------------------AdvancedSearchResult.inc.php 2012-04-08 avengerCopyright (c) 2012 Avenger, entwicklung@powertemplate.deRefactored advanced_search_result.php to PHP class usage in order to extend search sql--------------------------------------------------------------based on:(c) 2000-2001 The Exchange Project (earlier name of osCommerce)(c) 2002-2003 osCommerce(advanced_search_result_result.php,v 1.68 2003/05/14); www.oscommerce.com(c) 2003 nextcommerce (advanced_search_result_result.php,v 1.17 2003/08/21); www.nextcommerce.org(c) 2005 XT-Commerce - community made shopping http://www.xt-commerce.com ($Id: advanced_search_result_result.php 1141 2005-08-10 11:31:36Z novalis $)Released under the GNU General Public License---------------------------------------------------------------------------------------*/class AdvancedSearchResult{ var $tax_where,$fsk_lock,$group_check,$manu_check,$subcat_join,$subcat_where; var $keywords,$pfrom,$pto,$pfrom_check,$pto_check; var $search_in_desc,$search_in_attr; function AdvancedSearchResult() { $this->keywords=$_GET['keywords']; $this->pfrom=$_GET['pfrom']; $this->pto=$_GET['pto']; $this->search_in_attr=SEARCH_IN_ATTR == 'true'; $this->search_in_desc = SEARCH_IN_DESC == 'true'; //fsk18 lock if ($_SESSION['customers_status']['customers_fsk18_display'] == '0') { $this->fsk_lock = " AND p.products_fsk18 != '1' "; } else { unset ($this->fsk_lock); } //group check if (GROUP_CHECK == 'true') { $this->group_check = " AND p.group_permission_".$_SESSION['customers_status']['customers_status_id']."=1 "; } else { unset ($this->group_check); } //manufacturers if set if (isset ($_GET['manufacturers_id']) && xtc_not_null($_GET['manufacturers_id'])) { $this->manu_check = " AND p.manufacturers_id = '".(int)$_GET['manufacturers_id']."' "; } //include subcategories if needed if (isset ($_GET['categories_id']) && xtc_not_null($_GET['categories_id'])) { if ($_GET['inc_subcat'] == '1') { $subcategories_array = array (); xtc_get_subcategories($subcategories_array, (int)$_GET['categories_id']); $this->subcat_join = " LEFT OUTER JOIN ".TABLE_PRODUCTS_TO_CATEGORIES." AS p2c ON (p.products_id = p2c.products_id) "; $this->subcat_where = " AND p2c.categories_id IN ('".(int) $_GET['categories_id']."' "; foreach ($subcategories_array AS $scat) { $this->subcat_where .= ", '".$scat."'"; } $this->subcat_where .= ") "; } else { $this->subcat_join = " LEFT OUTER JOIN ".TABLE_PRODUCTS_TO_CATEGORIES." AS p2c ON (p.products_id = p2c.products_id) "; $this->subcat_where = " AND p2c.categories_id = '".(int) $_GET['categories_id']."' "; } } if ($this->pfrom || $this->pto) { $rate = xtc_get_currencies_values($_SESSION['currency']); $rate = $rate['value']; if ($rate && $this->pfrom != '') { $this->pfrom = $this->pfrom / $rate; } if ($rate && $this->pto != '') { $this->pto = $this->pto / $rate; } } //price filters if($_SESSION['customers_status']['customers_status_show_price_tax'] != 0) { if (($this->pfrom != '') && (is_numeric($this->pfrom))) { $this->pfrom_check = " AND (IF(s.status = '1' AND p.products_id = s.products_id, s.specials_new_products_price, p.products_price) * (tax_rate/100+1) >= ".xtc_db_input($this->pfrom).") "; } else { unset ($this->pfrom_check); } if (($this->pto != '') && (is_numeric($this->pto))) { $this->pto_check = " AND (IF(s.status = '1' AND p.products_id = s.products_id, s.specials_new_products_price, p.products_price) * (tax_rate/100+1) <= ".xtc_db_input($this->pto)." ) "; } else { unset ($this->pto_check); } } else { if (($this->pfrom != '') && (is_numeric($this->pfrom))) { $this->pfrom_check = " AND (IF(s.status = '1' AND p.products_id = s.products_id, s.specials_new_products_price, p.products_price) >= ".xtc_db_input($this->pfrom).") "; } else { unset ($this->pfrom_check); } if (($this->pto != '') && (is_numeric($this->pto))) { $this->pto_check = " AND (IF(s.status = '1' AND p.products_id = s.products_id, s.specials_new_products_price, p.products_price) <= ".xtc_db_input($this->pto)." ) "; } else { unset ($this->pto_check); } } } function get_search_fields() { return " p.products_id, p.products_price, p.products_model, p.products_quantity, p.products_shippingtime, p.products_fsk18, p.products_image, p.products_weight, p.products_tax_class_id, p.products_vpe, p.products_vpe_status, p.products_vpe_value, pd.products_name, pd.products_short_description, pd.products_description"; } function get_search_tables() { $from_str = TABLE_PRODUCTS." AS p LEFT JOIN ".TABLE_PRODUCTS_DESCRIPTION." AS pd ON (p.products_id = pd.products_id) "; $from_str .= $this->subcat_join; if ($this->search_in_attr) { $from_str .= " LEFT OUTER JOIN ".TABLE_PRODUCTS_ATTRIBUTES." AS pa ON (p.products_id = pa.products_id) LEFT OUTER JOIN ".TABLE_PRODUCTS_OPTIONS_VALUES." AS pov ON (pa.options_values_id = pov.products_options_values_id) LEFT OUTER JOIN products_properties_combis AS ppc ON (p.products_id = ppc.products_id) "; } $from_str .= " LEFT OUTER JOIN ".TABLE_SPECIALS." AS s ON (p.products_id = s.products_id) AND s.status = '1'"; if (( $_SESSION['customers_status']['customers_status_show_price_tax'] != 0) && ((isset ($this->pfrom) && xtc_not_null($this->pfrom)) || (isset ($this->pto) && xtc_not_null($this->pto)))) { if (!isset ($_SESSION['customer_country_id'])) { $_SESSION['customer_country_id'] = STORE_COUNTRY; $_SESSION['customer_zone_id'] = STORE_ZONE; } $from_str .= " LEFT OUTER JOIN ".TABLE_TAX_RATES." tr ON (p.products_tax_class_id = tr.tax_class_id) LEFT OUTER JOIN ".TABLE_ZONES_TO_GEO_ZONES." gz ON (tr.tax_zone_id = gz.geo_zone_id) "; $this->tax_where = " AND (gz.zone_country_id IS NULL OR gz.zone_country_id = '0' OR gz.zone_country_id = '". (int) $_SESSION['customer_country_id']."') AND (gz.zone_id is null OR gz.zone_id = '0' OR gz.zone_id = '".(int) $_SESSION['customer_zone_id']."')"; } else { unset ($this->tax_where); } return $from_str; } function get_user_search_where($like_keyword) { return ''; } function get_search_where() { //where-string $language_id=(int) $_SESSION['languages_id']; $where_str = " p.products_status = '1' "." AND pd.language_id = '".$language_id."'". $this->subcat_where. $this->fsk_lock. $this->manu_check. $this->group_check. $this->tax_where. $this->pfrom_check. $this->pto_check; //go for keywords... this is the main search process if (isset ($this->keywords) && xtc_not_null($this->keywords)) { if (xtc_parse_search_string(stripslashes($this->keywords), $search_keywords)) { $where_str .= " AND ( "; for ($i = 0, $n = sizeof($search_keywords); $i < $n; $i ++) { $keyword=$search_keywords[$i]; $keyword_1=addslashes($keyword); $like_keyword_1="LIKE ('%$keyword_1%')"; $keyword_2=addslashes(htmlentities($keyword)); $like_keyword_2="LIKE ('%$keyword_2%')"; switch ($keyword) { case '(' : case ')' : case 'and' : case 'or' : $where_str .= " ".$keyword." "; break; default : $where_str .= " ( "; $where_str .= "pd.products_keywords $like_keyword_1 "; if ($this->search_in_desc) { $where_str .= "OR pd.products_description $like_keyword_2 "; $where_str .= "OR pd.products_short_description $like_keyword_2 "; } $where_str .= "OR pd.products_name $like_keyword_1 "; $where_str .= "OR p.products_model $like_keyword_1 "; $where_str .= $this->add_user_search_fields($like_keyword_1); if ($this->search_in_attr) { $where_str .= "OR pa.attributes_model $like_keyword_1 "; $where_str .= "OR ppc.combi_model $like_keyword_1 "; $where_str .= "OR (pov.products_options_values_name $like_keyword_1 "; $where_str .= "AND pov.language_id = '".$language_id."')"; } $where_str .= " ) "; break; } } // $where_str .= " ) GROUP BY p.products_id ORDER BY p.products_id "; $where_str .= " )"; } } return $where_str; } function create_search_sql() { //build query $select_str = "SELECT distinct ".$this->get_search_fields(); $from_str = " FROM ".$this->get_search_tables(); $where_str = " WHERE ".$this->get_search_where()." GROUP BY p.products_id"; //glue together // BOF GM_MOD if ($this->keywords) { $listing_sql = $select_str. $from_str. $where_str; } else { $listing_sql = 'SELECT products_id FROM products WHERE products_id = 0'; } # GM_MOD sorting if (isset($_GET['listing_sort'])) { $coo_listing_manager = MainFactory::create_object('ListingManager'); $t_orderby = $coo_listing_manager->get_sql_sort_part($_GET['listing_sort']); if($t_orderby != '') $listing_sql .= $t_orderby; } return $listing_sql; }}?> Damit habe ich jetzt die Möglichkeit geschaffen, in die Generierung des Such-SQL mit Hilfe eines "Overload"-Moduls einzugreifen! Für den konkreten Fall der Sucherweiterung mit den neuen Feldern wird folgendes "Overload"-Modul verwendet: ("user_classes\overloads\AdvancedSearchResult\pt_AdvancedSearchResult.inc.php") PHP: <?php/*pt_AdvancedSearchResult.inc.php 2012-04-08 avengerCopyright (c) 2012 Avenger, entwicklung@powertemplate.deRefactored to PHP class usage in order to extend search sqlOverload class--------------------------------------------------------------*/class pt_AdvancedSearchResult extends pt_AdvancedSearchResult_parent{ function get_search_fields() { $search_fields=parent::get_search_fields(); //Add product item codes fields to search fields $search_fields=' pic.code_isbn, pic.code_upc, pic.code_mpn, pic.code_jan, pic.brand_name,'. $search_fields; return $search_fields; } function get_search_tables() { $from_str=parent::get_search_tables(); //Add product item codes table to search tables $from_str .= " LEFT OUTER JOIN products_item_codes AS pic ON (p.products_id = pic.products_id) "; return $from_str; } function add_user_search_fields($like_keyword) { $where_str=parent::get_user_search_where($like_keyword); //Add product item codes fields to search condition $where_str .= " OR p.products_ean $like_keyword OR pic.code_isbn $like_keyword OR pic.code_upc $like_keyword OR pic.code_mpn $like_keyword OR pic.code_jan $like_keyword OR pic.brand_name $like_keyword "; return $where_str; }}?> Damit werden die Tabelle, die Felder und die zusätzlichen Suchbedingungen für die neuen Informationen in die Such-SQL eingebaut. Und somit wird jetzt auch nach den Suchbegriffen in den neuen Feldern gesucht! Das Modul "advanced_search_result.php" muss natürlich auch noch umgebaut werden, da ja wesentliche Teile jetzt in der neuen Klasse abgearbeitet werden.... PHP: <?php/* --------------------------------------------------------------advanced_search_result.php 2011-09-13 gambioGambio GmbHhttp://www.gambio.deCopyright (c) 2011 Gambio GmbHReleased under the GNU General Public License (Version 2)[http://www.gnu.org/licenses/gpl-2.0.html]Copyright (c) 2012 Avenger, entwicklung@powertemplate.deRefactored to PHP class usage in order to extend search sql--------------------------------------------------------------based on:(c) 2000-2001 The Exchange Project (earlier name of osCommerce)(c) 2002-2003 osCommerce(advanced_search_result_result.php,v 1.68 2003/05/14); www.oscommerce.com(c) 2003 nextcommerce (advanced_search_result_result.php,v 1.17 2003/08/21); www.nextcommerce.org(c) 2005 XT-Commerce - community made shopping http://www.xt-commerce.com ($Id: advanced_search_result_result.php 1141 2005-08-10 11:31:36Z novalis $)Released under the GNU General Public License---------------------------------------------------------------------------------------*/include ('includes/application_top.php');$_GET['keywords'] = htmlspecialchars($_GET['keywords']);$_GET['pfrom'] = htmlspecialchars($_GET['pfrom']);$_GET['pto'] = htmlspecialchars($_GET['pto']);$keywords=$_GET['keywords'];$pfrom=$_GET['pfrom'];$pto=$_GET['pto'];$error = $errorno = $keyerror = 0;if (isset ($keywords) && empty ($keywords)) { $keyerror = 1;}if ((isset ($keywords) && empty ($keywords)) && (isset ($pfrom) && empty ($pfrom)) && (isset ($pto) && empty ($pto))) { $errorno += 1; $error = 1;}elseif (isset ($keywords) && empty ($keywords) && !(isset ($pfrom)) && !(isset ($pto))) { $errorno += 1; $error = 1;}if (strlen($keywords) < 3 && strlen($keywords) > 0 && $error == 0) { $errorno += 1; $error = 1; $keyerror = 1;}if (strlen($pfrom) > 0) { $pfrom_to_check = xtc_db_input($pfrom); if (!settype($pfrom_to_check, "double")) { $errorno += 10000; $error = 1; }}if (strlen($pto) > 0) { $pto_to_check = $pto; if (!settype($pto_to_check, "double")) { $errorno += 100000; $error = 1; }}if (strlen($pfrom) > 0 && !(($errorno & 10000) == 10000) && strlen($pto) > 0 && !(($errorno & 100000) == 100000)) { if ($pfrom_to_check > $pto_to_check) { $errorno += 1000000; $error = 1; }}if (strlen($keywords) > 0) { if (!xtc_parse_search_string(stripslashes($keywords), $search_keywords)) { $errorno += 10000000; $error = 1; $keyerror = 1; }}if ($error == 1 && $keyerror != 1) { xtc_redirect(xtc_href_link(FILENAME_ADVANCED_SEARCH, 'errorno='.$errorno.'&'.xtc_get_all_get_params(array ('x', 'y'))));}else{ $breadcrumb->add(NAVBAR_TITLE1_ADVANCED_SEARCH, xtc_href_link(FILENAME_ADVANCED_SEARCH)); $breadcrumb->add(NAVBAR_TITLE2_ADVANCED_SEARCH, xtc_href_link(FILENAME_ADVANCED_SEARCH_RESULT, 'keywords='.htmlentities($_GET['keywords']). '&search_in_description='.htmlentities($_GET['search_in_description']). '&categories_id='.(int)$_GET['categories_id']. '&inc_subcat='.htmlentities($_GET['inc_subcat']). '&manufacturers_id='.(int)$_GET['manufacturers_id']. '&pfrom='.htmlentities($_GET['pfrom']). '&pto='.htmlentities($_GET['pto']). '&dfrom='.htmlentities($_GET['dfrom']). '&dto='.htmlentities($_GET['dto']))); // create smarty elements $smarty = new Smarty; // include boxes require (DIR_FS_CATALOG.'templates/'.CURRENT_TEMPLATE.'/source/boxes.php'); // include needed functions require_once (DIR_FS_INC.'xtc_parse_search_string.inc.php'); require_once (DIR_FS_INC.'xtc_get_subcategories.inc.php'); require_once (DIR_FS_INC.'xtc_get_currencies_values.inc.php'); require (DIR_WS_INCLUDES.'header.php'); $AdvancedSearchResult=MainFactory::create_object('AdvancedSearchResult'); $listing_sql=$AdvancedSearchResult->create_search_sql(); require (DIR_WS_MODULES.FILENAME_PRODUCT_LISTING); $smarty->assign('main_content', $main_content);}$smarty->assign('language', $_SESSION['language']);$smarty->caching = 0;$smarty->display(CURRENT_TEMPLATE.'/index.html');include ('includes/application_bottom.php');?> Mit dieser Umstrukturierung können jetzt (updatesicher!) beliebig viele Erweiterungen im Suchmodul vorgenommen werden... Die neuen Module sind in dem Archiv im Anhang beigefügt. Anwendung auf eigene Gefahr! Erst in einem Testshop testen! Es gibt keinerlei Gewährleistung!
Vielen Dank für die Mühe. Sobald ich das mache, kommt allerdings folgender Fehler: Code: [B]Parse error[/B]: syntax error, unexpected T_STRING, expecting '{' in [B]/www/htdocs/xxxxxxx/system/core/ClassOverloadRegistry.inc.php(131) : eval()'d code[/B] on line [B]1[/B] [B]Fatal error[/B]: Class 'pt_pic_ProductInfoContentView_parent' not found in [B]/www/htdocs/xxxxxxx/user_classes/overloads/ProductInfoContentView/pt_p ic_ProductInfoContentView.inc.php[/B] on line [B]9[/B] Wir haben "v2.0.8 SP1.2 r5611" ohne Modifikationen. Danke und Grüße FMJ
Anzeige der MPN funktioniert einwandfrei Aber nun kommt das Code: [B]Fatal error[/B]: Call to undefined function xtc_parse_search_string() in [B]/www/htdocs/xxxxxxx/advanced_search_result.php[/B] on line [B]77[/B] wenn man nach etwas sucht. FMJ
Da war noch eine etwas ältere Version im Archiv. Nimm das als "advanced_search_result.php".... PHP: <?php/* --------------------------------------------------------------advanced_search_result.php 2011-09-13 gambioGambio GmbHhttp://www.gambio.deCopyright (c) 2011 Gambio GmbHReleased under the GNU General Public License (Version 2)[http://www.gnu.org/licenses/gpl-2.0.html]Copyright (c) 2012 Avenger, entwicklung@powertemplate.deRefactored to PHP class usage in order to extend search sql--------------------------------------------------------------based on:(c) 2000-2001 The Exchange Project (earlier name of osCommerce)(c) 2002-2003 osCommerce(advanced_search_result_result.php,v 1.68 2003/05/14); www.oscommerce.com(c) 2003 nextcommerce (advanced_search_result_result.php,v 1.17 2003/08/21); www.nextcommerce.org(c) 2005 XT-Commerce - community made shopping http://www.xt-commerce.com ($Id: advanced_search_result_result.php 1141 2005-08-10 11:31:36Z novalis $)Released under the GNU General Public License---------------------------------------------------------------------------------------*/include ('includes/application_top.php');// include needed functionsrequire_once (DIR_FS_INC.'xtc_parse_search_string.inc.php');$_GET['keywords'] = htmlspecialchars($_GET['keywords']);$_GET['pfrom'] = htmlspecialchars($_GET['pfrom']);$_GET['pto'] = htmlspecialchars($_GET['pto']);$keywords=$_GET['keywords'];$pfrom=$_GET['pfrom'];$pto=$_GET['pto'];$error = $errorno = $keyerror = 0;if (isset ($keywords) && empty ($keywords)) { $keyerror = 1;}if ((isset ($keywords) && empty ($keywords)) && (isset ($pfrom) && empty ($pfrom)) && (isset ($pto) && empty ($pto))) { $errorno += 1; $error = 1;}elseif (isset ($keywords) && empty ($keywords) && !(isset ($pfrom)) && !(isset ($pto))) { $errorno += 1; $error = 1;}if (strlen($keywords) < 3 && strlen($keywords) > 0 && $error == 0) { $errorno += 1; $error = 1; $keyerror = 1;}if (strlen($pfrom) > 0) { $pfrom_to_check = xtc_db_input($pfrom); if (!settype($pfrom_to_check, "double")) { $errorno += 10000; $error = 1; }}if (strlen($pto) > 0) { $pto_to_check = $pto; if (!settype($pto_to_check, "double")) { $errorno += 100000; $error = 1; }}if (strlen($pfrom) > 0 && !(($errorno & 10000) == 10000) && strlen($pto) > 0 && !(($errorno & 100000) == 100000)) { if ($pfrom_to_check > $pto_to_check) { $errorno += 1000000; $error = 1; }}if (strlen($keywords) > 0) { if (!xtc_parse_search_string(stripslashes($keywords), $search_keywords)) { $errorno += 10000000; $error = 1; $keyerror = 1; }}if ($error == 1 && $keyerror != 1) { xtc_redirect(xtc_href_link(FILENAME_ADVANCED_SEARCH, 'errorno='.$errorno.'&'.xtc_get_all_get_params(array ('x', 'y'))));}else{ $breadcrumb->add(NAVBAR_TITLE1_ADVANCED_SEARCH, xtc_href_link(FILENAME_ADVANCED_SEARCH)); $breadcrumb->add(NAVBAR_TITLE2_ADVANCED_SEARCH, xtc_href_link(FILENAME_ADVANCED_SEARCH_RESULT, 'keywords='.htmlentities($_GET['keywords']). '&search_in_description='.htmlentities($_GET['search_in_description']). '&categories_id='.(int)$_GET['categories_id']. '&inc_subcat='.htmlentities($_GET['inc_subcat']). '&manufacturers_id='.(int)$_GET['manufacturers_id']. '&pfrom='.htmlentities($_GET['pfrom']). '&pto='.htmlentities($_GET['pto']). '&dfrom='.htmlentities($_GET['dfrom']). '&dto='.htmlentities($_GET['dto']))); // create smarty elements $smarty = new Smarty; // include boxes require (DIR_FS_CATALOG.'templates/'.CURRENT_TEMPLATE.'/source/boxes.php'); require_once (DIR_FS_INC.'xtc_get_subcategories.inc.php'); require_once (DIR_FS_INC.'xtc_get_currencies_values.inc.php'); require (DIR_WS_INCLUDES.'header.php'); $AdvancedSearchResult=MainFactory::create_object('AdvancedSearchResult'); $listing_sql=$AdvancedSearchResult->create_search_sql(); require (DIR_WS_MODULES.FILENAME_PRODUCT_LISTING); $smarty->assign('main_content', $main_content);}$smarty->assign('language', $_SESSION['language']);$smarty->caching = 0;$smarty->display(CURRENT_TEMPLATE.'/index.html');include ('includes/application_bottom.php');?>
Die Standardsuche nach den neuen Elementen haben wir ja jetzt geregelt, aber jetzt haben wir ja noch die "Live-Suche", die noch nichts von den neuen Feldern weiß.... Da wir uns ja schon die neue "AdvancedSearchResult"-Klasse geschaffen haben, liegt es natürlich nahe, diese auch für die "Live-Suche" zu verwenden, da wir so jetzt eine konsistente Suchfunktion haben, und man evtl. Erweiterungen der Suche nur für diese Klasse überladen muss... Folgenden Code als "gm\ajax\live_search.php" kopieren. PHP: <?php/* --------------------------------------------------------------live_search.php 2011-09-13 gmGambio GmbHhttp://www.gambio.deCopyright (c) 2011 Gambio GmbHCopyright (c) 2012 Avenger, entwicklung@powertemplate.deRefactored to use the new "AdvancedSearchResult" class for consistent searching (and most notably: searching extensions)Released under the GNU General Public License (Version 2)[http://www.gnu.org/licenses/gpl-2.0.html]--------------------------------------------------------------based on:(c) 2003 nextcommerce (content_preview.php,v 1.2 2003/08/25); www.nextcommerce.org(c) 2003 XT-Commerce - community made shopping http://www.xt-commerce.com ($Id: popup_content.php 1169 2005-08-22 16:07:09Z mz $)Released under the GNU General Public License---------------------------------------------------------------------------------------*/if(defined('_GM_VALID_CALL') === false) die('x0');$f_needle=$_GET['needle'];if ($f_needle){ include_once(DIR_FS_INC.'xtc_parse_search_string.inc.php'); require_once (DIR_FS_INC.'xtc_get_subcategories.inc.php'); require_once (DIR_FS_INC.'xtc_get_currencies_values.inc.php'); $f_needle = utf8_decode($f_needle); $f_needle = stripslashes($f_needle); $f_needle = mysql_real_escape_string($f_needle); if (!defined('LIVE_SEARCH_RESULTS')) { define('LIVE_SEARCH_RESULTS',10); } $_GET['keywords']=$f_needle; $AdvancedSearchResult=MainFactory::create_object('AdvancedSearchResult'); $sql=$AdvancedSearchResult->create_search_sql().' LIMIT 0,'.LIVE_SEARCH_RESULTS; $module_content = array(); $result = xtc_db_query($sql); while(($row = xtc_db_fetch_array($result) )) { $module_content[] = array( 'PRODUCTS_ID' => $row['products_id'], 'PRODUCTS_URL' => xtc_href_link(FILENAME_PRODUCT_INFO, xtc_product_link($row['products_id'], $row['products_name']) ), 'PRODUCTS_NAME' => $row['products_name'] ); } if (sizeof($module_content) > 0) { $smarty = new Smarty; $smarty->assign('module_content', $module_content); $smarty->assign('language', $_SESSION['language']); $smarty->caching = 0; $smarty->display(CURRENT_TEMPLATE.'/module/gm_live_search.html'); }}?> Das ist leider nicht updatesicher machbar, aber es bleibt die Hoffnung, dass das so seinen Weg in einen nächsten Update findet.... Ich habe alle Module noch mal in dem Archiv angefügt.
Das ist total spitze. Avenger, ich brauche noch ´mal deine Hilfe. Die Daten werden noch nicht in der Druckversion (Datenblatt drucken) mit ausgegeben. Da funktioniert MPN und Co. nicht. Sind dazu große Anpassungen notwendig? Grüße FMJ
Jo, stimmt.... Folgenden Code als "print_product_info.php" speichern: (Leider nicht updatesicher) PHP: <?php/* --------------------------------------------------------------print_product_info.php 2010-08-18 gmGambio GmbHhttp://www.gambio.deCopyright (c) 2010 Gambio GmbHCopyright (c) 2012 Avenger, entwicklung@powertemplate.deInclude product information codesReleased under the GNU General Public License (Version 2)[http://www.gnu.org/licenses/gpl-2.0.html]--------------------------------------------------------------based on:(c) 2000-2001 The Exchange Project (earlier name of osCommerce)(c) 2002-2003 osCommerce(product_info.php,v 1.94 2003/05/04); www.oscommerce.com(c) 2003 nextcommerce (print_product_info.php,v 1.16 2003/08/25); www.nextcommerce.org(c) 2003 XT-Commerce - community made shopping http://www.xt-commerce.com ($Id: print_product_info.php 1282 2005-10-03 19:39:36Z mz $)Released under the GNU General Public License---------------------------------------------------------------------------------------*/include ('includes/application_top.php');// include needed functionsrequire_once (DIR_FS_INC.'xtc_get_products_mo_images.inc.php');require_once (DIR_FS_INC.'xtc_get_vpe_name.inc.php');$smarty = new Smarty;//Avenger$product_info_query =" SELECT * FROM ".TABLE_PRODUCTS." p, ".TABLE_PRODUCTS_DESCRIPTION." pd, products_item_codes pic WHERE p.products_status = '1' AND p.products_id = '".(int) $_GET['products_id']."' AND pd.products_id = p.products_id AND p.products_id = pic.products_id AND pd.language_id = '".(int) $_SESSION['languages_id']."'";//Avenger$product_info_query = xtc_db_query($product_info_query);$product_info = xtc_db_fetch_array($product_info_query);$products_price = $xtPrice->xtcGetPrice($product_info['products_id'], $format = true, 1, $product_info['products_tax_class_id'], $product_info['products_price'], 1);$products_attributes_query = xtc_db_query("select count(*) as total from ".TABLE_PRODUCTS_OPTIONS." popt, ".TABLE_PRODUCTS_ATTRIBUTES." patrib where patrib.products_id='".(int) $_GET['products_id']."' and patrib.options_id = popt.products_options_id and popt.language_id = '".(int) $_SESSION['languages_id']."'");$products_attributes = xtc_db_fetch_array($products_attributes_query);if ($products_attributes['total'] > 0) { $products_options_name_query = xtc_db_query("select distinct popt.products_options_id, popt.products_options_name from ".TABLE_PRODUCTS_OPTIONS." popt, ".TABLE_PRODUCTS_ATTRIBUTES." patrib where patrib.products_id='".(int) $_GET['products_id']."' and patrib.options_id = popt.products_options_id and popt.language_id = '".(int) $_SESSION['languages_id']."' order by popt.products_options_name"); while ($products_options_name = xtc_db_fetch_array($products_options_name_query)) { $selected = 0; // BOF GM_MOD: $products_options_query = xtc_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix,pa.attributes_stock, pa.attributes_model from ".TABLE_PRODUCTS_ATTRIBUTES." pa, ".TABLE_PRODUCTS_OPTIONS_VALUES." pov where pa.products_id = '".(int) $_GET['products_id']."' and pa.options_id = '".$products_options_name['products_options_id']."' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '".(int) $_SESSION['languages_id']."' ORDER BY pa.sortorder"); while ($products_options = xtc_db_fetch_array($products_options_query)) { $module_content[] = array ('GROUP' => $products_options_name['products_options_name'], 'NAME' => $products_options['products_options_values_name']); if ($products_options['options_values_price'] != '0') { if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 1) { $tax_rate = $xtPrice->TAX[$product_info['products_tax_class_id']]; $products_options['options_values_price'] = xtc_add_tax($products_options['options_values_price'], $xtPrice->TAX[$product_info['products_tax_class_id']]); } if ($_SESSION['customers_status']['customers_status_show_price'] == 1) { $module_content[sizeof($module_content) - 1]['NAME'] .= ' ('.$products_options['price_prefix'].$xtPrice->xtcFormat($products_options['options_values_price'], true,0,true).')'; } } } }}// assign language to template for caching$smarty->assign('language', $_SESSION['language']);$image = '';if ($product_info['products_image'] != '') { $image = DIR_WS_CATALOG.DIR_WS_THUMBNAIL_IMAGES.$product_info['products_image'];}if ($_SESSION['customers_status']['customers_status_show_price'] != 0) { $tax_rate = $xtPrice->TAX[$product_info['products_tax_class_id']]; // BOF GM_MOD $tax_info = $main->getTaxInfo($tax_rate); $smarty->assign('PRODUCTS_TAX_INFO', $tax_info); // EOF GM_MOD}//Avenger$smarty->assign('PRODUCTS_ISBN', $product_info['code_isbn']);$smarty->assign('PRODUCTS_UPC', $product_info['code_upc']);$smarty->assign('PRODUCTS_MPN', $product_info['code_mpn']);$smarty->assign('PRODUCTS_JAN', $product_info['code_jan']);$smarty->assign('PRODUCTS_BRAND_NAME', $product_info['brand_name']);//Avenger$smarty->assign('PRODUCTS_NAME', $product_info['products_name']);$smarty->assign('PRODUCTS_EAN', $product_info['products_ean']);$smarty->assign('PRODUCTS_QUANTITY', $product_info['products_quantity']);$smarty->assign('PRODUCTS_WEIGHT', $product_info['products_weight']);$smarty->assign('PRODUCTS_STATUS', $product_info['products_status']);$smarty->assign('PRODUCTS_ORDERED', $product_info['products_ordered']);$smarty->assign('PRODUCTS_MODEL', $product_info['products_model']);// BOF GM_MOD:$smarty->assign('PRODUCTS_DESCRIPTION', preg_replace('!(.*?)\[TAB:(.*?)\](.*?)!is', "$1$3", $product_info['products_description']));$smarty->assign('PRODUCTS_IMAGE', $image);$smarty->assign('PRODUCTS_PRICE', $products_price['formated']);if (ACTIVATE_SHIPPING_STATUS == 'true') { $smarty->assign('SHIPPING_NAME', $main->getShippingStatusName($product_info['products_shippingtime'])); if ($shipping_status['image'] != '') $smarty->assign('SHIPPING_IMAGE', $main->getShippingStatusImage($product_info['products_shippingtime']));}if (SHOW_SHIPPING == 'true') $smarty->assign('PRODUCTS_SHIPPING_LINK', ' '.SHIPPING_EXCL.'<a href="javascript:newWin=void(window.open(\''.xtc_href_link(FILENAME_POPUP_CONTENT, 'coID='.SHIPPING_INFOS).'\', \'popup\', \'toolbar=0, width=640, height=600\'))"> '.SHIPPING_COSTS.'</a>');$discount = 0.00;if ($_SESSION['customers_status']['customers_status_discount'] != '0.00') { // BOF GM_MOD: $discount = $_SESSION['customers_status']['customers_status_discount']; if ($product_info['products_discount_allowed'] < $_SESSION['customers_status']['customers_status_discount']) $discount = $product_info['products_discount_allowed']; if ($discount != '0.00') $smarty->assign('PRODUCTS_DISCOUNT', $discount.'%');}if ($product_info['products_vpe_status'] == 1 && $product_info['products_vpe_value'] != 0.0 && $products_price['plain'] > 0) $smarty->assign('PRODUCTS_VPE', $xtPrice->xtcFormat($products_price['plain'] * (1 / $product_info['products_vpe_value']), true).TXT_PER.xtc_get_vpe_name($product_info['products_vpe']));$smarty->assign('module_content', $module_content);//more images - by Novalis$mo_images = xtc_get_products_mo_images($product_info['products_id']);// BOF GMif (is_array($mo_images)){ foreach ($mo_images as $img) { $gm_products_more_img[] = DIR_WS_CATALOG.DIR_WS_THUMBNAIL_IMAGES.$img['image_name']; }}$smarty->assign('GM_PRODUCTS_MORE_IMG', $gm_products_more_img);// EOF GM// set cache ID if (!CacheCheck()) { $smarty->caching = 0;} else { $smarty->caching = 1; $smarty->cache_lifetime = CACHE_LIFETIME; $smarty->cache_modified_check = CACHE_CHECK;}$cache_id = $_SESSION['language'].'_'.$product_info['products_id'];$smarty->display(CURRENT_TEMPLATE.'/module/print_product_info.html', $cache_id);// BOF GM_MOD:mysql_close();?> Die Feldnamen sind die gleichen wie in der Produkt-Info, die müssen in "templates\EyeCandy\module\print_product_info.html" eingebaut werden.
Zumindest die Template-Datei könnten man updatesicher machen, indem man eine "templates\EyeCandy\module\print_product_info-USERMOD.html" nutzt .
Danke dir vielmals Avenger. Auch danke an Moritz - habe ich gleich so gemacht. Allerdings sollten Avengers Änderungen Beim nächsten Gambio-Update mit dabei sein - mit seinem Einverständnis natürlich. Das funktioniert hervorragend. FMJ
Hi Avenger, wirklich schöne und einleuchtende Lösung. Ich möchte meine individuellen Änderungen ebenfalls updatesicher refactorieren. Momentan habe ich z.B. in der Basisklasse folgende Änderung impflementiert: // $this->set_content_data('PRODUCTS_SHIPPING_LINK',$main->getShippingLink(true)); $this->set_content_data('PRODUCTS_SHIPPING_LINK',$main->getExtendedShippingLink(true)); Wie kann ich dieses Beispiel updatesicher realisieren? Die getShippingLink Methode möchte ich nicht überschreiben, da diese an anderen Stellen unverändert benötigt wird. D.h. im Gegensatz zu deinem Beispiel, möchte ich zuerst die Funktionen der Basisklasse aufrufen und anschließend mittels set_content_data den Eintrag für PRODUCTS_SHIPPING_LINK überschreiben. Ist das möglich oder sollte man das prinzipiell anders designen? Ergänzung: Ich könnte natürlich in der Subklasse eine weitere Variable hinzufügen welche ich im Template anspreche.. $this->set_content_data('PRODUCTS_SHIPPING_LINK_EXT',$main->getExtendedShippingLink(true)); Ist das der richtige weg?
Du kannst das Beispiel 1 zu 1 übernehmen•. Nur den Datei- und Klassennamen ändern, Deine Änderung statt der vorhandenen verwenden,,,, Vermutlich musst Du noch ein "global $main;" einfügen.