From 3bd29b95365416fb3d0345f93382fab54df5e350 Mon Sep 17 00:00:00 2001 From: davidverholen Date: Mon, 3 Nov 2014 12:49:20 +0100 Subject: [PATCH] check if EcomDev_UrlRewrite is installed before loading model instance --- code/Model/Observer.php | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/code/Model/Observer.php b/code/Model/Observer.php index b2135a7..c6a4aa8 100644 --- a/code/Model/Observer.php +++ b/code/Model/Observer.php @@ -81,12 +81,11 @@ protected function _indexSearch(&$productIds) */ protected function _indexProductRewrites(&$productIds) { - // Only generate URL rewrites when this module is enabled. - $indexer = Mage::getResourceSingleton('ecomdev_urlrewrite/indexer'); - if ($indexer) { - return $indexer->updateProductRewrites($productIds); + if (!Mage::helper('core')->isModuleEnabled('EcomDev_UrlRewrite')) { + return $this; } - return $this; + + return Mage::getResourceSingleton('ecomdev_urlrewrite/indexer')->updateProductRewrites($productIds); } /** @@ -97,12 +96,11 @@ protected function _indexProductRewrites(&$productIds) */ protected function _indexCategoryRewrites(&$categoryIds) { - // Only generate URL rewrites when this module is enabled. - $indexer = Mage::getResourceSingleton('ecomdev_urlrewrite/indexer'); - if ($indexer) { - return $indexer->updateCategoryRewrites($categoryIds); + if (!Mage::helper('core')->isModuleEnabled('EcomDev_UrlRewrite')) { + return $this; } - return $this; + + return Mage::getResourceSingleton('ecomdev_urlrewrite/indexer')->updateCategoryRewrites($categoryIds); } /**