Kurze Frage zu RSS Feed

Diskussionen rund um die Templates (incl. Smarty)
Kopernikus
Beiträge: 390
Registriert: Fr 19. Okt 2012, 12:15

Kurze Frage zu RSS Feed

Beitrag von Kopernikus »

Hi zusammen

In meinem alten xtc/Ecombase Shop hatte ich einen RSS Feed welcher jeweils meine Kunden über neue Produkte informierte. Ich habe diesen schon lange vergessen, bzw. war mir gar nicht mehr bewusst, einen solchen gehabt zu haben. Heute hat mir jedoch ein Kunde geschrieben, dass er es schade fände, dass er nicht mehr über diesen Feed über unsere neuen Produkte informieren werde. Tja, da war ich erstmal ratlos. Doch in der way-back-machine habe ich gesehen, dass tatsächlich ein Feed mit dieser Funktionalität installiert war. Auch SEO-Technisch soll ja ein RSS Feed gewisse Vorteile bringen. Dies melden einem jedenfalls die diversen Optimierungs-Tools wenn man die eigene Seite auf Verbesserungen checkt. Da ich mich nicht errinnern kann, jemals ein solches Modul installiert zu haben, war dieses wohl ein fester Bestandteil der damaligen Ecombase Version.

Wie auch immer, ich habe im alten Shop eine entsprechende Datei finden können die in webs nicht enthalten ist. Diese befand sich im Root verzeichnis und hiess products_new_rss.php

Der Inhalt ist folgender:

Code: Alles auswählen

<?php
/* -----------------------------------------------------------------------------------------
   $Id: products_new.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(products_new.php,v 1.25 2003/05/27); www.oscommerce.com
   (c) 2003	 nextcommerce (products_new.php,v 1.16 2003/08/18); 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
   ---------------------------------------------------------------------------------------*/

include ('includes/configure.php');
include ('includes/application_top.php');
$smarty = new Smarty;
echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n";
echo "<rss version=\"2.0\">\n";
echo "<channel>\n";
echo "<title>Mein Shop</title>\n";
echo "<link>" . HTTP_SERVER . DIR_WS_CATALOG . "</link>\n";
echo "<description>Shopbeschreibung</description>\n";
echo "<language>de</language>\n";
echo "<image>\n";
echo "<title>RSS Feeds</title>\n";
echo "<url>" . HTTP_SERVER . "/templates/" .CURRENT_TEMPLATE. "/img/logo.gif</url>\n";
echo "<link>" . HTTP_SERVER . DIR_WS_CATALOG . "</link>\n";
echo "</image>\n";



$products_new_array = array ();
$fsk_lock = '';
if ($_SESSION['customers_status']['customers_fsk18_display'] == '0') {
	$fsk_lock = ' and p.products_fsk18!=1';
}
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."' ";
}
$products_new_query_raw = "select distinct
                                    p.products_id,
                                    p.products_fsk18,
                                    pd.products_name,
                                    pd.products_short_description,
                                    p.products_image,
                                    p.products_price,
                               	    p.products_vpe,
                               	    p.products_vpe_status,
                                    p.products_vpe_value,
                                    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
                                    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."
                                    order
                                    by
                                    p.products_date_added DESC ";

$products_new_split = new splitPageResults($products_new_query_raw, $_GET['page'], MAX_DISPLAY_PRODUCTS_NEW, 'p.products_id');


