From a3a0ae77312a7e3c5c15a4f7f08906baf857cacc Mon Sep 17 00:00:00 2001 From: Richard Brown Date: Wed, 22 Oct 2014 14:57:18 +0100 Subject: [PATCH] Add sitemap generating events from 1.9.0.1 In 1.9.0.1 two events were added to Sitemap/Model/Sitemap.php generateXml(): sitemap_categories_generating_before sitemap_products_generating_before They allow the respective collections to be modified before the xml is created. This patch copies those events into Creare_CreareSeoCore_Model_Sitemap_Sitemap. --- .../Creare/CreareSeoCore/Model/Sitemap/Sitemap.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/code/community/Creare/CreareSeoCore/Model/Sitemap/Sitemap.php b/app/code/community/Creare/CreareSeoCore/Model/Sitemap/Sitemap.php index 73baec1..723d3ed 100644 --- a/app/code/community/Creare/CreareSeoCore/Model/Sitemap/Sitemap.php +++ b/app/code/community/Creare/CreareSeoCore/Model/Sitemap/Sitemap.php @@ -29,7 +29,12 @@ public function generateXml() $changefreq = (string)Mage::getStoreConfig('sitemap/category/changefreq', $storeId); $priority = (string)Mage::getStoreConfig('sitemap/category/priority', $storeId); $collection = Mage::getResourceModel('sitemap/catalog_category')->getCollection($storeId); - foreach ($collection as $item) { + $categories = new Varien_Object(); + $categories->setItems($collection); + Mage::dispatchEvent('sitemap_categories_generating_before', array( + 'collection' => $categories + )); + foreach ($categories->getItems() as $item) { $xml = sprintf( '%s%s%s%.1f', htmlspecialchars($baseUrl . $item->getUrl()), @@ -47,7 +52,12 @@ public function generateXml() $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) { + $products = new Varien_Object(); + $products->setItems($collection); + Mage::dispatchEvent('sitemap_products_generating_before', array( + 'collection' => $products + )); + foreach ($products->getItems() as $item) { $xml = sprintf( '%s%s%s%.1f', htmlspecialchars($baseUrl . $item->getUrl()),