<?php
function cleanXML($str)
{
$str = htmlentities(stripslashes(strip_tags($str)));
$str = str_replace(array("&","<",">","\"", "'", "-"), array("&amp;", "&lt;", "&gt;", "&quot;", "&apos;", "&#45;"), $str);
return $str;
}
//
header("Content-Type:text/xml");
include('../../class/mysql.php');
include('../../class/site.php');
include('../../functions.php');
$host = str_replace("www.", "", $_SERVER['SERVER_NAME']);
$host = ($host == 'demo.freesites.com.au') ? 'demo.freesites.com.au' : 'www.'.$host;
$b = settings('shop_page');
if($b['shop_page'] > 0)
{
$seo_pageTitle = seo_str($site->pageTitle($b['shop_page']));
$company = $mysql->get_array($mysql->query("value", "fs_settings", "name = 'company_name' LIMIT 1"));
echo '<?xml version="1.0" encoding="ISO-8859-7"?><rss version="2.0" xmlns:g="http://base.google.com/ns/1.0"><channel><title>'.cleanXML($company['value']).' Product feed</title><link>http://'.$host.'/'.$b['shop_page'].'/'.$seo_pageTitle.'</link><description>Information about products sold at '.cleanXML($company['value']).'.</description>';
$query = $mysql->query("ID,cat,name,description,thumb_image,price,sale_price,url_key", "fs_shop_products", "hide = 'n' AND cat > 0 ORDER BY cat");
while($data = $mysql->get_array($query))
{
$price = ($data['sale_price'] > 0) ? $data['sale_price'] : $data['price'];
$calevels = '';
$levels = explode("\n", $site->cat_levels($data['cat']));
foreach($levels as $key => $val)
{
list($k, $name) = explode("#", $val);
$calevels .= (!empty($name)) ? cleanXML($name).' &gt; ' : '';
}
$calevels = substr($calevels, 0, -6);
echo '<item>
<g:id>'.$data['ID'].'</g:id>
<title>'.cleanXML($data['name']).'</title>
<link>http://'.$host.'/'.$b['shop_page'].'/'.$seo_pageTitle.'/'.$data['url_key'].'</link>
<description>'.cleanXML($data['description']).'</description>
<g:image_link>http://'.$host.'/inc/shop/images/'.$data['thumb_image'].'</g:image_link>
<g:condition>new</g:condition>
<g:price>'.$price.'</g:price>
<g:product_type>'.$calevels.'</g:product_type>
<g:mpn>'.$data['ID'].'FSSPSYS</g:mpn>
</item>';
}
echo '</channel></rss>';
}
?>