1

i need to add the orange block on 2 column customer account,

what is the best way to adding that block, if i do from the 2 column left phtml, just scared it will shown at all 2column type, from local xml, but i am not sure about the code

any suggestion will be appreciate, Thanks

enter image description here

2

4 Answers 4

3

What you could do would be for the customer account page, I assume the default, handle customer_account_index. Use a different template, so you know that this will only appear on this one page, and then add the block inside the root reference also.

<customer_account_index>
    <reference name="root">
        <action method="setTemplate"><template>your/new/template.phtml</template></action>
        <!-- Add your new block here -->
    </reference>
</customer_account_index>
1

This is possible with CMS configuration only and no code:

  1. Create a static block for the content (the orange block)

  2. Create a new widget instance (CMS > Widgets) and select your theme screenshot (2)

  3. Add Layout Update for page "Customer My Account (All Pages)" and reference "Page Header" screenshot (3)

  4. Select static block from (1) in "Widget Options": screenshot (4)

  5. Save.

  6. Clean cache.

0

let me explain magento blocks in details hope it will help you to understand complete block mechanism

Everything in magento is a module , so all the modules have their controllers which are used for url routing system . lets take an example of url e.g http://example.com/index.php/customer/account/index/

module routes in this way module_controller_action

as you can see here module is customer , controller is accountcontroller and action is indexaction (all magento controller action works in this manner e,g editAction = edit on URL deleteAction = delete). You can verify by visiting this path /app/code/core/Mage/Customer/controllers

also related xml can be found under /app/design/frontend/base/default/layout customer.xml

Magento Reference Block

Now its time to explain reference block as its name suggests reference block is help ful to give a reference to your block . Suppose you want to integrate your block in left postion of the store then you can easily call

<reference name="left">
<block type="core/template" after="-"
name="sleek" template ="Sleekaccordian/new.phtml" /></reference>

Reference Action Method

Under reference tag we can call functions as well using action method as per the given example for newsletter.xml

<reference name="customer_account_navigation">
<action method="addLink" translate="label" module="newsletter">
<name>newsletter</name><path>newsletter/manage/</path>
<label>Newsletter Subscriptions</label></action>
</reference>

this reference (customer_account_navigation) is defined under customer.xml

<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>
</block>

now as per the block class if you’ll visit

/app/code/core/Mage/Customer/Block/Account then you’ll find addLink function under Navigation.php

0
<customer_account_index  translate="label">
    <reference name="my.account.wrapper">
        <block type="customer/account_dashboard_users" name="customer_account_dashboard_users" template="customer/account/dashboard/users.phtml" as="dashboardusers"/>
    </reference>
</customer_account_index>

Above is just an example. This will call users.phtml file on dashboard

Your Answer

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

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