0

I have an issue where I can't get the content of a custom tab I made within the My Account Dashboard (Customer My Account).

Here is my config.xml:

app/code/local/Cardfever/Abonnement/etc

<?xml version="1.0"?>
<config>
    <modules>
        <Cardfever_Abonnement>
            <version>0.1.0</version>
        </Cardfever_Abonnement>
    </modules>
    <frontend>
        <routers>
            <abonnement>
                <use>standard</use>
                <args>
                    <module>Cardfever_Abonnement</module>
                    <frontName>abonnement</frontName>
                </args>
            </abonnement>
        </routers>
        <layout>
            <updates>
                <abonnement>
                    <file>abonnement.xml</file>
                </abonnement>
            </updates>
        </layout>
    </frontend>
    <admin>
        <routers>
            <abonnement>
                <use>admin</use>
                <args>
                    <module>Cardfever_Abonnement</module>
                    <frontName>abonnement</frontName>
                </args>
            </abonnement>
        </routers>
    </admin>
    <adminhtml>
        <menu>
            <currency>             
                <children>
                    <items module="abonnement">
                        <title>Abonnementskunder</title>
                        <sort_order>1000</sort_order>
                        <action>abonnement/adminhtml_abonnement</action>
                    </items>
                </children>
            </currency>
        </menu>
        <acl>
            <resources>
                <all>
                    <title>Allow Everything</title>
                </all>
                <admin>
                    <children>
                        <abonnement>
                            <title>Abonnement Module</title>
                            <sort_order>200</sort_order>
                        </abonnement>
                    </children>
                </admin>
            </resources>  
        </acl>
        <layout>
            <updates>
                <abonnement>
                    <file>abonnement.xml</file>
                </abonnement>
            </updates>
        </layout>
    </adminhtml>  
    <global>
        <models>
            <abonnement>
                <class>Cardfever_Abonnement_Model</class>
                <resourceModel>abonnement_mysql4</resourceModel>
            </abonnement>
            <abonnement_mysql4>
                <class>Cardfever_Abonnement_Model_Mysql4</class>
                <entities>
                    <abonnement>
                        <table>abonnement</table>
                    </abonnement>
                </entities>
            </abonnement_mysql4>
        </models>
        <resources>
            <abonnement_setup>
                <setup>
                    <module>Cardfever_Abonnement</module>
                </setup>
                <connection>
                    <use>core_setup</use>
                </connection>
            </abonnement_setup>
            <abonnement_write>
                <connection>
                    <use>core_write</use>
                </connection>
            </abonnement_write>
            <abonnement_read>
                <connection>
                    <use>core_read</use>
                </connection>
            </abonnement_read>
        </resources>
        <blocks>
            <abonnement>
                <class>Cardfever_Abonnement_Block</class>
            </abonnement>
        </blocks>
        <helpers>
            <abonnement>
                <class>Cardfever_Abonnement_Helper</class>
            </abonnement>
        </helpers>
    </global>
    <crontab>
        <jobs>
            <abonnement>
                <schedule><cron_expr>*/5 * * * *</cron_expr></schedule>
                <run><model>abonnement/observer::checkForPayments</model></run>
            </abonnement>
        </jobs>
    </crontab>
</config> 

Here is my frontend layout file:

/app/design/frontend/default/cardfever/layout/abonnement.xml

<?xml version="1.0"?>
<layout>
    <customer_account>
        <reference name="customer_account_navigation">
            <action method="addLink">
                <name>cardfever_plus</name>
                <path>abonnement/customer/cardfeverplus</path>
                <label>Cardfever Plus</label>
            </action>
        </reference>
    </customer_account>

    <abonnement_customer_cardfeverplus> 
       <update handle="customer_account"/> 
       <reference name="content"> 
           <block type="abonnement/customer" name="cardfeverplus.abonnement" template="abonnement/customer/cardfeverplus.phtml"/>        
       </reference>
   </abonnement_customer_cardfeverplus>
</layout>

My IndexCrontoller which is under controllers:

app/code/local/Cardfever/Abonnement/controllers/IndexController.php

<?php
class Cardfever_Abonnement_IndexController extends Mage_Core_Controller_Front_Action
{
    public function indexAction()
    {
            $this->loadLayout();
            $this->renderLayout();
    }
} 

Here is another controller which is also placed under controllers under the module CustomerController.php:

app/code/local/Cardfever/Abonnement/controllers/CustomerController.php

<?php

class Cardfever_Abonnement_CustomerController extends Mage_Core_Controller_Front_Action
{   
    /**
     * Checking if user is logged in or not
     * If not logged in then redirect to customer login
     */
    public function preDispatch()
    {
        parent::preDispatch();

        if (!Mage::getSingleton('customer/session')->authenticate($this)) {
            $this->setFlag('', 'no-dispatch', true);

        // adding message in customer login page
        Mage::getSingleton('core/session')
                ->addSuccess(Mage::helper('abonnement')->__('Please sign in or create a new account'));
        }
    }           

    /**
     * View Your Module
     */
    public function viewAction()
    {                   
    $this->loadLayout();        
        $this->getLayout()->getBlock('head')->setTitle($this->__('Your Abonnement Title'));     
    $this->renderLayout();
    }
}

My Template cardfeverplus.phtml:

app/design/frontend/default/cardfever/template/abonnement/customer/cardfeverplus.phtml

<div class="page-title">
    <h1><?php echo $this->__('My Tab') ?></h1>
</div>

My Block Customer.php:

app/code/local/Cardfever/Abonnement/Block/Customer.php

<?php
class Cardfever_Abonnement_Block_Customer extends Mage_Core_Block_Template
{
    // CODE
}

I have feeling it has something to do with my controllers having and IndexController and CustomerController - or ? Can anybody help me out here to locate the issue to why I am not seeing the content of the tab - it goes to a 404 page atm.

1 Answer 1

1

You've defined abonnement_customer_cardfeverplus handle in layout file. But you doesn't have cardfeverplusAction in your controller Cardfever_Abonnement_CustomerController. You've only viewAction.

First solution: Just rename viewAction to cardfeverplusAction in app/code/local/Cardfever/Abonnement/controllers/CustomerController.php

Second: Change layout handle abonnement_customer_cardfeverplus -> abonnement_customer_view in /app/design/frontend/default/cardfever/layout/abonnement.xml

Third: or load needed layout handle. Change line with $this->loadLayout(); to $this->loadLayout('abonnement_customer_cardfeverplus'); in viewAction in controller app/code/local/Cardfever/Abonnement/controllers/CustomerController.php.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.