Problems and Solutions When using Aheadworks Blog Extension

The community version of Aheadworks Blog Extension v1.1 is great and many of the Magento websites use it, most likely because it is free. However, you’ll encounter quite some problems when using the extension from them.

The major highlights of the problems for the Aheadwork Blog Extension v1.1 are:

  1. 404 not found when visiting the post page through url "/blog/page identifier";
  2. Wrong url for post title in category page;
  3. The style.css will be loaded on every page at the frontend.

Below are the details of the problems and solutions to these problems:

404 not found when visiting the post page through url "/blog/identifier page"

The “Hello World” page of the aheadworkds blog extension turns out to be a 404 error. This is annoying and we doubt if the extension has been fully tested?! We investigate into the source code of this extension and find that the problem. At the line 201-211 of the file.

// filepath:  MAGENTO_ROOT/app/code/community/AW/Blog/Controller/Router.php

The codes here doesn’t consider the blog post identifier with suffix of “.html”, which is commonly used nowaday. Thus we modified the code as the followings:

if (!$post->load($identifier)->getId()) {
	if (!$post->load($identifier.".htm")->getId()) {
		if (!$post->load($identifier.".html")->getId()) {
			return false;
		}
		else $identifier .= '.html'; // add .html suffix
	}
	else $identifier .= '.htm'; // add .htm suffix
}

Wrong url for post title in category page

The category hyperlinks of this blog extension looks like: "cat/cat_identifier/". But for the titles of each post, they will be linked to a 404 error page, whose url is “cat/cat_identifier/post/view/identifier/post_identifier”. This means most links will lead to 404 error page after user visit a blog category page. However, on the other side, we found that the “read more” code beneath the preview of a post works correctly, so we change the link of the title of the post.

<!-- filepath: MAGENTO_ROOT/app/design/frontend/default/default/template/aw_blog/cat.phtml -->
<?php $route = Mage::helper('blog')->getRoute(); ?>
<?php foreach ($posts as $post): ?>
    <?php $_url = $this->getUrl($route . "/" . $post->getIdentifier()) ?>
    <h2><a href='' ><?php echo $post->getTitle();?>
     ....
<?php endforeach; ?>

The style.css will load on every page at the frontend

We find that the style.css of this Blog Extension will be loaded in every page by default, this can cause potential extensions/themes conflict and it is not a good practice to load the unnecessary CSS in every pages. Therefore, we add the codes

MAGENTO_ROOT/app/design/frontend/default/default/layout/aw_blog.xml

We remove the

    
                
		
			skin_cssaw_blog/css/style.css
		
    

and paste it into tag <blog_index_index>. The final version of the xml will be like:

	
    
		
			skin_cssaw_blog/css/style.css
		
    
	....

The Blog Extension from Aheadworks has been posted for quite a long time. Hope there will be an update on these issues later.