2

On home page cms, I have added block as below :

{{block type='page/html' as='homepagecategories' template='page/html/homepagecategories.phtml'}} 

And I am trying to load few of the categories as below

$store = Mage::app()->getStore()->getId(); 
$homeCategoryCollection = Mage::getModel('catalog/category')
        ->getCollection()
        ->setStoreId($store)
        ->addAttributeToFilter('display_on_home_page',1)
        ->addAttributeToSelect('url_path')
        ->addAttributeToSelect('name')
        ->addAttributeToSelect('is_active')
        ->addAttributeToSelect('display_on_home_page'); 
foreach($homeCategoryCollection as $cat) {
 //category display output
}

when I comment foreach block, I am able to see my homepage but if I remove that comment, It gives me following log in system.

2014-03-10T15:07:42+00:00 DEBUG (7): Failed to load template:/mystorepath/default/template/page/html/homepagecategories.phtml

I have created "display_on_home_page" category attribute(dropdown) using extension and I am able to see dropdown in the backend. Any suggestion to move further?

2

I think the error can't be better:

Failed to load template: /mystorepath/default/template/page/html/homepagecategories.phtml

So either the template doesn't exist or you have a spelling error, maybe uppercase/lowercase problem? Or there is a symlink to the template and you don't allow using symlinks in the backend:

System > Configuration > Developer > Template Settings > Allow Symlinks
  • There won't be any chance of uppercase/lowercase problem, cause template is currently working. I have added above line of codes in it. – Kamal Mar 11 '14 at 6:37
  • I actually want to know when can this be possible. – Kamal Mar 11 '14 at 6:39
  • If you comment the foreach block everything is fine? And if you have the foreach block, then you get this error!? Ok, I have NO clue. This doesn't make sense :-/ – Fabian Blechschmidt Mar 11 '14 at 6:44
  • :) $homeCategoryCollection is the main issue over here... – Kamal Mar 11 '14 at 7:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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