0

can you change subnavigation subcategory urls to SEO friendly? if so how?

ie:

existing = store.com/apparel.html?cat=4

desired = store.com/apparel/shirts.html or anything close to that.

3 Answers 3

4

Let me explain first why is this difference. In the first case you are viewing the 'apparel' category and filtering the results buy subcategory with id 4 (probably shirts). In the second case you are viewing the apparel->shirts category directly.

If you have special settings for the apparel category (like different design, different layout or sidebars) you will still be able to see those settings in the first case (?cat=4).

In the second case you will see the settings for the shirts category.

If you still want to use the friendly urls for filtering you can use an extension.
I recommend Manadev Seo Layered Navigation and Amasty improved Navigation Both of them can be configured to behave like you want and even more.

2
  • I actually don't think Amasty's module can do that. It does have nice URL's for attribute filters, but the category filters are the same as stock Magento, and show up as ?cat=23
    – Erfan
    Commented Sep 29, 2015 at 8:43
  • Yeah, it doesn't actually do that. Response from Amasty Support: "Thank you for the screenshot and steps. The thing is that the 'Category Filter Seelct' feature (which is enabled) in a beta release so it doesn't generate SEO friendly URLs"
    – Erfan
    Commented Sep 30, 2015 at 1:22
2

I created a module that solves this error.

https://github.com/jruzafa/Devopensource_LayerCatSeo

Thanks,

1

This can be fixed quite easily by overriding the getUrl() method in the Mage_Catalog_Model_Layer_Filter_Item class

(Go to /app/code/core/Mage/Catalog/Model/Layer/Filter/Item.php)

Locate the function at line 57, it should look like this:

 public function getUrl()
 {
        $query = array(
        $this->getFilter()->getRequestVar()=>$this->getValue(),
        Mage::getBlockSingleton('page/html_pager')->getPageVarName() => null // exclude current page from urls);
        return Mage::getUrl('*/*/*', array('_current'=>true, '_use_rewrite'=>true, '_query'=>$query));
  }

Change to :

public function getUrl()
{
    if($this->getFilter()->getRequestVar() == "cat"){
        $category_url = Mage::getModel('catalog/category')->load($this->getValue())->getUrl();
        $return = $category_url;
        $request = Mage::getUrl('*/*/*', array('_current'=>true, '_use_rewrite'=>true));
        if(strpos($request,'?') !== false ){
            $query_string = substr($request,strpos($request,'?'));
        }
        else{
            $query_string = '';
        }
        if(!empty($query_string)){
            $return .= $query_string;
        }
        return $return;
    }
    else{
        $query = array(
            $this->getFilter()->getRequestVar()=>$this->getValue(),
            Mage::getBlockSingleton('page/html_pager')->getPageVarName() => null // exclude current page from urls
        );

        return Mage::getUrl('*/*/*', array('_current'=>true, '_use_rewrite'=>true, '_query'=>$query));
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.