00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 class Mage_Rss_CatalogController extends Mage_Core_Controller_Front_Action
00036 {
00037 protected function isFeedEnable($code)
00038 {
00039 return Mage::getStoreConfig('rss/catalog/'.$code);
00040 }
00041
00042 protected function checkFeedEnable($code)
00043 {
00044 if ($this->isFeedEnable($code)) {
00045 $this->getResponse()->setHeader('Content-type', 'text/xml; charset=UTF-8');
00046 return true;
00047 } else {
00048 $this->getResponse()->setHeader('HTTP/1.1','404 Not Found');
00049 $this->getResponse()->setHeader('Status','404 File not found');
00050 $this->_forward('nofeed','index','rss');
00051 return false;
00052 }
00053 }
00054
00055 public function newAction()
00056 {
00057 $this->checkFeedEnable('new');
00058 $this->loadLayout(false);
00059 $this->renderLayout();
00060 }
00061
00062 public function specialAction()
00063 {
00064 $this->checkFeedEnable('special');
00065 $this->loadLayout(false);
00066 $this->renderLayout();
00067 }
00068
00069 public function salesruleAction()
00070 {
00071 $this->checkFeedEnable('salesrule');
00072 $this->loadLayout(false);
00073 $this->renderLayout();
00074 }
00075
00076 public function tagAction()
00077 {
00078 if ($this->checkFeedEnable('tag')) {
00079 $tagName = $this->getRequest()->getParam('tagName');
00080 $tagModel = Mage::getModel('tag/tag');
00081 $tagModel->loadByName($tagName);
00082 if ($tagModel->getId() && $tagModel->getStatus()==$tagModel->getApprovedStatus()) {
00083 Mage::register('tag_model', $tagModel);
00084 $this->loadLayout(false);
00085 $this->renderLayout();
00086 return;
00087 }
00088 }
00089 $this->_forward('nofeed', 'index', 'rss');
00090 }
00091
00092 public function notifystockAction()
00093 {
00094 Mage::helper('rss')->authAdmin('catalog/products');
00095 $this->getResponse()->setHeader('Content-type', 'text/xml; charset=UTF-8');
00096 $this->loadLayout(false);
00097 $this->renderLayout();
00098 }
00099
00100 public function reviewAction()
00101 {
00102 Mage::helper('rss')->authAdmin('catalog/reviews_ratings');
00103 $this->getResponse()->setHeader('Content-type', 'text/xml; charset=UTF-8');
00104 $this->loadLayout(false);
00105 $this->renderLayout();
00106 }
00107
00108 public function categoryAction()
00109 {
00110 if ($this->checkFeedEnable('category')) {
00111 $this->loadLayout(false);
00112 $this->renderLayout();
00113 }
00114 }
00115 }