Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Syndicate X-Cart news as RSS 2.0 Channel

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #11  
Old 11-23-2007, 07:16 AM
 
Acquamarina Acquamarina is offline
 

X-Adept
  
Join Date: Aug 2006
Location: USA
Posts: 811
 

Default Re: Syndicate X-Cart news as RSS 2.0 Channel

Hi,

We found out the problem is actually related to the server. We are unable to rewrite files created by x-cart or any php as the mod_security blocks the access.

We might be looking for a new host and I'll post the developments. We just moved to LiquidWeb shared servers and although they are excellent (really) the shared servers are not really compatible with all of the x-cart features.

Thank you very much, I'll change the formatting on the feed for future use.
__________________
Vera B
4.4.5
CFLSystems.com mods, Kosmos eBay Integration, Feed Manager Pro, custom mods, BCSEngineering Mods, CDSEO PRO
Hosting by EWDHosting - The best home for your x-cart.
Reply With Quote
  #12  
Old 11-29-2007, 03:02 PM
 
Acquamarina Acquamarina is offline
 

X-Adept
  
Join Date: Aug 2006
Location: USA
Posts: 811
 

Default Re: Syndicate X-Cart news as RSS 2.0 Channel

Hi,

It is working now but there are 2 feeds, one for the news and one for newest products. Is there anyway to create a drop down list so visitors can choose which feed they would like to subscribe to?

Thank you all very much for the help!
__________________
Vera B
4.4.5
CFLSystems.com mods, Kosmos eBay Integration, Feed Manager Pro, custom mods, BCSEngineering Mods, CDSEO PRO
Hosting by EWDHosting - The best home for your x-cart.
Reply With Quote
  #13  
Old 02-26-2008, 06:37 PM
  clik's Avatar 
clik clik is offline
 

Advanced Member
  
Join Date: Mar 2006
Location: Canada
Posts: 30
 

Wink Re: Syndicate X-Cart news as RSS 2.0 Channel

Quote:
Originally Posted by zaa
TheAs for the RSS extension, if you are hosted on a server with Apache web server you may add a rewrite rule that will transparently rewrite feed.xml with feed.php
http://httpd.apache.org/docs/2.0/misc/rewriteguide.html
Thank you!
I appreciate your help. I'm not a specialist and I was able to follow your instructions and I did it!
but... the Auto-refresh thing... I got stuck. If you would be so nice and if you have time, could you please write the rewrite rules lines?
Thank you!
__________________
__________________
XC5: 5.3.4.4
PHP: 7.0.26
MySQL server: 5.5.56-MariaDB
Reply With Quote
  #14  
Old 03-05-2008, 06:51 PM
  clik's Avatar 
clik clik is offline
 

Advanced Member
  
Join Date: Mar 2006
Location: Canada
Posts: 30
 

Default Re: Syndicate X-Cart news as RSS 2.0 Channel

zaa, many thanks for your code!!!

it works and the page refreshes fine:
http://clikinternational.com/store/news_feed.php

I noticed on some website RSS subscribers counter. Is it possible to implement with your code?
__________________
__________________
XC5: 5.3.4.4
PHP: 7.0.26
MySQL server: 5.5.56-MariaDB
Reply With Quote
  #15  
Old 03-06-2008, 10:07 PM
 
zaa zaa is offline
 

X-Cart team
  
Join Date: Apr 2004
Location: Ulyanovsk, Russia
Posts: 125
 

Default Re: Syndicate X-Cart news as RSS 2.0 Channel

Quote:
Originally Posted by clik
zaa, many thanks for your code!!!

it works and the page refreshes fine:
http://clikinternational.com/store/news_feed.php

I noticed on some website RSS subscribers counter. Is it possible to implement with your code?

As far as I know such counter is provided by FeedBurner.
http://www.feedburner.com/fb/a/home
Reply With Quote
  #16  
Old 05-11-2008, 08:05 AM
  Yulia's Avatar 
Yulia Yulia is offline
 

Newbie
  
Join Date: Apr 2008
Location: Moscow/Москва
Posts: 9
 

Default Re: Syndicate X-Cart news as RSS 2.0 Channel

