Magento Creare SEO overrides default page titles

I had installed Magento Creare SEO extensions (http://www.magentocommerce.com/magento-connect/creare-seo.html)

The extension is good and did what I wanted to achieve.

However, the extension override the page title to default page title in these pages, such as Login, Signup, Popular Search Terms, Search Results, etc. So it created duplicate page titles.

After researching the code, I found most pages are configured default titles by itself. So if Creare SEO is using default title, then all problems will be solved.

So here is what I changed.

Note

  1. This is not good practice, since I am modifying core extension code. Or there could be the configuration to fix this issue. Or this is something that Creare developer can update. In anyway, this is not good practice.
  2. I am using Creare SEO 1.1.7 (stable).

File: /app/code/community/Creare/CreareSeoCore/Model/Observer.php:223

    public function setTitle($observer)
    {
        if (Mage::getStoreConfig('creareseocore/defaultseo/forcehptitle') && $observer->getEvent()->getAction()->getFullActionName() == "cms_index_index") return;
	if ($observer->getEvent()->getAction()->getFullActionName() == "contacts_index_index") return;
            $layout = $observer->getEvent()->getLayout();
            $title = $this->getTitle();
            if($title)
            {
                if ($head = $layout->getBlock('head'))
                {
                    $head->setTitle($title);
                }
            }
            
            $layout->generateXml();
    }

to

public function setTitle($observer)
    {
    	$ignore_actions = array(
			"contacts_index_index", "catalogsearch", "customer_account"
		);
        if (Mage::getStoreConfig('creareseocore/defaultseo/forcehptitle') && $observer->getEvent()->getAction()->getFullActionName() == "cms_index_index") return;
		foreach($ignore_actions as $action)
		{
			if (stristr($observer->getEvent()->getAction()->getFullActionName(), $action) !== false) return;	
		}
		
            $layout = $observer->getEvent()->getLayout();
            $title = $this->getTitle();
            if($title)
            {
                if ($head = $layout->getBlock('head'))
                {
                    $head->setTitle($title);
                }
            }
            
            $layout->generateXml();
    }

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.