示例#1
0
 public function products()
 {
     $this->setLayout('empty');
     set_time_limit(0);
     $response = new XMLResponse();
     $filter = new ARSelectFilter();
     $filter->setOrder(f('Product.dateCreated'), ARSelectFilter::ORDER_DESC);
     $categoryId = $this->getRequest()->get('id');
     if (preg_match('/^\\d+$/', $categoryId)) {
         $this->shouldBeEnabledFeed('CATEGORY_PRODUCTS');
         $category = Category::getInstanceById($categoryId, Category::LOAD_DATA);
         $filter = new ProductFilter($category, $filter);
     } else {
         $this->shouldBeEnabledFeed('ALL_PRODUCTS');
         $category = Category::getRootNode(true);
         $filter = new ProductFilter($category, $filter);
         $filter->includeSubCategories();
     }
     $feed = new ProductFeed($filter);
     $feed->setFlush();
     $feed->setLimit($this->config->get('NUMBER_OF_PRODUCTS_TO_INCLUDE'));
     $response->set('feed', $feed);
     $response->set('category', $category->toArray());
     return $response;
 }
示例#2
0
 public function export()
 {
     $module = $this->request->get('module');
     $enabledFeeds = $this->config->get('ENABLED_FEEDS');
     if (!isset($enabledFeeds[$module]) || $this->request->get('key') != $this->config->get('FEED_KEY')) {
         return;
     }
     $this->setLayout('empty');
     set_time_limit(0);
     $cat = Category::getRootNode(true);
     $filter = new ProductFilter($cat, new ARSelectFilter());
     $filter->includeSubCategories();
     $feed = new ProductFeed($filter);
     $feed->setFlush();
     $response = new XMLResponse();
     $response->set('feed', $feed);
     $response->set('tpl', 'xml/feed/' . $module . '.tpl');
     return $response;
 }