$module_content = '';
if ($products_new_split->number_of_rows > 0) {
	$products_new_query = xtc_db_query($products_new_split->sql_query);
	while ($products_new = xtc_db_fetch_array($products_new_query)) {
		$products_price = $xtPrice->xtcGetPrice($products_new['products_id'], $format = true, 1, $products_new['products_tax_class_id'], $products_new['products_price'], 1);
		$vpePrice = '';
		if ($products_new['products_vpe_status'] == 1 && $products_new['products_vpe_value'] != 0.0)
			$vpePrice = $xtPrice->xtcFormat($products_price['plain'] * (1 / $products_new['products_vpe_value']), true).TXT_PER.xtc_get_vpe_name($products_new['products_vpe']);
		$buy_now = '';
		if ($_SESSION['customers_status']['customers_fsk18'] == '1') {
			if ($products_new['products_fsk18'] == '0')
				$buy_now = '<a href="'.xtc_href_link(basename($PHP_SELF), xtc_get_all_get_params(array ('action')).'action=buy_now&BUYproducts_id='.$products_new['products_id'], 'NONSSL').'">'.xtc_image_button('button_buy_now.gif', TEXT_BUY.$products_new['products_name'].TEXT_NOW).'</a>';
		} else {
			$buy_now = '<a href="'.xtc_href_link(basename($PHP_SELF), xtc_get_all_get_params(array ('action')).'action=buy_now&BUYproducts_id='.$products_new['products_id'], 'NONSSL').'">'.xtc_image_button('button_buy_now.gif', TEXT_BUY.$products_new['products_name'].TEXT_NOW).'</a>';
		}
		if ($products_new['products_image'] != '') {
			$products_image = DIR_WS_THUMBNAIL_IMAGES.$products_new['products_image'];

		} else {
			$products_image = '';
		}
		if ($_SESSION['customers_status']['customers_status_show_price'] != 0) {
			$tax_rate = $xtPrice->TAX[$products_new['products_tax_class_id']];
			// price incl tax
			if ($tax_rate > 0 && $_SESSION['customers_status']['customers_status_show_price_tax'] != 0) {
				$tax_info = sprintf(TAX_INFO_INCL, $tax_rate.' %');
			}
			// excl tax + tax at checkout
			if ($tax_rate > 0 && $_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) {
				$tax_info = sprintf(TAX_INFO_ADD, $tax_rate.' %');
			}
			// excl tax
			if ($tax_rate > 0 && $_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 0) {
				$tax_info = sprintf(TAX_INFO_EXCL, $tax_rate.' %');
			}
		}
		$ship_info="";
		if (SHOW_SHIPPING=='true') {
		$ship_info=' '.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>';
		}
		$module_content[] = array ('PRODUCTS_NAME' => $products_new['products_name'],'PRODUCTS_SHIPPING_LINK' => $ship_info,'PRODUCTS_TAX_INFO' => $tax_info, 'PRODUCTS_DESCRIPTION' => $products_new['products_short_description'], 'PRODUCTS_PRICE' => $products_price['formated'], 'PRODUCTS_VPE' => $vpePrice, 'PRODUCTS_LINK' => xtc_href_link(FILENAME_PRODUCT_INFO, xtc_product_link($products_new['products_id'], $products_new['products_name'])), 'PRODUCTS_IMAGE' => $products_image, 'BUTTON_BUY_NOW' => $buy_now);





echo "<item>\n";
echo "<title>";

            // remove trash
			$products_new['products_name'] = str_replace("ö","oe",$products_new['products_name']);
            $products_new['products_name'] = str_replace("Ö","Oe",$products_new['products_name']);
            $products_new['products_name'] = str_replace("Ü","Ue",$products_new['products_name']);
            $products_new['products_name'] = str_replace("ü","ue",$products_new['products_name']);
            $products_new['products_name'] = str_replace("Ä","Ae",$products_new['products_name']);
            $products_new['products_name'] = str_replace("ä","ae",$products_new['products_name']);
            $products_new['products_name'] = str_replace("ß","ss",$products_new['products_name']);
            $products_new['products_name'] = str_replace(";","",$products_new['products_name']);

echo $products_new['products_name'];


echo "</title>\n";
echo "<link>";
echo HTTP_SERVER . DIR_WS_CATALOG . 'product_info.php?'.xtc_product_link($products_new['products_id'], $products_new['products_name']);
echo "</link>\n";

echo "<description>";

            // remove trash
            $products_new['products_short_description'] = str_replace("&nbsp;"," ",$products_new['products_short_description']);
            $products_new['products_short_description'] = str_replace("&ouml;","oe",$products_new['products_short_description']);
            $products_new['products_short_description'] = str_replace("&Ouml;","Oe",$products_new['products_short_description']);
            $products_new['products_short_description'] = str_replace("&Uuml;","Ue",$products_new['products_short_description']);
            $products_new['products_short_description'] = str_replace("&uuml;","ue",$products_new['products_short_description']);
            $products_new['products_short_description'] = str_replace("&Auml;","Ae",$products_new['products_short_description']);
            $products_new['products_short_description'] = str_replace("&auml;","ae",$products_new['products_short_description']);
            $products_new['products_short_description'] = str_replace("&szlig;","ss",$products_new['products_short_description']);

            $products_new['products_short_description'] = str_replace("'",", ",$products_new['products_short_description']);
			$products_new['products_short_description'] = str_replace("\n"," ",$products_new['products_short_description']);
			$products_new['products_short_description'] = str_replace("\r"," ",$products_new['products_short_description']);
			$products_new['products_short_description'] = str_replace("\t"," ",$products_new['products_short_description']);
			$products_new['products_short_description'] = str_replace("\v"," ",$products_new['products_short_description']);
			$products_new['products_short_description'] = str_replace("&quot,"," \"",$products_new['products_short_description']);
			$products_new['products_short_description'] = str_replace("&qout,"," \"",$products_new['products_short_description']);
            $products_new['products_short_description'] = str_replace(chr(13)," ",$products_new['products_short_description']);

            $products_new['products_short_description'] = str_replace("ö","oe",$products_new['products_short_description']);
            $products_new['products_short_description'] = str_replace("Ö","Oe",$products_new['products_short_description']);
            $products_new['products_short_description'] = str_replace("Ü","Ue",$products_new['products_short_description']);
            $products_new['products_short_description'] = str_replace("ü","ue",$products_new['products_short_description']);
            $products_new['products_short_description'] = str_replace("Ä","Ae",$products_new['products_short_description']);
            $products_new['products_short_description'] = str_replace("ä","ae",$products_new['products_short_description']);
            $products_new['products_short_description'] = str_replace("ß","ss",$products_new['products_short_description']);
			$products_new['products_short_description'] = str_replace("<strong>"," ",$products_new['products_short_description']);
			$products_new['products_short_description'] = str_replace("</strong>"," ",$products_new['products_short_description']);


echo $products_new['products_short_description'];


echo "</description>\n";


echo "</item>\n";


	}
} else {


}
echo "</channel>\n";
echo "</rss>\n";

