How do I add a new page to the customer account dashboard? - magento

I have edited the customer.xml file to add a new link to the dashboard page. I added the following line
<action method="addLink" translate="label" module="customer"><name>newpage</name><path>customer/newpage/</path><label>My New Page</label></action>
I've also added the following block to customer.xml
<customer_newpage_index translate="label">
<label>Customer My newpage</label>
<!-- Mage_Customer -->
<update handle="newpage"/>
<reference name="my.account.wrapper">
<block type="customer/newpage" name="newpage" before="-" template="customer/newpage.phtml"/>
</reference>
</customer_newpage_index>
And added a template file at template/customer/newpage.phtml
The link displays, but I get a 404 page when I view /customer/newpage/
What am I missing here?
Thanks

You need to add a controller called NewpageController.php and in it have an action called indexAction. It is probably not a good idea to add this controller inside of the Customer module, because that is in core, and we never touch core. Instead, what you probably want to do is create your own module and put the controller inside of that. It can still be added as one of the links to the sidebar like you have done, but from the outside so that when you upgrade Magento you won't lose your controller.

Related

How do I add a new block to my layout in magento 1.9?

I have a beginner question on layouts ...After reading a lot about layouts, i am more confused than where i started. I want to add a banner block that will be displayed on my home page and a few other pages. I decided that it cannot be a part of the header.
I want to add this right below the header. I am trying to create my layout via bootstrap. I see in some themes that this is done inside the cms.xml file and i am not sure why i need to edit that. Clearly, i am confused..
Any help would be appreciated.
Go to your theme
app/design/frontend/Your-Package/Your-Theme/layout/local.xml
add below code:
<?xml version="1.0"?>
<layout version="0.1.0">
<cms_index_index>
<reference name="content">
<block type="core/template" name="banner" before="-" template="banner/banner.phtml" />
</reference>
</cms_index_index>
</layout>
add banner.phtml file to
app/design/frontend/Your-Package/Your-Theme/template/banner/banner.phtml
add your banner in above file
To add a block to any other page replace <cms_index_index> with <routname_controllername_actionname> For example, <catalog_product_view>.

Display my account navigation links

I have created custom page and added that link to my account page. But if I click on that link side bar disappears. How can I show my account navigation sidebar in my custom module page?
use update handle e.g.
<layout>
<cevent_index_index> --- your custom module handle in layout.xml
<update handle="customer_account"/> -- check customer.xml
<reference name="my.account.wrapper"> ---- block in customer_account handle
<block type="cevent/cevent" name="cevent" template="cevent/cevent.phtml"/>
</reference>
</cevent_index_index>
</layout>

Magento Google Analytics Content Experiments

What is the simplest way to implement Google Analytics Content Experiment into Magento CE?
I want to test home page content.
Adding the Testing Code to CMS pages does not work. Testing Tag is after Analytics Tag.
Does Magento support adding the Testing Tag via admin Interface?
Or is there a simple way to add the tag via XML Layout Update?
Would it be possible to use Google Tag Manager to add the codes we need?
Tags could be installed after body like:
Add to local.xml in your layout folder following code:
<?xml version="1.0" encoding="UTF-8"?>
<!--
Last loaded layout file
-->
<layout>
<default>
<reference name="after_body_start">
<block type="cms/block" name="tags-first-in-body" before="-">
<action method="setBlockId"><block_id>tags-first-in-body</block_id></action>
</block>
</reference>
</default>
</layout>
and add a static block called tags-first-in-body.
Insert code to this block.

Magento - changes to template file not showing up - /customer/form/register.phml

I'm making some changes to /customer/form/register.phml but they are not showing up in the frontend. Changes that I made to login.phtml and forgotpassword.phtml do show up.
I checked if magento was using a fallback from the base/default theme but it's not. I deleted register.phtml in both my theme and in the base/default theme to check what would happen: the page showed up just fine (without the changes of course).
I looks like magento gets the file from somewhere else (maybe the core). I've got no idea on how to solve this.
Thanks in advance for your help.
My Customer.xml file looks like this, I'm using magento 1.5.1
<customer_account_create translate="label">
<label>Customer Account Registration Form</label>
<remove name="right"/>
<remove name="left"/>
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
<reference name="content">
<block type="customer/form_register" name="customer_form_register" template="customer/form/register.phtml">
<block type="page/html_wrapper" name="customer.form.register.fields.before" as="form_fields_before" translate="label">
<label>Form Fields Before</label>
</block>
</block>
</reference>
</customer_account_create>
The best way to debug this - is to turn on template path hints.
You probably need to edit template/persistent/customer/form/register.phtml.
Yes i agree with WebFlake turn on template hints that will let you know which template file the form is being pulled from, most likely you are modifying the wrong template.
Here is a link which explains how to turn on template hints: http://vimeo.com/1067069
Use the template hints. Also, with any phtml changes you make, make sure that you have caching disabled, and flush all caches (System -> Cache Management).
I used template hints and discovered a plugin replaced the file. Enabling template hints: http://vimeo.com/1067069 helped a lot

Magento custom theme template file not used 1.6

I have a custom magento template which im trying to tweak and just have a question regarding templates.
Currently the customer login uses the base .phtml file.
So I have created the customer/form/login.phtml file and placed it in my CUSTOM theme folder.
Then in my custom theme folder I went into layouts and and customer.xml. This is where in not sure what I need to do.
I found the following XML code:
<customer_account_login translate="label">
<label>Customer Account Login Form</label>
<!-- Mage_Customer -->
<remove name="right"/>
<remove name="left"/>
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
<reference name="content">
<block type="customer/form_login" name="customer_form_login" template="customer/form/login.phtml"/>
</reference>
</customer_account_login>
Im not sure what I need to change with this to make it use my custom login form instead of using the base login form.
At first I thought the system would automatically check to see if the file exists in custom and just apply and if it doesnt exist fall back on base template but that didnt seen to work.
Any help would be appreciated. A noob explanation would also be great!
Thanks for reading
Magento seems to use a login file from:
template/persistent/checkout/onepage/login.phtml
In version 1.6 of Magento.
Edited that and the changes appeared as expected. Sorry but i also just found this post
In Magento 1.6, changes to login.phtml don’t reflect
Mine seems to be a dupe (sorry I didnt come across it when searching before) so feel free to close this one :)

Resources