1

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');
 }
}
Teja Bhagavan Kollepara
3,8275 gold badges33 silver badges69 bronze badges
asked Aug 14, 2015 at 9:52
2
  • 2
    When you have your block set up correctly you can validate it in the template by doing <?php echo get_class($this);?> and it will tell you what block it thinks it is. Just to validate that it's actually getting your instance of Test_Lookbook_Block_Lookbook_View. Also putting subdirectories in /Block is grand, no worries :) Commented Aug 14, 2015 at 11:33
  • But my issue is my template view.php file doesn't get called when i use the correct block type. Commented Aug 14, 2015 at 15:20

1 Answer 1

2

After unknown hours and google searches.

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

answered Aug 14, 2015 at 15:41

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.