?>
Und das ganze wurde über die /includes/header.php wie folgt aufgerufen:

Code: Alles auswählen

<link rel="alternate" type="application/rss+xml" title="Neue Produkte im Shop " href="http://www.mein-shop.com/products_new_rss.php" />
Ich habe die Datei nun ebenfalls in mein Root Verzeichnis gelegt und mal testweise in der root/templates/_core/index.tpl die oben erwähnte Zeile eingetragen. Ich weiss nicht ob dies der richtige Weg ist oder ob ich diese Zeile besser in die ausgelagerte \includes\classes\smarty_plugins\function.header.php schreiben muss. Funktioniert hat es bis jetzt leider noch nicht. Vielleicht habt Ihr mir den entsprechenden Tipp wie ich diesen Feed wieder zum Laufen bekomme?
Xantiva
Beiträge: 948
Registriert: Mo 10. Mai 2010, 16:26
Shop Version: 1.0.10 [dev]
Kontaktdaten:

Re: Kurze Frage zu RSS Feed

Beitrag von Xantiva »

Du muss den Eintrag in Deiner /templates/DeinTemplate/index.html vornehmen ...
(Die template/_core/index.tpl wird im Admin verwendet.)
Mein Shop: http://www.basteln-selbermachen.de
Kopernikus
Beiträge: 390
Registriert: Fr 19. Okt 2012, 12:15

Re: Kurze Frage zu RSS Feed

Beitrag von Kopernikus »

Hallo Mike

