cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot create a custom page on account dashboard

Cannot create a custom page on account dashboard

I can add a link on my account left menu, but when I click it, it gives me an 404 error.
Is there anything wrong with my files' location? Or is it the problem of my code? 

My Controller:

class Mage_Customer_TrainingController extends Mage_Core_Controller_Front_Action
{
    protected function _getSession()
    {
        return Mage::getSingleton('customer/session');
    }

    public function preDispatch()
    {
        parent::preDispatch();

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

    public function indexAction()
    {
        $this->loadLayout();
        $this->renderLayout();
    }

  
}

Contorller Location:
Screenshot1.jpg

customer.xml for layout

        <reference name="left_first">
            <block type="customer/account_navigation" name="customer_account_navigation" before="-" template="customer/account/navigation.phtml">
                <action method="addLink" translate="label" module="customer"><name>account</name><path>customer/account/</path><label>Account Dashboard</label></action>
                <action method="addLink" translate="label" module="customer"><name>account_edit</name><path>customer/account/edit/</path><label>Account Information</label></action>
                <action method="addLink" translate="label" module="customer"><name>address_book</name><path>customer/address/</path><label>Address Book</label></action>
                <action method="addLink" translate="label" module="customer"><name>training</name><path>customer/training/</path><label>Training Material</label></action>                
            </block>
        </reference>

Screenshot2.jpg

my custom page layout xml:

    <customer_training_index translate="label">
        <label>Customer Training</label>
        <!-- Mage_Customer  -->
        <update handle="customer_account"/>
        <reference name="my.account.wrapper">
            <block type="customer/training" name="customer_training" template="customer/training/training.phtml"/>
        </reference>
    </customer_training>    

My real customer page layout phtml:
Location:
Screenshot3.jpg

Code:

	<div class="dashboard">
		<div class="page-title">
			<h1><?php echo $this->__('Healthy Living & Knowledge of Chinese Medicine') ?></h1>
		</div>
		<?php
			echo $this->getLayout()->createBlock('cms/block')->setBlockId('training_material')->toHtml();
		?>
	</div>	

My Block:
Location:
Screenshot4.jpg

Code:

<?php

class Mage_Customer_Block_Training extends Mage_Customer_Block_Account_Dashboard // Mage_Core_Block_Template
{

    // public function __construct()
    // {
    //     parent::__construct();
    //     $this->setTemplate('customer/form/training.phtml');
    // }

    // public function getIsSubscribed()
    // {
    //     return $this->getSubscriptionObject()->isSubscribed();
    // }