I did as it was written. I have rss icon, but there is nothing in the feed (as for Pilnik and alinush). I added two products, but I don't see them in my frontpage (News and bestsellers).
What should I do:
1) to see my products on the first page (in News and bestsellers);
2) to see them in my rss feed.
Thank you.
__________________
Yulia
I run X-cart 4.1.9 pro (Operating system Linux, Apache version 1.3.41 Unix, PHP version 5.2.5, MySQL version 5.0.45-community)
Reply With Quote
  #17  
Old 07-16-2008, 04:45 PM
 
justy justy is offline
 

Advanced Member
  
Join Date: Feb 2008
Posts: 39
 

Default Re: Syndicate X-Cart news as RSS 2.0 Channel

I too am getting a blank feed, even though I followed all instructions re: the new version.

Have there been any updates?
__________________
---
x-cart 4.1.9
XC SEO 1.4

x-cart 4.2
Reply With Quote
  #18  
Old 07-17-2008, 02:12 AM
 
zaa zaa is offline
 

X-Cart team
  
Join Date: Apr 2004
Location: Ulyanovsk, Russia
Posts: 125
 

Default Re: Syndicate X-Cart news as RSS 2.0 Channel

Here is the latest version of the script (tested with X-Cart 4.1.10).

PHP Code:
<?php
/*
 * news_feed.php.
 * 2008-07-17. Zhuravlev Alexander (zaa@qualiteam.biz).
 * License: MIT (http://www.opensource.org/licenses/mit-license.php)
 * 
 * Syndicate X-Cart news as RSS 2.0 Channel
 * Script supports HTTP conditional GET
 * http://fishbowl.pastiche.org/2002/10/21/http_conditional_get_for_rss_hackers
 * 
 * Note: News should be added at News Management page of x-cart
 * administration area. Corresponding news list and messages in it should have option "Show as news" being enabled.
 * 
 */

@include_once "./top.inc.php";
if (!
defined('DIR_CUSTOMER')) die("ERROR: Can not initiate application! Please check configuration.");

define('XCART_SESSION_START'1); # We do not need any sessions
if (@file_exists($xcart_dir."/init.php")) {
    require 
$xcart_dir."/init.php";
} else {
    require 
$xcart_dir."/config.php";
}

# *Required* RSS channel properties. [[[
$rss_channel = array();

# The name of the channel. It's how people refer to your service.
$rss_channel['title'] = $config['Company']['company_name'] . " News Headlines";

# The URL to the HTML website corresponding to the channel.
$rss_channel['link'] = $http_location;

# Phrase or sentence describing the channel
$rss_channel['description'] = "The latest news from " $config['Company']['company_name'];
    
# The language the channel is written in. 
# http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
$rss_channel['language'] = "en";
    
# By default we assume that text is provided in UTF-8 enconding.
# You may change this according to your needs. 
$rss_channel['encoding'] = 'UTF-8';
# ]]]

define('RSS20_DATE_FORMAT',  "D, d M Y H:i:s O");
   
# Fetch messages info 
if ($active_modules['News_Management']) {
    
$messages_info func_query_first("SELECT COUNT(*) as msg_count, MAX(date) AS last_date FROM $sql_tbl[newslists] AS nl LEFT JOIN $sql_tbl[newsletter] AS n ON n.listid = nl.listid WHERE nl.avail='Y' AND nl.show_as_news='Y' AND n.show_as_news = 'Y' ORDER BY n.date DESC");
}

if (!empty(
$messages_info) && $messages_info['last_date']) {
    
$last_mod_time date(RSS20_DATE_FORMAT$messages_info['last_date']);
    
$news_page_url $http_location.DIR_CUSTOMER."/news.php";
    
$messages func_query("SELECT n.newsid, n.subject, n.body, n.date FROM $sql_tbl[newslists] AS nl LEFT JOIN $sql_tbl[newsletter] AS n ON n.listid = nl.listid WHERE nl.avail='Y' AND nl.show_as_news='Y' and n.show_as_news = 'Y' ORDER BY n.date DESC");
    
$items_code "";
    foreach (
$messages as $m) {
            
$pubDate date(RSS20_DATE_FORMAT$m['date']);
            
$m['title'] = htmlspecialchars($m['subject']);
            
$items_code .= <<<EX
        <item> 
            <title>
{$m['subject']}</title>
            <description><![CDATA[
{$m['body']}]]></description>
            <link>
$news_page_url</link>
            <guid isPermaLink="false">
{$m['newsid']}@$news_page_url</guid>
            <pubDate>
$pubDate</pubDate>
        </item>

EX;
    }
} else {
    
$last_mod_time date(RSS20_DATE_FORMATtime());
}

