Magento 1.7 Module Block Not Working – Solutions

blocksmagento-1.7module

I've gone through about 50 different pages and posts of people having the same issue, but none seem to be caused by what ever is casing my issue.

I've got my module, registered the route and it's loading the layout XML all fine as the page template is the correct one. I can also log in my controller and action just fine. If I change my block type to a built in Magento type like core/template It gives me an error caused by the code in my template phtml file so the template file is working. It just seems to be the block type throwing me off.

I keep looking through tutorials and guides but I'm failing to see any difference sin my approach. I see not many people putting their block in a sub folder in the Blocks folder, but I am calling the block with lookbook_view. I also tested by moving the view block out of m Lookbook folder and placing it directly in the Block folder (and renaming the class) but this also did not work

app/design/frontend/base/default/layout/lookbook.xml

<lookbook_lookbook_view translate="label">
    <label>Single Lookbook Page</label>
    <remove name="right"/>
    <remove name="left"/>

    <reference name="root">
        <action method="setTemplate">
            <template>page/1column.phtml</template>
        </action>
    </reference>
    <reference name="content">
        <block type="lookbook/lookbook_view" name="lookbook_view" template="lookbook/view.phtml"/>
    </reference>
</lookbook_lookbook_view>

app/code/local/Test/Lookbook/etc/config.xml

<config>
    <global>
        <blocks>
            <lookbook>
                <class>Test_Lookbook_Block</class>
            </lookbook>
        </blocks>
    ....
</config>
...
<frontend>
    <routers>
        <lookbook>
            <use>standard</use>
            <args>
                <module>Test_Lookbook</module>
                <frontName>lookbook</frontName>
            </args>
        </lookbook>
    </routers>
    <layout>
        <updates>
            <lookbook>
                <file>lookbook.xml</file>
            </lookbook>
        </updates>
    </layout>
</frontend>

app/code/local/Test/Lookbook/Block/Lookbook/view.php

class Test_Lookbook_Block_Lookbook_View extends Mage_Core_Block_Template{

   public function getCurrentLookbook()
   {
       echo 'test';die();

       return Mage::registry('current_lookbook');
   }
}

Best Answer

After unknown hours and google searches.

view.php needed to be View.php Magento capitalizes the files it looks for in the block type.