    public function getTrainingUrl()
    {
        return $this->getUrl('customer/training/');
    }

}
4 REPLIES 4

Re: Cannot create a custom page on account dashboard

Hi @billyChanVG

 

Can you update your question with the modules's config.xml file ?

---
Problem Solved Click Accept as Solution!:Magento Community India Forum

Re: Cannot create a custom page on account dashboard

Here you are. My other pages in the account dashboard work fine, only this one fail

<?xml version="1.0"?>
<config>
    <modules>
        <Mage_Customer>
            <version>1.6.2.0.4</version>
        </Mage_Customer>
    </modules>
    <admin>
        <fieldsets>
            <customer_dataflow>
                <store_id>
                    <system>1</system>
                </store_id>
                <store>
                    <ignore>1</ignore>
                </store>
                <entity_id>
                    <system>1</system>
                    <ignore>1</ignore>
                </entity_id>
                <attribute_set_id>
                    <system>1</system>
                    <ignore>1</ignore>
                </attribute_set_id>
                <attribute_set>
                    <ignore>1</ignore>
                </attribute_set>
                <entity_type_id>
                    <system>1</system>
                </entity_type_id>
                <increment_id>
                    <system>1</system>
                    <ignore>1</ignore>
                </increment_id>
                <parent_id>
                    <system>1</system>
                </parent_id>
                <created_at>
                    <system>1</system>
                </created_at>
                <updated_at>
                    <system>1</system>
                </updated_at>
                <group_id>
                    <ignore>1</ignore>
                </group_id>
                <type_id>
                    <system>1</system>
                    <ignore>1</ignore>
                </type_id>
                <type>
                    <ignore>1</ignore>
                </type>
                <created_in>
                    <system>1</system>
                    <ignore>1</ignore>
                </created_in>
                <website_id>
                    <system>1</system>
                </website_id>
                <default_billing>
                    <system>1</system>
                </default_billing>
                <default_shipping>
                    <system>1</system>
                </default_shipping>
                <prefix>
                    <billing>1</billing>
                    <shipping>1</shipping>
                    <mapped>1</mapped>
                </prefix>
                <firstname>
                    <billing>1</billing>
                    <shipping>1</shipping>
                    <required>1</required>
                    <mapped>1</mapped>
                </firstname>
                <middlename>
                    <billing>1</billing>
                    <shipping>1</shipping>
                    <mapped>1</mapped>
                </middlename>
                <lastname>
                    <billing>1</billing>
                    <shipping>1</shipping>
                    <required>1</required>
                    <mapped>1</mapped>
                </lastname>
                <suffix>
                    <billing>1</billing>
                    <shipping>1</shipping>
                    <mapped>1</mapped>
                </suffix>
                <street_full>
                    <billing>1</billing>
                    <shipping>1</shipping>
                </street_full>
                <street1>
                    <billing>1</billing>
                    <shipping>1</shipping>
                    <street>1</street>
                </street1>
                <street2>
                    <billing>1</billing>
                    <shipping>1</shipping>
                    <street>1</street>
                </street2>
                <street3>
                    <billing>1</billing>
                    <shipping>1</shipping>
                    <street>1</street>
                </street3>
                <street4>
                    <billing>1</billing>
                    <shipping>1</shipping>
                    <street>1</street>
                </street4>
                <street5>
                    <billing>1</billing>
                    <shipping>1</shipping>
                    <street>1</street>
                </street5>
                <street6>
                    <billing>1</billing>
                    <shipping>1</shipping>
                    <street>1</street>
                </street6>
                <street7>
                    <billing>1</billing>
                    <shipping>1</shipping>
                    <street>1</street>
                </street7>
                <street8>
                    <billing>1</billing>
                    <shipping>1</shipping>
                    <street>1</street>
                </street8>
                <city>
                    <billing>1</billing>
                    <shipping>1</shipping>
                </city>
                <region>
                    <billing>1</billing>
                    <shipping>1</shipping>
                </region>
                <country>
                    <billing>1</billing>
                    <shipping>1</shipping>
                    <billing_required>1</billing_required>
                    <shipping_required>1</shipping_required>
                </country>
                <postcode>
                    <billing>1</billing>
                    <shipping>1</shipping>
                    <billing_required>1</billing_required>
                    <shipping_required>1</shipping_required>
                </postcode>
                <telephone>
                    <billing>1</billing>
                    <shipping>1</shipping>
                </telephone>
                <company>
                    <billing>1</billing>
                    <shipping>1</shipping>
                </company>
                <fax>
                    <billing>1</billing>
                    <shipping>1</shipping>
                </fax>
            </customer_dataflow>
        </fieldsets>
    </admin>
    <global>
        <fieldsets>
            <customer_account>
                <prefix>
                    <create>1</create>
                    <update>1</update>
                    <name>1</name>
                </prefix>
                <firstname>
                    <create>1</create>
                    <update>1</update>
                    <name>1</name>
                </firstname>
                <middlename>
                    <create>1</create>
                    <update>1</update>
                    <name>1</name>
                </middlename>
                <lastname>
                    <create>1</create>
                    <update>1</update>
                    <name>1</name>
                </lastname>
                <suffix>
                    <create>1</create>
                    <update>1</update>
                    <name>1</name>
                </suffix>
                <email>
                    <create>1</create>
                    <update>1</update>
                </email>
                <password>
                    <create>1</create>
                </password>
                <confirmation>
                    <create>1</create>
                </confirmation>
                <dob>
                    <create>1</create>
                    <update>1</update>
                </dob>
                <taxvat>
                    <create>1</create>
                    <update>1</update>
                </taxvat>
                <gender>
                    <create>1</create>
                    <update>1</update>
                </gender>
            </customer_account>
            <customer_address>
                <vat_id>
                    <to_quote_address>*</to_quote_address>
                </vat_id>
                <vat_is_valid>
                    <to_quote_address>*</to_quote_address>
                </vat_is_valid>
                <vat_request_id>
                    <to_quote_address>*</to_quote_address>
                </vat_request_id>
                <vat_request_date>
                    <to_quote_address>*</to_quote_address>
                </vat_request_date>
                <vat_request_success>
                    <to_quote_address>*</to_quote_address>
                </vat_request_success>
            </customer_address>
            <sales_convert_order_address>
                <vat_id>
                    <to_quote_address>*</to_quote_address>
                </vat_id>
                <vat_is_valid>
                    <to_quote_address>*</to_quote_address>
                </vat_is_valid>
                <vat_request_id>
                    <to_quote_address>*</to_quote_address>
                </vat_request_id>
                <vat_request_date>
                    <to_quote_address>*</to_quote_address>
                </vat_request_date>
                <vat_request_success>
                    <to_quote_address>*</to_quote_address>
                </vat_request_success>
            </sales_convert_order_address>
            <sales_convert_quote_address>
                <vat_id>
                    <to_order_address>*</to_order_address>
                    <to_customer_address>*</to_customer_address>
                </vat_id>
                <vat_is_valid>
                    <to_order_address>*</to_order_address>
                    <to_customer_address>*</to_customer_address>
                </vat_is_valid>
                <vat_request_id>
                    <to_order_address>*</to_order_address>
                    <to_customer_address>*</to_customer_address>
                </vat_request_id>
                <vat_request_date>
                    <to_order_address>*</to_order_address>
                    <to_customer_address>*</to_customer_address>
                </vat_request_date>
                <vat_request_success>
                    <to_order_address>*</to_order_address>
                    <to_customer_address>*</to_customer_address>
                </vat_request_success>
            </sales_convert_quote_address>
            <sales_copy_order_billing_address>
                <vat_id>
                    <to_order>*</to_order>
                </vat_id>
                <vat_is_valid>
                    <to_order>*</to_order>
                </vat_is_valid>
                <vat_request_id>
                    <to_order>*</to_order>
                </vat_request_id>
                <vat_request_date>
                    <to_order>*</to_order>
                </vat_request_date>
                <vat_request_success>
                    <to_order>*</to_order>
                </vat_request_success>
            </sales_copy_order_billing_address>
        </fieldsets>
        <customer>
            <address>
                <formats>
                    <text translate="title" module="customer">
                        <title>Text</title>
                    </text>
                    <oneline translate="title" module="customer">
                        <title>Text One Line</title>
                    </oneline>
                    <html translate="title" module="customer">
                        <title>HTML</title>
                        <htmlEscape>true</htmlEscape>
                    </html>
                    <pdf translate="title" module="customer">
                        <title>PDF</title>
                    </pdf>
                    <js_template template="title" module="customer">
                        <title>JavaScript Template</title>
                    </js_template>
                </formats>
            </address>
        </customer>
        <blocks>
            <customer>
                <class>Mage_Customer_Block</class>
            </customer>
        </blocks>
        <models>
            <customer>
                <class>Mage_Customer_Model</class>
                <resourceModel>customer_resource</resourceModel>
            </customer>
            <customer_resource>
                <class>Mage_Customer_Model_Resource</class>
                <deprecatedNode>customer_mysql4</deprecatedNode>
                <entities>
                    <entity>
                        <table>customer_entity</table>
                    </entity>
                    <address_entity>
                        <table>customer_address_entity</table>
                    </address_entity>
                    <value_prefix>
                        <table>customer_entity</table>
                    </value_prefix>
                    <customer_group>
                        <table>customer_group</table>
                    </customer_group>
                    <eav_attribute>
                        <table>customer_eav_attribute</table>
                    </eav_attribute>
                    <eav_attribute_website>
                        <table>customer_eav_attribute_website</table>
                    </eav_attribute_website>
                    <form_attribute>
                        <table>customer_form_attribute</table>
                    </form_attribute>
                </entities>
            </customer_resource>
        </models>
        <resources>
            <customer_setup>
                <setup>
                    <module>Mage_Customer</module>
                    <class>Mage_Customer_Model_Resource_Setup</class>
                </setup>
            </customer_setup>
        </resources>
        <template>
            <email>
                <customer_create_account_email_template translate="label" module="customer">
                    <label>New account</label>
                    <file>account_new.html</file>
                    <type>html</type>
                </customer_create_account_email_template>
                <customer_create_account_email_confirmation_template translate="label" module="customer">
                    <label>New account confirmation key</label>
                    <file>account_new_confirmation.html</file>
                    <type>html</type>
                </customer_create_account_email_confirmation_template>
                <customer_create_account_email_confirmed_template translate="label" module="customer">
                    <label>New account confirmed</label>
                    <file>account_new_confirmed.html</file>
                    <type>html</type>
                </customer_create_account_email_confirmed_template>
                <customer_password_forgot_email_template translate="label" module="customer">
                    <label>Forgot Password</label>
                    <file>account_password_reset_confirmation.html</file>
                    <type>html</type>
                </customer_password_forgot_email_template>
                <customer_password_remind_email_template translate="label" module="customer">
                    <label>Remind Password</label>
                    <file>password_new.html</file>
                    <type>html</type>
                </customer_password_remind_email_template>
            </email>
        </template>
        <events>
            <customer_address_save_before>
                <observers>
                    <customer_address_before_save_viv_observer>
                        <class>customer/observer</class>
                        <method>beforeAddressSave</method>
                    </customer_address_before_save_viv_observer>
                </observers>
            </customer_address_save_before>
            <customer_address_save_after>
                <observers>
                    <customer_addres_after_save_viv_observer>
                        <class>customer/observer</class>
                        <method>afterAddressSave</method>
                    </customer_addres_after_save_viv_observer>
                </observers>
            </customer_address_save_after>
        </events>
    </global>

Re: Cannot create a custom page on account dashboard

part 2:

