1

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

asked Oct 16, 2015 at 12:05

1 Answer 1

0

you missed the router for frontend add if outside of global tag

<frontend>
 <routers>
 <CustomerAttribute>
 <use>standard</use>
 <args>
 <module>Atropos_CustomerAttribute</module>
 <frontName>customerattribute</frontName>
 </args>
 </CustomerAttribute>
 </routers>
 </frontend>
answered Oct 16, 2015 at 12:17
7
  • Oh, no no its there. I'll update the original code, pls wait. Commented Oct 16, 2015 at 12:41
  • Dear Qaisar, can you please recheck your answer? That would mean a lot to me, thank you very much in advance! Commented Oct 19, 2015 at 12:42
  • i will sort this for you today Commented Oct 19, 2015 at 12:47
  • Do you have any updates on this? :) Commented Oct 20, 2015 at 11:39
  • not now did not tried yet can you paste your all files Commented Oct 20, 2015 at 11:42

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.