2011-07-13 15 views
1

magentoのcustomerダッシュボードページにcustom.cssファイルへの参照を追加しようとしたことはありませんでした。それは、ネイビーシールの目で、マゼンタを狙いたい。ドキュメントによるとMagentoの単一ページのCSSリファレンスを挿入する最も良い方法

、動作するはずでcustomer.xmlをに挿入し、次のいずれか:前に、このブロックを挿入

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

:(

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

それは静かに失敗するエラーなし、まったく処理されなかったかのように)

の後に番目Eブロックは、私が「無効なメソッドMage_Customer_Block_Account_Dashboard :: addCss(配列([0] => CSS/dashboardfix.css))エラーが出ます

dashboardfix.cssは私の他の資産とのskinname/CSSのフォルダ内にあります。

アイデア?

答えて

2

コードにマイナーシンタックスエラーがありました。下記の修正コードをご覧ください。

また、これを動作させるには、macguffin.cssファイルをstyles.css(またはboxes.css)と同じcssフォルダ、つまりテーマのcssフォルダに配置する必要があります。

また、CSSファイルのキャッシュとマージをオフにして、正しく動作するようにすることもできます。限り、あなたのCSSファイルがmacguffin.cssと呼ばれて、それはすべてがうまくうまくいく、

<!-- 
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> 

はただ覚えている:ここで

は、あなたが完全なブロックを持っていなければならない方法です。

+0

ありがとうございます!それはうまくいった。あなたの応答を見る前に、私は$ headBlock = $ this-> getLayout() - > getBlock( 'head')で.phtmlファイルで作業していました。 $ headBlock-> getSkinUrl( 'css/dashboardfix.css');あなたの解決策は、しかし、エレガントなものです。私は似たような試みをしましたが、blocktype = page_headで、reference = headではありませんでした。再度、感謝します! – ScottyDont

関連する問題