    <adminhtml>
        <translate>
            <modules>
                <Mage_Customer>
                    <files>
                        <default>Mage_Customer.csv</default>
                    </files>
                </Mage_Customer>
            </modules>
        </translate>
    </adminhtml>
    <frontend>
        <secure_url>
            <customer>/customer/</customer>
        </secure_url>
        <events>
            <controller_action_layout_load_before>
                <observers>
                    <customer_is_logged_in_observer>
                        <class>customer/observer</class>
                        <method>beforeLoadLayout</method>
                    </customer_is_logged_in_observer>
                </observers>
            </controller_action_layout_load_before>
            <sales_model_service_quote_submit_after>
                <observers>
                    <restore_customer_group_id>
                        <class>customer/observer</class>
                        <method>quoteSubmitAfter</method>
                    </restore_customer_group_id>
                </observers>
            </sales_model_service_quote_submit_after>
        </events>
        <routers>
            <customer>
                <use>standard</use>
                <args>
                    <module>Mage_Customer</module>
                    <frontName>customer</frontName>
                </args>
            </customer>
        </routers>
        <translate>
            <modules>
                <Mage_Customer>
                    <files>
                        <default>Mage_Customer.csv</default>
                    </files>
                </Mage_Customer>
            </modules>
        </translate>
        <layout>
            <updates>
                <customer module="Mage_Customer">
                    <file>customer.xml</file>
                </customer>
            </updates>
        </layout>
    </frontend>
    <default>
        <customer>
            <account_share>
                <scope>1</scope>
            </account_share>
            <create_account>
                <confirm>0</confirm>
                <default_group>1</default_group>
                <tax_calculation_address_type>billing</tax_calculation_address_type>
                <email_domain>example.com</email_domain>
                <email_identity>general</email_identity>
                <email_template>customer_create_account_email_template</email_template>
                <email_confirmation_template>customer_create_account_email_confirmation_template</email_confirmation_template>
                <email_confirmed_template>customer_create_account_email_confirmed_template</email_confirmed_template>
                <vat_frontend_visibility>0</vat_frontend_visibility>
            </create_account>
            <default>
                <group>1</group>
            </default>
            <password>
                <forgot_email_identity>support</forgot_email_identity>
                <forgot_email_template>customer_password_forgot_email_template</forgot_email_template>
                <remind_email_template>customer_password_remind_email_template</remind_email_template>
                <reset_link_expiration_period>1</reset_link_expiration_period>
                <require_admin_user_to_change_user_password>1</require_admin_user_to_change_user_password>
            </password>
            <address>
                <street_lines>2</street_lines>
                <prefix_show/>
                <prefix_options/>
                <middlename_show>1</middlename_show>
                <suffix_show/>
                <suffix_options/>
                <dob_show/>
                <gender_show/>
            </address>
            <startup>
                <redirect_dashboard>1</redirect_dashboard>
            </startup>
            <address_templates>
                <text>{{depend prefix}}{{var prefix}} {{/depend}}{{var firstname}} {{depend middlename}}{{var middlename}} {{/depend}}{{var lastname}}{{depend suffix}} {{var suffix}}{{/depend}}
{{depend company}}{{var company}}{{/depend}}
{{if street1}}{{var street1}}
{{/if}}
{{depend street2}}{{var street2}}{{/depend}}
{{depend street3}}{{var street3}}{{/depend}}
{{depend street4}}{{var street4}}{{/depend}}
{{if city}}{{var city}},  {{/if}}{{if region}}{{var region}}, {{/if}}{{if postcode}}{{var postcode}}{{/if}}
{{var country}}
T: {{var telephone}}
{{depend fax}}F: {{var fax}}{{/depend}}
{{depend vat_id}}VAT: {{var vat_id}}{{/depend}}</text>
                <oneline>{{depend prefix}}{{var prefix}} {{/depend}}{{var firstname}} {{depend middlename}}{{var middlename}} {{/depend}}{{var lastname}}{{depend suffix}} {{var suffix}}{{/depend}}, {{var street}}, {{var city}}, {{var region}} {{var postcode}}, {{var country}}</oneline>
                <html><![CDATA[{{depend prefix}}{{var prefix}} {{/depend}}{{var firstname}} {{depend middlename}}{{var middlename}} {{/depend}}{{var lastname}}{{depend suffix}} {{var suffix}}{{/depend}}<br/>
{{depend company}}{{var company}}<br />{{/depend}}
{{if street1}}{{var street1}}<br />{{/if}}
{{depend street2}}{{var street2}}<br />{{/depend}}
{{depend street3}}{{var street3}}<br />{{/depend}}
{{depend street4}}{{var street4}}<br />{{/depend}}
{{if city}}{{var city}},  {{/if}}{{if region}}{{var region}}, {{/if}}{{if postcode}}{{var postcode}}{{/if}}<br/>
{{var country}}<br/>
{{depend telephone}}T: {{var telephone}}{{/depend}}
{{depend fax}}<br/>F: {{var fax}}{{/depend}}
{{depend vat_id}}<br/>VAT: {{var vat_id}}{{/depend}}]]></html>
                <pdf><![CDATA[{{depend prefix}}{{var prefix}} {{/depend}}{{var firstname}} {{depend middlename}}{{var middlename}} {{/depend}}{{var lastname}}{{depend suffix}} {{var suffix}}{{/depend}}|
{{depend company}}{{var company}}|{{/depend}}
{{if street1}}{{var street1}}
{{/if}}
{{depend street2}}{{var street2}}|{{/depend}}
{{depend street3}}{{var street3}}|{{/depend}}
{{depend street4}}{{var street4}}|{{/depend}}
{{if city}}{{var city}},|{{/if}}
{{if region}}{{var region}}, {{/if}}{{if postcode}}{{var postcode}}{{/if}}|
{{var country}}|
{{depend telephone}}T: {{var telephone}}{{/depend}}|
{{depend fax}}<br/>F: {{var fax}}{{/depend}}|
{{depend vat_id}}<br/>VAT: {{var vat_id}}{{/depend}}|]]></pdf>
                <js_template><![CDATA[#{prefix} #{firstname} #{middlename} #{lastname} #{suffix}<br/>#{company}<br/>#{street0}<br/>#{street1}<br/>#{street2}<br/>#{street3}<br/>#{city}, #{region}, #{postcode}<br/>#{country_id}<br/>T: #{telephone}<br/>F: #{fax}<br/>VAT: #{vat_id}]]></js_template>
            </address_templates>
        </customer>
    </default>
</config>

Re: Cannot create a custom page on account dashboard

Hi @billyChanVG

 

I found error in your layout.xml please see the opening and closing tag of

<customer_training_index >
......
......
</customer_training> // Error Please use </customer_training_index> to close
Let me know if it helps. You can raise a KUDOS if its really worth for you. Also if it solves your problem then please mark as SOLUTION.