5

I try to help a user on magento.stackexchange. So I created his extension and created a new CMS site with the following content:

{{block type="atwix/cmsattr" template="atwix/cmsattr/list.phtml"}}

I also allowed the block in the backend at (System -> Permissions -> Blocks).

But if I call the site, then there is no output from the block.

app/code/local/Atwix/Cmsattr/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Atwix_Cmsattr>
            <version>0.1.0</version>
        </Atwix_Cmsattr>
    </modules>
    <global>
        <blocks>
            <atwix_cmsattr>
                <class>Atwix_Cmsattr_Block</class>
            </atwix_cmsattr>
        </blocks>
        <models>
            <atwix_cmsattr>
                <class>Atwix_Cmsattr_Model</class>
            </atwix_cmsattr>
        </models>
    </global>
</config>

app/code/local/Atwix/Cmsattr/Block/List.php

<?php
class Atwix_Cmsattr_Block_List extends Mage_Catalog_Block_Product_Abstract
{
    protected $_itemCollection = null;

    public function getItems()
    {
        $color = $this->getColor();
        if (!$color)
            return false;
        if (is_null($this->itemCollection)) {
            $this->_itemCollection = Mage::getModel('atwix_cmsattr/products')->getItemsCollection($color);
        }

        return $this->_itemCollection;
    }
}

app/design/frontend/rwd/default/template/atwix/cmsattr/list.phtml

I replaced his template content with "hello world"

What is going on?

5
  1. Verify the module is enabled in app/etc/modules and in System/Configuration/Advanced
  2. You did the permissions change
  3. {{block type="atwix_cmsattr/list" template="atwix/cmsattr/list.phtml"}}

That should do the trick.

0

I solved it. I had to use

{{block type="atwix_cmsattr/list" template="atwix/cmsattr/list.phtml"}}

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.