0

Built a module with one block - List.php

class Pts_HireCms_Block_List extends Mage_Core_Block_Template
{
    protected $productRange;
    public function loadCollection($productRange)
    {
        return Mage::getModel('hirecms/hire')
                            ->getCollection()
                            ->addFieldToFilter('product_range', $productRange)
                            ->setOrder('position', 'asc');
    }
    public function getHireProd()
    {
        return $this->loadCollection('Hire Prods');
    }
    public function getNonHireProds()
    {
        return $this->loadCollection('Non Hire Prods');
    }
}

Then I have a theme xml file of hirecms.xml:

<?xml version="1.0"?>
<layout version="0.1.0">
    <default>
        <reference name="root">
            <block type="hirecms/list" name="hireProd" template="hirecms/hire-prod.phtml" />
            <block type="hirecms/list" name="nonHireProd" template="hirecms/non-hire-prod.phtml" />
        </reference>
    </default>
</layout>

and i've added:

{{block type="hirecms/list" template="hirecms/hire-prod.phtml"}}

to a static block, then on a category i've set display mode = static block only and cms block = to the one ive created.

However when i visit the route, the page loads but my block {{block type="hirecms/list" template="hirecms/hire-prod.phtml"}} is not being called.

Any ideas why?

I have this working perfectly on my local site, and the code has been pushed using github so no amendments along the way.

Thanks

  • Did you try {{block type="core/template" template="hirecms/hire-prod.phtml"}} – Magento 2 Nov 24 '15 at 19:27
  • Doesn't work either, no errors are being logged either. – Stefkay Nov 25 '15 at 9:35
0

I had to add my block type "hirecms/list" to System -> Permissions -> Blocks.

0

Block type should be hireCms/list with the capital C.
Secondly it must be added to System -> Permissions -> Blocks.

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.