public function getLinks() { $links = new Varien_Object(array('links' => $this->_links)); Mage::dispatchEvent('affiliateplus_account_navigation_get_links', array('block' => $this, 'links_obj' => $links)); $this->_links = $links->getLinks(); ksort($this->_links); return $this->_links; }
/** * Generate XML file * * @return XML */ public function generateXml() { /* $io->streamWrite('<?xml version="1.0" encoding="UTF-8"?>' . "\n"); $io->streamWrite('<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'); */ $storeId = $this->getStoreId(); $date = Mage::getSingleton('core/date')->gmtDate('Y-m-d'); $baseUrl = Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK); $data = new Varien_Object(); $data->setLinks(array()); /** * Generate categories sitemap */ $collection = Mage::getResourceModel('sitemap/catalog_category')->getCollection($storeId); foreach ($collection as $item) { array_push($data->getLinks(), $item->getUrl()); } unset($collection); /** * Generate products sitemap */ $changefreq = (string) Mage::getStoreConfig('sitemap/product/changefreq', $storeId); $priority = (string) Mage::getStoreConfig('sitemap/product/priority', $storeId); $collection = Mage::getResourceModel('sitemap/catalog_product')->getCollection($storeId); foreach ($collection as $item) { $xml = sprintf('<url><loc>%s</loc><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%.1f</priority></url>', htmlspecialchars($baseUrl . $item->getUrl()), $date, $changefreq, $priority); $io->streamWrite($xml); } unset($collection); /** * Generate cms pages sitemap */ $changefreq = (string) Mage::getStoreConfig('sitemap/page/changefreq', $storeId); $priority = (string) Mage::getStoreConfig('sitemap/page/priority', $storeId); $collection = Mage::getResourceModel('sitemap/cms_page')->getCollection($storeId); foreach ($collection as $item) { $xml = sprintf('<url><loc>%s</loc><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%.1f</priority></url>', htmlspecialchars($baseUrl . $item->getUrl()), $date, $changefreq, $priority); $io->streamWrite($xml); } unset($collection); $io->streamWrite('</urlset>'); $io->streamClose(); $this->setSitemapTime(Mage::getSingleton('core/date')->gmtDate('Y-m-d H:i:s')); $this->save(); return $this; }
/** * Prepare selected options for downloadable product * * @param Mage_Catalog_Model_Product $product * @param Varien_Object $buyRequest * @return array */ public function processBuyRequest($product, $buyRequest) { $links = $buyRequest->getLinks(); $links = is_array($links) ? array_filter($links, 'intval') : array(); $options = array('links' => $links); return $options; }