# Channel header
$rss_channel['title'] = htmlspecialchars($rss_channel['title']);
$rss_channel['description'] = htmlspecialchars($rss_channel['description']);
$channel = <<<EX
<?xml version="1.0" encoding="{$rss_channel['encoding']}"?>
<rss version="2.0">
    <channel>
        <title>
{$rss_channel['title']}</title>
        <link>
{$rss_channel['link']}</link>
        <description>
{$rss_channel['description']}</description>
        <language>
{$rss_channel['language']}</language>
        <generator>X-Cart</generator>
        <pubDate>
$last_mod_time</pubDate>
        <lastBuildDate>
$last_mod_time</lastBuildDate>

EX;

if (!empty(
$items_code)) {
        
$channel .= $items_code;
        unset(
$items_code);
}

$channel .= <<<EX
    </channel>
</rss>

EX;

$channel_etag '"'.md5($channel).'"';

# Conditional GET logic [[[
# Check if the channel contents should be passed to client.
# We analyze HTTP response headers: If-Modified-Since, If-None-Match

$IMS_FLAG 0;
if (!empty(
$HTTP_SERVER_VARS['HTTP_IF_MODIFIED_SINCE'])) {
        if (
strtotime($HTTP_SERVER_VARS['HTTP_IF_MODIFIED_SINCE'])  == strtotime($last_mod_time)) {
              
$IMS_FLAG 1;
        }
}

$INM_FLAG 0;
if (!empty(
$HTTP_SERVER_VARS['HTTP_IF_NONE_MATCH'])) {
        if (
$HTTP_SERVER_VARS['HTTP_IF_NONE_MATCH']  == $channel_etag) {
              
$INM_FLAG 1;
        }
}

$pass_channel_to_client = !($IMS_FLAG || $INM_FLAG);
# ]]]

if (!$pass_channel_to_client) {
    
header("HTTP/1.0 304 Not Modified");
    
header('ETag: ' $channel_etag);
} else {
    
# Output headers [[[
    
header("Content-Type: application/xml; charset=".$rss_channel['encoding']);
    
header("Content-length: " strlen($channel));
    
header("Last-Modified: " $last_mod_time);
    
header('ETag: ' $channel_etag);
    
# ]]]

    
echo $channel;
}

# vim600: set et sw=4 sts=4 ts=4 fdm=marker fmr=[[[,]]]:
?>


Note: The script is intended for displaying of news. If you would like to create a feed with the latest store products, etc then you need to adjust it according to your needs.

Best regards,
Reply With Quote
  #19  
Old 07-17-2008, 07:05 AM
 
justy justy is offline
 

Advanced Member
  
Join Date: Feb 2008
Posts: 39
 

Default Re: Syndicate X-Cart news as RSS 2.0 Channel

Thanks, zaa. I've uploaded the new version, but it still doesn't work. I'm still using x-cart 4.1.9, though, so maybe it's my using the old version?
__________________
---
x-cart 4.1.9
XC SEO 1.4

x-cart 4.2
Reply With Quote
  #20  
Old 07-17-2008, 08:52 AM
 
zaa zaa is offline
 

X-Cart team
  
Join Date: Apr 2004
Location: Ulyanovsk, Russia
Posts: 125
 

Default Re: Syndicate X-Cart news as RSS 2.0 Channel

Quote:
Originally Posted by justy
Thanks, zaa. I've uploaded the new version, but it still doesn't work. I'm still using x-cart 4.1.9, though, so maybe it's my using the old version?

Do you see any errors?
First of all, make sure that your created a news list (with Show messages in site news option being enabled) and added a message (with show as news option being enabled).

Generally, if you added some news entries and you can successfully see them at http://www.example.com/news.php, you should be able to see them in a RSS feed generated with help of the http://www.example.com/news_feed.php file.
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 12:12 PM.

   

 
X-Cart forums © 2001-2020