Guten Abend! Da unser Shop über ein ERP-System bestückt wird, benötige ich die PRODUCTS_SHORT_DESCRIPTION auch in der Detailansicht. Hierfür habe ich in der templates/EyeCandy/module/product_info/standard.html den Marker $PRODUCTS_SHORT_DESCRIPTION ({if $PRODUCTS_SHORT_DESCRIPTION !=''}<i>{$PRODUCTS_SHORT_DESCRIPTION}</i>{/if}) hinzugefügt und die Datei in standard-USERMOD.html umbenannt. Das der Marker gefüllt wurde musste ich in der system/classes/products/ProductInfoContentView.inc.php folgende Zeile PHP: $this->set_content_data('PRODUCTS_SHORT_DESCRIPTION', $p_coo_product->data['products_short_description']); hinzufügen. Es wird nun auch richtig angezeigt, aber wie bekomme ich den View Updatesicher? Als Usermod kann ich ihn nicht umbenennen. Lieben Dank!
Schau mal hier hinein, (Link nur für registrierte Nutzer sichtbar.) da gibt es 4 Anleitung für updatesicher Änderungen. Das müsste was mit Klassen-Überladung oder so sein.
Hallo ccxx, um diese Änderung updatesicher zu machen, musst du einen so genannten Overload erstellen. Hierfür legst du in deinem Shopsystem unter dem Pfad /dein_shop/system/overloads/ einen Ordner mit dem Namen der zu überlandenden Klasse an, in deinem Fall "ProductInfoContentView". In diesem Ordner legst du dann eine Datei an, am besten mit einem Namen wie "NameDesErpProductInfoContentView.inc.php", damit man später weiß, wofür dieser Overload gemacht worden ist. In der Datei erstellst du dann wie folgt eine Klasse: PHP: class NameDesErpProductInfoContentView extends NameDesErpProductInfoContentView_parent{ //ich gehe mal davon aus, dass das $this->set_content_data() von dir in der prepare_data()-Methode passiert public function prepare_data() { $this->set_content_data('PRODUCTS_SHORT_DESCRIPTION', $p_coo_product->data['products_short_description']); parent::prepare_data(); }} Das speicherst du dann ab und das sollte es dann gewesen sein, nachdem du im Admin-Bereich einmal den Modul-Cache gelöscht hast. LG Torben
Hallo, besser noch user_classes/overloads statt system/overloads. Das system-Verzeichnis ist unser Revier.
Danke! Habe nun die Änderung an dem orginären File rückgängig gemacht, somit war die Kurzbeschreibung natürlich wieder leer im Template -> OK Nun habe ich unter user_classes/overloads/ProductInfoContentView die Datei Sage_ProductInfoContentView.inc.php mit folgendem Inhalt erstellt PHP: <?php/* -------------------------------------------------------------- main.php 2008-08-07 gambio Gambio OHG http://www.gambio.de Copyright (c) 2008 Gambio OHG Released 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(Coding Standards); www.oscommerce.com (c) 2005 XT-Commerce - community made shopping http://www.xt-commerce.com ($Id: main.php 1286 2005-10-07 10:10:18Z mz $) Released under the GNU General Public License ---------------------------------------------------------------------------------------*/class Sage_ProductInfoContentView extends Sage_ProductInfoContentView_parent{ public function prepare_data() { $this->set_content_data('PRODUCTS_SHORT_DESCRIPTION', $p_coo_product->data['products_short_description']); parent::prepare_data(); }} ?> jedoch wird leider nichts angezeigt, auch nach dem leeren aller Caches. Was habe ich falsch gemacht? Vielen Dank!
Die Variable "$p_coo_product" ist in dieser Funktion nicht definiert.... PHP: public function prepare_data() { $this->set_content_data('PRODUCTS_SHORT_DESCRIPTION', $p_coo_product->data['products_short_description']); parent::prepare_data(); } (Da scheint mir das "prepare_data()"-Konzept nicht ausgereift, da ich (im Beispiel) keinen Zugriff auf die Artikeldaten habe.) Versuche es mal damit: PHP: <?phpclass Sage_ProductInfoContentView extends Sage_ProductInfoContentView_parent{ var $p_coo_product; function get_html($p_coo_product, $p_current_category_id = 0) { //Save products data on class level $this->p_coo_product=$p_coo_product; parent::get_html($p_coo_product, $p_current_category_id); } public function prepare_data() { $this->set_content_data('PRODUCTS_SHORT_DESCRIPTION', $this->p_coo_product->data['products_short_description']); parent::prepare_data(); }}
hmm ;-) Dann (wenn ich das letzte Skript verwende) bekomm ich folgende Fehlermeldung: USER ERROR(256): "check_data_type validation failed. Dump: , string expected, but NULL detected" Was stimmt da nicht? LG
Guten Morgen! Irgendwie scheint der View nicht so wirklich updatesicher zu sein, oder noch zu passen. Nach dem Update von 2.2.0.0 auf 2.3.2.0 erhalte ich folgende Meldung: WARNING(2): "Missing argument 1 for Sage_ProductInfoContentView::get_html(), called in /shop/product_info.php on line 83 and defined" Der View schaut wie folgt aus: PHP: <?phpclass Sage_ProductInfoContentView extends Sage_ProductInfoContentView_parent { function get_html($p_coo_product, $p_current_category_id = 0) {$this->set_content_data('PRODUCTS_SHORT_DESCRIPTION', $p_coo_product->data['products_short_description']); return parent::get_html($p_coo_product, $p_current_category_id); }}?> Der Verweis bzw. die Meldung resultiert aus Zeile 83 der product_info.php: $t_main_content = $coo_product_info_view->get_html(); PHP: <?php/* -------------------------------------------------------------- product_info.php 2015-06-17 gm Gambio GmbH http://www.gambio.de Copyright (c) 2014 Gambio GmbH Released 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 (product_info.php,v 1.46 2003/08/25); www.nextcommerce.org (c) 2003 XT-Commerce - community made shopping http://www.xt-commerce.com ($Id: product_info.php 1320 2005-10-25 14:21:11Z matthias $) Released under the GNU General Public License ----------------------------------------------------------------------------------------- Third Party contribution: Customers Status v3.x (c) 2002-2003 Copyright Elari elari@free.fr | www.unlockgsm.com/dload-osc/ | CVS : http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/elari/?sortby=date#dirlist New Attribute Manager v4b Autor: Mike G | mp3man@internetwork.net | http://downloads.ephing.com Cross-Sell (X-Sell) Admin 1 Autor: Joshua Dechant (dreamscape) Released under the GNU General Public License --------------------------------------------------------------------------------------- */require_once('includes/application_top.php');if($_GET['action'] == 'get_download'){ xtc_get_download($_GET['cID']);}if($_GET['products_id']){ $cat = xtc_db_query("SELECT categories_id FROM " . TABLE_PRODUCTS_TO_CATEGORIES . " WHERE products_id = '" . (int)$_GET['products_id'] . "'"); $catData = xtc_db_fetch_array($cat); require_once(DIR_FS_INC . 'xtc_get_path.inc.php'); if($catData['categories_id']) { $cPath = xtc_input_validation(xtc_get_path($catData['categories_id']), 'cPath', ''); }}/* @var ProductInfoContentView $coo_product_info_view */$coo_product_info_view = MainFactory::create_object('ProductInfoContentView', array($product->data['product_template']));$coo_product_info_view->setGetArray($_GET);$coo_product_info_view->setPostArray($_POST);$coo_product_info_view->setProduct($product);$coo_product_info_view->setCurrentCategoryId($current_category_id);// new xtcPrice-object needed - do not use global $xtPrice$coo_product_info_view->setXtcPrice(new xtcPrice($_SESSION['currency'], $_SESSION['customers_status']['customers_status_id']));$coo_product_info_view->setMain(new main());$coo_product_info_view->setLanguageId($_SESSION['languages_id']);$t_combi_id = 0;if(isset($_GET['combi_id']) && (int)$_GET['combi_id'] > 0){ $t_combi_id = (int)$_GET['combi_id'];}elseif(isset($_GET['info'])){ $t_explode_array = explode('x', $_GET['info']); if(isset($t_explode_array[1])) { $t_combi_id = (int)$t_explode_array[1]; }}$coo_product_info_view->setCombiId($t_combi_id);$coo_product_info_view->setCurrency($_SESSION['currency']);$coo_product_info_view->setCustomerStatusId($_SESSION['customers_status']['customers_status_id']);$coo_product_info_view->setLastListingSql($_SESSION['last_listing_sql']);$coo_product_info_view->setLanguage($_SESSION['language']);$coo_product_info_view->setCustomerDiscount($_SESSION['customers_status']['customers_status_discount']);$coo_product_info_view->setShowGraduatedPrices($_SESSION['customers_status']['customers_status_graduated_prices'] == 1);$coo_product_info_view->setFSK18PurchaseAllowed($_SESSION['customers_status']['customers_fsk18'] != 1); // '1' => purchase forbidden$coo_product_info_view->setFSK18DisplayAllowed($_SESSION['customers_status']['customers_fsk18_display'] == 1); // '1' => display allowed$coo_product_info_view->setShowPrice($_SESSION['customers_status']['customers_status_show_price'] == 1);$t_main_content = $coo_product_info_view->get_html();$coo_layout_control = MainFactory::create_object('LayoutContentControl');$coo_layout_control->set_data('GET', $_GET);$coo_layout_control->set_data('POST', $_POST);$coo_layout_control->set_('coo_breadcrumb', $GLOBALS['breadcrumb']);$coo_layout_control->set_('coo_product', $GLOBALS['product']);$coo_layout_control->set_('coo_xtc_price', $GLOBALS['xtPrice']);$coo_layout_control->set_('c_path', $GLOBALS['cPath']);$coo_layout_control->set_('main_content', $t_main_content);$coo_layout_control->set_('request_type', $GLOBALS['request_type']);$coo_layout_control->proceed();$t_redirect_url = $coo_layout_control->get_redirect_url();if(empty($t_redirect_url) === false){ xtc_redirect($t_redirect_url);}else{ echo $coo_layout_control->get_response();} Jemand eine Idee, oder einen Tipp? LG und Danke!
Ungetestet: PHP: <?phpclass Sage_ProductInfoContentView extends Sage_ProductInfoContentView_parent{ public function prepare_data() { parent::prepare_data(); if($this->product instanceof product && $this->product->isProduct()) { $this->set_content_data('PRODUCTS_SHORT_DESCRIPTION', $this->product->data['products_short_description']); } }}
Vielen Dank! Funktioniert. Dann hab ich jetzt nur noch ein Thema und zwar wird in der Listansicht der Button "in den Warenkorb" angezeigt und in der Detailansicht nicht. Dachte das hängt damit irgendwie zusammen, aber scheinbar nicht. Hier auch noch eine Idee? So schaut es aus (da scheint irgendein Block zu fehlen) / in der Listansicht gibt es die Buttons!: LG und THX