Magento Themes and Magento Extensions

getting the last page number in magento

Posted on August 20th, 2014 | Posted by admin

I am recently working on a $this->getLastPageNum()project and I was changing the pagination in order to indicate the total pages by the current collection size
as I knew the functions from product catalogs I wanted to count it myself to use


to get the current limit for each products per page and also use the total number of all products


How to display Parent Category of a subcategory

Posted on August 18th, 2014 | Posted by admin

In Magento : To display the parent category of the subcategory you are located in you will have to use the current code. We used this into a file called list_parent.phtml located on our sidebar on this location:
/app/design/frontend/default/YOUR THEME/template/catalog/navigation/list_parent.phtml

<div> <strong><span><?php echo $this->__('Browse By') ?></span></strong> </div>
<dl id="narrow-by-list2">
  <dt><?php echo $this->__('Category') ?></dt>
                $currentCat = Mage::registry('current_category');
                //if Rootcategory display current category only
                //this gets around the problem of displaying DEFAULT CATEGORY
                if ( $currentCat->getParentId() == Mage::app()->getStore()->getRootCategoryId() )
                    //Display current category

Custom events in Magento

Posted on August 14th, 2014 | Posted by admin

This year, I’ve been working extensively in Magento, which is a change of pace from the custom-coded, “from the ground up” projects I’d been doing previously. I was excited about entering this “brave new world” because with my background, I felt I could take quickly to find ways to extend Magento’s core functionality.  One example that was brought to my attention wascustom events.

Events in Magento are similar to hooks in WordPress,  which is where code is able to be run during particular ‘hooks’ in the loading process (ie: initialization). In Magento, you can dispatch events whenever you like. For example, in line 335 of Magento’s core customer account controller (app/code/core/Mage/Customer/controllers/AccountController.php), you see this:


Posted on August 5th, 2014 | Posted by admin

Why would you like to disable cache?

Well probably you wouldn’t. Especially not when your store is already live an fully functional. But on developing stage, disabling the cache would make it possible for you to immediately test and control the fluent changes you are constantly applying to your theme, locale files or scripts. Not disabling cache in this case will cause a huuuge frustration. Not to mention an almost irrepressible desire to bang your head against the nearest break wall! Not at all recommended, and may be avoided quite easily like so:

In the back office, go to system => configuration => cache management.

Magento add your own CMS Directive to include your custom template tag

Posted on August 1st, 2014 | Posted by admin

This post details on how I was able to add new template tag on Magento Cms pages and static blocks. If you want to know more about these directives and template tags, you can check official magento wiki here.

So, Let’s go through the files that I have added/updated to make this happen.

First on Tgeneral/etc/config.xml we need to tell magento that we want to add our new filter by adding this block of code:

1 <cms>
2 <page>
3 <tempate_filter>tgeneral/template_filter</tempate_filter>
4 </page>
5 <block>
6 <tempate_filter>tgeneral/template_filter</tempate_filter>
7 </block>
8 </cms>
Page 2 of 2«12