<?php
header("Content-Type: text/xml; charset=utf-8");      
ini_set('max_execution_time', 0); 
$dir = '../inc/';
require_once $dir."database.php";
require_once $dir."DW_class.php";
$dw = new DWDB();
$zaman = date('d.m.Y H:i:s');
//* Seo Link oluşturma
function seo_link($link) {
$link = trim($link);
$eski = array('Ç','ç','Ğ','ğ','ı','İ','Ö','ö','Ş','ş','Ü','ü',' ','\'','|','/','`','&#39;','&quot;','&',',','.','?','®',')','(','{','}','[',']');
$yeni = array('c','c','g','g','i','i','o','o','s','s','u','u','-','-','','-','','','','','','','','','','','','','','');
$seo_link = str_replace($eski,$yeni,$link);
$seo_link = strtolower($seo_link);
return $seo_link;
}
//* Seo Link oluşturma
//* Ayar Cek
$ayarcek = $dw->getRow('SELECT * FROM ayarlar WHERE id = ?', array('bindValues' => array(1)));
//* Ayar Cek
$xml ='
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:g="http://base.google.com/ns/1.0">
<updated>'.$zaman.'</updated>
<title>'.$ayarcek->sitelink.'/</title>
<link rel="self" href="'.$ayarcek->sitelink.'/"/>';
$results = $dw->getResults('SELECT * FROM urunler where anaurun = 0 and durum = 1 order by id');
foreach ($results as $yaz) {
//* Marka cek
$markacek = $dw->getRow('SELECT * FROM markalar WHERE id = ?', array('bindValues' => array($yaz->marka)));
//* Marka cek
//* Resim cek
$resimcek = $dw->getRow('SELECT * FROM resimler WHERE urunid = ?', array('bindValues' => array($yaz->id)));
$resimsayisi = $dw->numRows();
if($resimsayisi == 0) {
$resim = "gorselhazir.png";
} else {
$resim = $resimcek->ortaresim;
}
//* Resim cek
$kategorisi = $dw->getRow('SELECT * FROM kategoriler WHERE id = ?', array('bindValues' => array($yaz->ustkategori)));
$link = "u/".$yaz->id."/".seo_link("$kategorisi->kategori")."/".seo_link("$yaz->urun");
$xml.= '<entry>
<summary></summary>
<link href="'.$ayarcek->sitelink.'/'.$yaz->seflink.'"/>
<g:id>'.$yaz->id.'</g:id>
<g:condition>new</g:condition>
<g:mpn>exaanaamd0938asu060</g:mpn>
<g:price>'.$yaz->satis_fiyat.' TRY</g:price>
<g:availability>in stock</g:availability>
<g:image_link><![CDATA['.$ayarcek->sitelink.'/yukleme/urun/'.$resim.']]></g:image_link>
<title><![CDATA['.$yaz->urun.']]></title>
<description><![CDATA['.$yaz->description.']]></description>
<g:shipping>
<g:country>TR</g:country>
<g:service>Standard</g:service>
</g:shipping>
<g:brand><![CDATA['.$markacek->marka.']]></g:brand>
</entry>';
}
$xml .= '</feed>';
echo $xml;
error_reporting(0);
?>