1

I am having a config.xml file in my module Adept/Wallets/etc as -

<frontend>
        <layout>
            <updates>
                <wallets>
                    <file>wallets.xml</file>
                </wallets>
            </updates>
        </layout>
</frontend>

...

    <global>
            <blocks>
                <wallets>
                    <class>Adept_Wallets_Block_Walletrequest</class>
                </wallets>            
            </blocks>
    </global>

my layout file wallets.xml is -

<wallets_index_wallethistory>
        <update handle="customer_account" />
        <reference name="content">
            <block type="page/html" name="walletrequest" template="wallets/wallethistory.phtml" />
        </reference>
    </wallets_index_wallethistory>

I have created block class in Adept/Wallets/Block/Walletrequest.php

<?php
class Adept_Wallets_Block_Walletrequest extends Mage_Core_Block_Template
{
    public function __construct() 
    {  echo "here2"; die;
        parent::__construct();
        $collection = Mage::getModel('wallets/sellerrequest')->getCollection();
        $this->setCollection($collection);        
    } 

    protected function _prepareLayout()
    {
            parent::_prepareLayout();

            $pager = $this->getLayout()->createBlock('page/html_pager', 'custom.pager');
            $pager->setAvailableLimit(array(5=>5,10=>10,20=>20,'all'=>'all'));
            $pager->setCollection($this->getCollection());
            $this->setChild('pager', $pager);
            $this->getCollection()->load();
            return $this;
    }

    public function getPagerHtml()
    {
            return $this->getChildHtml('pager');
    } 
}

I expect to execute this and display message and die when page loads, but it doesn't. I am not getting what went wrong.

Any help is appreciated. Thanks.

0

there are lot of issue in your model.

Issue 1: You have not define block class at config.xml

<global>
            <blocks>
                <wallets>
                    <class>Adept_Wallets_Block_Walletrequest</class>
                </wallets>            
            </blocks>
    </global>

Should be

<global>
            <blocks>
                <wallets>
                    <class>Adept_Wallets_Block</class>
                </wallets>            
            </blocks>
    </global>

Issue 2: On Layout file you have not call the block type is should wallets/Walletrequest to page/html

| improve this answer | |
2

In your config.xml file. You have declared block base class name as Adept_Wallets_Block_Walletrequest

<global>
        <blocks>
            <wallets>
                <class>Adept_Wallets_Block_Walletrequest</class>
            </wallets>            
        </blocks>
</global>

it should be Adept_Wallets_Block .since you are mentioning base class name.

| improve this answer | |
1

your code should be as follows

<global>
    <blocks>
        <wallets>
            <class>Adept_Wallets_Block</class>
        </wallets>
    </blocks>
</global>
| improve this answer | |
0

it seems like you are using page/html type block if you are making your custom one your xml tag should be as below

 <reference name="content">
            <block type="wallets/walletrequest" name="walletrequest" template="wallets/wallethistory.phtml" />
        </reference>

Try to change type="wallets/walletrequest" and see.

hope this will solve your issue.

| improve this answer | |

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.