The problem: I have a scenario where I need my customer to have an extra tab in their account settings panel (left sidebar). The content of this tab should be defined in /app/design/frontend/$namespace/$template/templates/atropos/customer/view.phtml. The content of the file is currently a lot of Lorem Ipsum-text.
Here are my files:
local.xml /app/design/frontend/$namespace/$template/layout/local.xml
<layout>
...
<customer_account>
<reference name="customer_account_navigation">
<action method="addLink" translate="label" module="CustomerAttribute">
<name>CustomerAttribute</name>
<path>customerattribute/customer/view</path>
<label>JarEinstellungen bearbeiten</label>
</action>
</reference>
</customer_account>
<CustomerAttribute>
<update handle="CustomerAttribute"/>
<reference name="content">
<block type="CustomerAttribute/customer" name="view.CustomerAttribute" template="atropos/customer/view.phtml"/>
</reference>
</CustomerAttribute>
...
</layout>
I assumed that the MVC will now load the template, which is located on /app/design/frontend/$namespace/$template/template/atropos/customer/view.phtml. This is not the case, and also this is the problem, which I cannot sort out quiet yet.
config.xml /app/code/local/Atropos/CustomerAttribute/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Atropos_CustomerAttribute>
<version>0.1.0</version>
</Atropos_CustomerAttribute>
</modules>
<frontend>
<routers>
<customerattribute>
<use>standard</use>
<args>
<module>Atropos_CustomerAttribute</module>
<frontName>customerattribute</frontName>
</args>
</customerattribute>
</routers>
<layout>
<updates>
<customerattribute>
<file>customerattribute.xml</file>
</customerattribute>
</updates>
</layout>
</frontend>
<global>
<helpers>
<CustomerAttribute>
<class>Atropos_CustomerAttribute_Helper</class>
</CustomerAttribute>
</helpers>
<blocks>
<CustomerAttribute>
<class>Atropos_CustomerAttribute_Block</class>
</CustomerAttribute>
</blocks>
<models>
<CustomerAttribute>
<class>Atropos_CustomerAttribute_Model</class>
<resourceModel>customerattribute_mysql4</resourceModel>
</CustomerAttribute>
</models>
<resources>
<customerattribute1444918007_setup>
<setup>
<module>Atropos_CustomerAttribute</module>
<class>Mage_Customer_Model_Entity_Setup</class>
</setup>
<connection>
<use>core_setup</use>
</connection>
</customerattribute1444918007_setup>
<customerattribute1444918007_write>
<connection>
<use>core_write</use>
</connection>
</customerattribute1444918007_write>
<customerattribute1444918007_read>
<connection>
<use>core_read</use>
</connection>
</customerattribute1444918007_read>
</resources>
</global>
</config>
Someone might see here that I used the Magento Module Generator to get the code since I'm not a Magento Pro yet.
Data.php /app/code/local/Atropos/CustomerAttribute/Helper/Data.php
<?php
class Atropos_CustomerAttribute_Helper_Data extends Mage_Core_Helper_Abstract
{
}
CustomerController.php /app/code/local/Atropos/CustomerAttribute/controllers/CustomerController.php
<?php
class Atropos_CustomerAttribute_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('customerattribute')->__('Please sign in or create a new account'));
}
}
/**
* View Your Module
*/
public function viewAction()
{
$this->loadLayout();
$this->getLayout()->getBlock('head')->setTitle($this->__('JarEinstellungen bearbeiten'));
$this->renderLayout();
}
}
My Question is now: what did I've done wrong. Any typo error? I can't see anything here. Again, I'm by far not experienced with Magento, just doing baby steps to become Marius.
I would appreciate any helpful tips! Thank you