<?php
class ControllerFeedLatestProductsRSS extends Controller {
public function index() {
if ($this->config->get('latest_products_rss_status')) {
$this->load->model('catalog/product');
$this->load->model('localisation/currency');
$this->load->model('tool/seo_url');
$this->load->model('tool/image');
$limit = $this->config->get('latest_products_rss_limit') ? $this->config->get('latest_products_rss_limit') : 100;
$show_price = $this->config->get('latest_products_rss_show_price');
$show_date = $this->config->get('latest_products_rss_show_date');
$show_image = $this->config->get('latest_products_rss_show_image');
if ($show_image) {
$image_width = $this->config->get('latest_products_rss_image_width') ? $this->config->get('latest_products_rss_image_width') : 100;
$image_height = $this->config->get('latest_products_rss_image_height') ? $this->config->get('latest_products_rss_image_height') : 100;
}
$products = $this->model_catalog_product->getLatestProducts($limit);
if (isset($this->request->get['currency'])) {
$currency = $this->request->get['currency'];
} else {
$currency = $this->currency->getCode();
}
$output = '<?xml version="1.0" encoding="UTF-8" ?>';
$output .= '<urunler>';
// $output .= '<rss version="2.0">';
// $output .= '<channel>';
// $output .= '<title>' . $this->config->get('config_name') . '</title>';
// $output .= '<description>' . $this->config->get('config_meta_description') . '</description>';
// $output .= '<link>' . HTTP_SERVER . '</link>';
foreach ($products as $product) {
if (true) {
$output .= '<urun>';
$output .= '<urun_kodu>'.$product['product_id'].'</urun_kodu>';
$link = str_replace('&', '&', $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/product&product_id=' . $product['product_id']));
$output .= '<url>'.$link.'</url>';
$special = $this->model_catalog_product->getProductSpecial($product['product_id']);
if ($special) {
$price = $this->currency->format($this->tax->calculate($special, $product['tax_class_id']), $currency, FALSE, TRUE);
} else {
$price = $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id']), $currency, FALSE, TRUE);
}
$output .= '<fiyat>'.$price.'</fiyat>';
$output .= '<kategori>'.'</kategori>';
$output .= '<resim>'.$image_url = $this->model_tool_image->resize($product['image'], $image_width, $image_height).'</resim>';
$output .= '<isim>'.$product['name'].'</isim>';
$output .= '<marka></marka>';
$output .= '<tanim>'.'</tanim>';
$output .= '<action_text></action_text>';
$output .= '</urun>';
}
}
$output .= '</urunler>';
$this->response->addHeader('Content-Type: text/xml');
$this->response->setOutput($output, 0);
}
}
}
?>