<?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"?><productset>';
$query = $mysql->query("ID,cat,name,description,thumb_image,price,sale_price,url_key", "fs_shop_products", "hide = 'n' AND cat > 0");
while($data = $mysql->get_array($query))
{
$price = ($data['sale_price'] > 0) ? $data['sale_price'] : $data['price'];
echo '<product>
<Code>'.$data['ID'].'</Code>
<Name>'.cleanXML($data['name']).'</Name>
<Description>'.cleanXML($data['description']).'</Description>
<Category xml:space="preserve">Clothing</Category>
<Price>'.$price.'</Price>
<Product_URL>http://'.$host.'/'.$b['shop_page'].'/'.$seo_pageTitle.'/'.$data['url_key'].'</Product_URL>
<Image_URL>http://'.$host.'/inc/shop/images/'.$data['thumb_image'].'</Image_URL>
<InStock>Y</InStock>
</product>';
}
echo '</productset>';
}
?>