EcomDev / EcomDev_UrlRewrite

Alternative implementation of Url Rewrite Index by EcomDev
72 stars 33 forks source link

Indexer does not respect catalog/seo/product_use_categories config flag #19

Open drewgillson opened 9 years ago

drewgillson commented 9 years ago

Hi Ivan, just wanted to let you know I've found and fixed a small issue with this extension. The problem is that even if an administrator has their product_use_categories flag set to No, the indexer will create URL rewrites that look like /some/category/product.html anyways.

I made the following change in EcomDev_UrlRewrite_Model_Mysql4_Indexer::_generateProductRequestPathIndex to correct the problem:

        // Initialize rewrite request path data
        $step = array(false);
        if (Mage::getStoreConfig(Mage_Catalog_Helper_Product::XML_PATH_PRODUCT_URL_USE_CATEGORY, Mage::app()->getStore()->getStoreId())) {
            $step[] = true;
        }

        foreach ($step as $categoryRewriteFlag) {

...instead of

        foreach (array(false,true) as $categoryRewriteFlag) {