Have had no luck trying to add a reference to a custom.css开发者_JAVA技巧 file to the customer dashboard page in Magento. It makes me want to shoot Magento in the eye, Navy SEAL style.
According to the docs, either of the following inserted into customer.xml in should work:
<reference name="customer_account_dashboard">
<action method="addCss"><link>dashboardfix.css</link></action>
</reference>
<reference name="customer_account_dashboard">
<action method="addCss"><stylesheet>css/dashboardfix.css</stylesheet></action>
</reference>
When inserted before this block:
<reference name="my.account.wrapper">
<block type="customer/account_dashboard" name="customer_account_dashboard" template="customer/account/dashboard.phtml">
<block type="customer/account_dashboard_hello" name="customer_account_dashboard_hello" as="hello" template="customer/account/dashboard/hello.phtml"/>
<block type="core/template" name="customer_account_dashboard_top" as="top" />
<block type="customer/account_dashboard_info" name="customer_account_dashboard_info" as="info" template="customer/account/dashboard/info.phtml"/>
<block type="customer/account_dashboard_newsletter" name="customer_account_dashboard_newsletter" as="newsletter" template="customer/account/dashboard/newsletter.phtml"/>
<block type="clientname/account_dashboard_address" name="customer_account_dashboard_address" as="address" template="customer/account/dashboard/address.phtml"/>
</block>
</reference>
It fails silently (no errors, its as if it wasn't processed at all)
When inserted after the block, I get an "Invalid method Mage_Customer_Block_Account_Dashboard::addCss(Array ( [0] => css/dashboardfix.css )) error
dashboardfix.css is in the skinname/css folder with my other assets.
Any ideas?
There was a minor syntax error in your code - see corrected code below.
Also, for this to work you need macguffin.css
file to be placed in the same css folder as your styles.css (or boxes.css), i.e. the css folder of your theme.
You may also want to turn off caching and merging of css files to make sure this is working correctly.
Here is how you should have the complete block:
<!--
Customer account pages, rendered for all tabs in dashboard
-->
<customer_account translate="label">
<label>Customer My Account (All Pages)</label>
<!-- Mage_Customer -->
<reference name="head">
<action method="addCss"><stylesheet>css/macguffin.css</stylesheet></action>
</reference>
<reference name="root">
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
</reference>
<reference name="content">
<block type="page/html_wrapper" name="my.account.wrapper" translate="label">
<label>My Account Wrapper</label>
<action method="setElementClass"><value>my-account</value></action>
</block>
</reference>
<reference name="left">
<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>
<remove name="tags_popular"/>
</reference>
</customer_account>
Just remember, so long as your css file is called macguffin.css
it will all work out just fine.
精彩评论