Genau das habe ich gestern Abend auch noch festgestellt. Leider scheint jedoch das Script mit der webs nicht mehr zu funktionieren. Im Browser erscheint zwar das RSS Symbol, doch beim Klick passiert nichts mehr. :(
Xantiva
Beiträge: 948
Registriert: Mo 10. Mai 2010, 16:26
Shop Version: 1.0.10 [dev]
Kontaktdaten:

Re: Kurze Frage zu RSS Feed

Beitrag von Xantiva »

Du solltest erst noch mal genau den Einbau testen ...

Code: Alles auswählen

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<link rel="alternate" type="application/rss+xml" title="Neue Produkte im Shop " href="templates/webs/products_new_rss.php" />
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de" dir="ltr"><head>
1. an der falschen Stelle: Zwischen DOCTYPE und HTML Element
2. liegt der Feed nicht im Template
Mein Shop: http://www.basteln-selbermachen.de
Kopernikus
Beiträge: 390
Registriert: Fr 19. Okt 2012, 12:15

Re: Kurze Frage zu RSS Feed

Beitrag von Kopernikus »

Hi Mike

Nochmals eine kurze Frage betreffend dieses Feeds. Leider funktioniert dieser nachwievor nicht wie er sollte. Ein Klick auf den Feed bewirkt nur ein kurzes Laden im Browser und dann ist Schluss. Ich habe das ganze nun wie von Dir empfohlen in die index.html eingebaut und die products_new_rss.php unter templates/webs/products_new_rss.php abgelegt. Könnte es sein, dass dieser Feed aufgrund einer Strukturänderung nicht mehr funktioniert? Vielleicht fällt Dir am File etwas auf was nicht mehr passt. Ich erwarte natürlich nicht, dass Du dieses einfach mal so kurz anpasst. Aber sollte Dir gerade was auffallen, was sich komplett geändert hat, könnte ich meine Einbauversuche Ad acta legen.

Ein Feed wäre aber wie erwähnt nur schon wegen Google eine wertvolle Erweiterung. ;)

Grüsse
Patrik
Xantiva
Beiträge: 948
Registriert: Mo 10. Mai 2010, 16:26
Shop Version: 1.0.10 [dev]
Kontaktdaten:

Re: Kurze Frage zu RSS Feed

Beitrag von Xantiva »

:o

Wieso verschiebst Du die Datei??? Warum korrigierst Du nicht einfach die falsche URL?
Dann finde ich auf Deiner Seite aktuell auch keinen "RSS" - Link imQuellcode ...

Ciao,
Mike
Mein Shop: http://www.basteln-selbermachen.de
Kopernikus
Beiträge: 390
Registriert: Fr 19. Okt 2012, 12:15

Re: Kurze Frage zu RSS Feed

Beitrag von Kopernikus »

Oh, da habe ich Dich wohl falsch verstanden.
2. liegt der Feed nicht im Template
Und zusätzlich hat mich der von Dir angegebene Pfad etwas irritiert. Was hast Du damit den gemeint?

Code: Alles auswählen

<link rel="alternate" type="application/rss+xml" title="Neue Produkte im Shop " href="templates/webs/products_new_rss.php" />
Zuletzt geändert von Kopernikus am Di 11. Jun 2013, 22:53, insgesamt 1-mal geändert.
Kopernikus
Beiträge: 390
Registriert: Fr 19. Okt 2012, 12:15

Re: Kurze Frage zu RSS Feed

Beitrag von Kopernikus »

ok, nun ist die Datei wieder im root Verzeichnis und in die Index.html habe ich nun folgenden Verweis angebracht:

Code: Alles auswählen

{header}
{body_classes}
{config_load file="$language/lang_$language.conf" section="index"}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<link rel="alternate" type="application/rss+xml" title="Neue Produkte im Shop " href="products_new_rss.php" />
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de" dir="ltr"><head>
<title>{$META.title|escape:"html"}</title>
{foreach from=$META.http_equiv item=m key=k}
Leider funktioniert es damit nach wie vor nicht. Was mache ich falsch :?
Kopernikus
Beiträge: 390
Registriert: Fr 19. Okt 2012, 12:15

Re: Kurze Frage zu RSS Feed

Beitrag von Kopernikus »

Immerhin gibt's jetzt eine Fehlermeldung :?

Code: Alles auswählen

Fatal error: Class 'Smarty' not found in /home/httpd/vhosts/engelis-naturshop.ch/httpdocs/products_new_rss.php on line 25
EDIT:

Ach so

Code: Alles auswählen

$smarty = new Smarty;
muss einfach durch:

Code: Alles auswählen

$smarty = new template();
ersetzt werden und schon klappts :D
Kopernikus
Beiträge: 390
Registriert: Fr 19. Okt 2012, 12:15

Re: Kurze Frage zu RSS Feed

Beitrag von Kopernikus »

Allerdings sagt mir SEOquake Diagnosis, dass da nach wie vor kein Feed zu finden ist.

Bild

Ich würde dieser Aussage ja nicht so eine grosse Bedeutung zuschreiben, wenn da früher nicht mit dem selben Feed ein Häckchen gewesen wäre. Fehlt da möglicherweise noch etwas?
Antworten