2009-07-06 5 views
9

고객의 "내 계정"페이지에서 제대로 작동하도록 customer.xml 레이아웃 파일을 가져 오는 데 문제가 있습니다.Magento 내 계정 레이아웃 XML 문제

일반적으로 페이지의 왼쪽에있는 탐색 링크와 이전에 주문한 항목은 페이지에 표시되지 않지만 xml 파일에서 참조 이름을 "content"로 변경하면 (그것은 분명히 그 다음 오른쪽에있다). 내가 참조하는 템플릿 (2columns-left.phtml)을 확인한 후 getChildHtml ('left')이 올바른 위치에 있습니다. 문제를 일으키는

블록 : 이것은 기본적으로이 100 % 작동 우리 사이트의 또 다른 하나에서 바로 복사 된

<customer_account> 
    <!-- Mage_Customer --> 
    <reference name="root"> 
     <action method="setTemplate"><template>page/2columns-left.phtml</template></action> 
    </reference> 

    <reference name="left"> 
     <action method="unsetChild"><name>catalog.navigation.all</name></action> 
     <action method="unsetChild"><name>callout.sendcard</name></action> 
     <action method="unsetChild"><name>callout.specialorder</name></action> 
     <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> 
     <block type="sales/reorder_sidebar" name="sale.reorder.sidebar" as="reorder" template="sales/reorder/sidebar.phtml"/> 
     <remove name="tags_popular"/> 
    </reference> 
</customer_account> 

. 나는 내가 생각할 수있는 모든 것을 시도했다. (예를 들어 템플릿과 레이아웃 xml 모두에서 참조 이름을 바꾼다.) 아무 소용이 없다. 레이아웃이 참조하는 템플릿은 "컨텐츠"영역에 배치 될 때 나타나기 때문에 명백하게 작동합니다.

이 magento 설치는 버전 1.3.1.1입니다. 나는 "global_messages"에 대한 참조를 변경했는데, 그 중 하나가 표시되지 않습니다

난 당신이 내게 줄 필요가 조언 ...

업데이트를 주셔서 감사합니다. "콘텐츠"섹션에서만 작동하는 것 같습니다.

업데이트 2 : 다음은 앨런 스톰의 매우 편리한 디버깅 모듈을 사용하는 경우 페이지에서 "showLayout = 페이지"쿼리 문자열을 사용하는 결과 (아래 그의 대답에서 찾을 수있는)입니다.

<?xml version="1.0"?> 
<layout><block type="page/html" name="root" output="toHtml" template="page/3columns.phtml"> 
    <block type="page/html_head" name="head" as="head"> 
     <action method="addJs"> 
      <script>prototype/prototype.js</script> 
     </action> 
     <action method="addJs"> 
      <script>prototype/validation.js</script> 
     </action> 

     <action method="addJs"> 
      <script>paypoint/validation.js</script> 
     </action> 
     <action method="addJs"> 
      <script>scriptaculous/builder.js</script> 
     </action> 
     <action method="addJs"> 
      <script>scriptaculous/effects.js</script> 

     </action> 
     <action method="addJs"> 
      <script>scriptaculous/dragdrop.js</script> 
     </action> 
     <action method="addJs"> 
      <script>scriptaculous/controls.js</script> 
     </action> 
     <action method="addJs"> 

      <script>scriptaculous/slider.js</script> 
     </action> 
     <action method="addJs"> 
      <script>varien/js.js</script> 
     </action> 
     <action method="addJs"> 
      <script>varien/form.js</script> 

     </action> 
     <action method="addJs"> 
      <script>varien/menu.js</script> 
     </action> 
     <action method="addJs"> 
      <script>mage/translate.js</script> 
     </action> 
     <action method="addJs"> 

      <script>mage/cookies.js</script> 
     </action> 
     <action method="addCss"> 
      <stylesheet>css/reset.css</stylesheet> 
     </action> 
     <action method="addCss"> 
      <stylesheet>css/boxes.css</stylesheet> 

     </action> 
     <action method="addCss"> 
      <stylesheet>css/clears.css</stylesheet> 
     </action> 
     <action method="addCss"> 
      <stylesheet>css/menu.css</stylesheet> 
     </action> 
     <action method="addCss"> 

      <stylesheet>css/calendar-blue.css</stylesheet> 
     </action> 
     <action method="addCss"> 
      <stylesheet>css/styles.css</stylesheet> 
     </action> 
     <action method="addItem"> 
      <type>skin_css</type> 

      <name>css/iestyles.css</name> 
      <params/> 
      <if>IE</if> 
     </action> 
     <action method="addItem"> 
      <type>skin_css</type> 
      <name>css/ie7.css</name> 

      <params/> 
      <if>IE 7</if> 
     </action> 
     <action method="addItem"> 
      <type>skin_css</type> 
      <name>css/ie7minus.css</name> 
      <params/> 

      <if>lt IE 7</if> 
     </action> 
     <action method="addItem"> 
      <type>js</type> 
      <name>lib/ds-sleight.js</name> 
      <params/> 
      <if>lt IE 7</if> 

     </action> 
     <action method="addItem"> 
      <type>js</type> 
      <name>varien/iehover-fix.js</name> 
      <params/> 
      <if>lt IE 7</if> 
     </action> 

     <action method="addCss"> 
      <stylesheet>css/print.css</stylesheet> 
      <params>media="print"</params> 
     </action> 
    </block> 
    <block type="page/html_header" name="header" as="header"> 
     <block type="page/template_links" name="top.links" as="topLinks"/> 
     <block type="page/switch" name="store_language" as="store_language" template="page/switch/languages.phtml"/> 

     <block type="core/template" name="top.nav" template="page/html/top.nav.phtml"/> 
    </block> 
    <block type="core/messages" name="global_messages" as="global_messages"/> 
    <block type="core/messages" name="messages" as="messages"/> 
    <block type="core/text_list" name="content" as="content"/> 
    <block type="core/text_list" name="right" as="right"/> 
    <block type="page/html_footer" name="footer" as="footer" template="page/html/footer.phtml"/> 
    <block type="core/text_list" name="before_body_end" as="before_body_end"/> 
</block> 

<block type="core/profiler" output="toHtml"/> 
<reference name="top.links"> 
    <action method="addLink" translate="label title" module="customer"> 
     <label>My Account</label> 
     <url helper="customer/getAccountUrl"/> 
     <title>My Account</title> 
     <prepare/> 
     <urlParams/> 
     <position>10</position> 

    </action> 
</reference> 
<reference name="root"> 
    <action method="setTemplate"> 
     <template>page/2columns-left.phtml</template> 
    </action> 
</reference> 
<reference name="top.menu"> 
    <block type="catalog/navigation" name="catalog.topnav" template="catalog/navigation/top.phtml"/> 
</reference> 
<reference name="footer_links"> 

    <action method="addLink" translate="label title" module="catalog" ifconfig="catalog/seo/site_map"> 
     <label>Site Map</label> 
     <url helper="catalog/map/getCategoryUrl"/> 
     <title>Site Map</title> 
    </action> 
</reference> 
<reference name="footer_links"> 
    <action method="addLink" translate="label title" module="catalogsearch" ifconfig="catalog/seo/search_terms"> 
     <label>Search Terms</label> 

     <url helper="catalogsearch/getSearchTermUrl"/> 
     <title>Search Terms</title> 
    </action> 
    <action method="addLink" translate="label title" module="catalogsearch"> 
     <label>Advanced Search</label> 
     <url helper="catalogsearch/getAdvancedSearchUrl"/> 
     <title>Advanced Search</title> 

    </action> 
</reference> 
<reference name="top.links"> 
    <block type="checkout/links" name="checkout_cart_link"> 
     <action method="addCartLink"/> 
     <action method="addCheckoutLink"/> 
    </block> 
</reference> 
<reference name="footer"> 
    <block type="cms/block" name="cms_footer_links" before="footer_links"> 
     <action method="setBlockId"> 

      <block_id>footer_links</block_id> 
     </action> 
    </block> 
</reference> 
<reference name="left"> 
    <block type="tag/popular" name="tags_popular" template="tag/popular.phtm" ignore="1"> 
     <action method="setTemplate"> 
      <template>tag/popular.phtml</template> 
     </action> 

    </block> 
</reference> 
<reference name="left"> 

</reference> 
<reference name="before_body_end"> 
    <block type="googleanalytics/ga" name="google_analytics" as="google_analytics"/> 
</reference> 
<reference name="footer_links"> 
    <action method="addLink" translate="label title" module="contacts" ifconfig="contacts/contacts/enabled"> 
     <label>Contact Us</label> 

     <url>contact-us</url> 
     <title>Contact Us</title> 
     <prepare>true</prepare> 
    </action> 
</reference> 
<reference name="footer_links"> 
    <action method="addLink" translate="label title" module="rss" ifconfig="rss/config/active"> 
     <label>RSS</label> 

     <url>rss</url> 
     <title>RSS testing</title> 
     <prepare>true</prepare> 
     <urlParams/> 
     <position/> 
     <li/> 
     <a>class="link-feed"</a> 

    </action> 
</reference> 
<reference name="wishlist_sidebar"> 
    <action method="addPriceBlockType"> 
     <type>bundle</type> 
     <block>bundle/catalog_product_price</block> 
     <template>bundle/catalog/product/price.phtml</template> 
    </action> 

</reference> 
<reference name="cart_sidebar"> 
    <action method="addItemRender"> 
     <type>bundle</type> 
     <block>bundle/checkout_cart_item_renderer</block> 
     <template>checkout/cart/sidebar/default.phtml</template> 
    </action> 
</reference> 
<reference name="root"> 

    <action method="setTemplate"> 
     <template>page/2columns-left.phtml</template> 
    </action> 
</reference> 
<reference name="left"> 
    <action method="unsetChild"> 
     <name>catalog.navigation.all</name> 
    </action> 
    <action method="unsetChild"> 

     <name>callout.sendcard</name> 
    </action> 
    <action method="unsetChild"> 
     <name>callout.specialorder</name> 
    </action> 
    <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> 

    <block type="sales/reorder_sidebar" name="sale.reorder.sidebar" as="reorder" template="sales/reorder/sidebar.phtml"/> 
    <remove name="tags_popular"/> 
</reference> 
<reference name="customer_account_navigation"> 
    <action method="addLink" translate="label" module="sales"> 
     <name>orders</name> 
     <path>sales/order/history/</path> 
     <label>My Orders</label> 

    </action> 
</reference> 
<reference name="customer_account_navigation"> 
    <action method="addLink" translate="label" module="tag"> 
     <name>tags</name> 
     <path>tag/customer/</path> 
     <label>My Tags</label> 
    </action> 

</reference> 
<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> 
<reference name="cart_sidebar"> 

    <action method="addItemRender"> 
     <type>bundle</type> 
     <block>bundle/checkout_cart_item_renderer</block> 
     <template>checkout/cart/sidebar/default.phtml</template> 
    </action> 
</reference> 
<update handle="customer_account"/> 
<reference name="content"> 
    <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="customer/account_dashboard_address" name="customer_account_dashboard_address" as="address" template="customer/account/dashboard/address.phtml"/> 
     <block type="core/template" name="customer_account_dashboard_info1" as="info1"/> 
     <block type="core/template" name="customer_account_dashboard_info2" as="info2"/> 
    </block> 
</reference> 

<reference name="right"> 
    <action method="unsetChild"> 
     <name>catalog_compare_sidebar</name> 
    </action> 
</reference> 
<reference name="customer_account_dashboard"> 
    <action method="unsetChild"> 
     <name>top</name> 
    </action> 

    <block type="sales/order_recent" name="customer_account_dashboard_top" as="top" template="sales/order/recent.phtml"/> 
</reference> 
<reference name="right"> 
    <action method="unsetChild"> 
     <name>right.poll</name> 
    </action> 
</reference> 
<reference name="customer_account_dashboard"> 
    <action method="unsetChild"> 
     <name>customer_account_dashboard_info2</name> 

    </action> 
    <block type="tag/customer_recent" name="customer_account_dashboard_info2" as="info2" template="tag/customer/recent.phtml"/> 
</reference> 
<reference name="right"> 
    <action method="unsetChild"> 
     <name>right.newsletter</name> 
    </action> 
</reference> 
<reference name="top.links"> 
    <action method="addLink" translate="label title" module="customer"> 

     <label>Log Out</label> 
     <url helper="customer/getLogoutUrl"/> 
     <title>Log Out</title> 
     <prepare/> 
     <urlParams/> 
     <position>100</position> 
    </action> 

</reference></layout> 
+1

이상한. 나는 당신이 실수로 page.xml에서 "left"블록을 제거하지 않았거나 어딘가에 기본 섹션에서 설정을 해제하지 않았습니까? –

+0

레미, 알아 냈어? 오늘 아침에 귀하의 의견을 보았습니다. 그러나 제가 회신하기 위해 돌아 왔을 때 그것은 사라졌습니다. –

답변

19

처음으로 먼저. Magento 응용 프로그램 캐시를 지웠는지 확인하십시오. 모든 레이아웃 XML은 Magento에 의해 캐시되므로, 거기에 새 파일을 놓는 것은 변경 사항을 트리거하는 것으로 충분하지 않습니다.

왼쪽 열이 렌더링되지 않는 것처럼 들립니다. 다음은이

  1. 루트 템플릿에 대한 몇 가지 이유가 < 제거/> 태그는 그 재핑있어 어딘가에 레이아웃에 주입되는

  2. 두 개의 열 왼쪽 레이아웃이 아닌 다른 값으로 설정되는 위해의 왼쪽 열

  3. 그것이 제대로 렌더링 할 필요가 자식 블록이되지 않도록 귀하의 "왼쪽"블록이 무시되고

그래서 1 단계는이 중 3 가지를 파악하는 것입니다. 모든 PHP/PHTML 파일의 어떤 임의하지만 눈에 띄는 텍스트를 배치 (내가 < H1 같은쪽으로 경향이 > 하나 </H1 >, < H1 등 >이 </H1 >) 그래서 당신은 말할 수있는 파일이 실제로 로드 중입니다.

유사한 무언가를

System->Configuration->Developer->Debug->Template Path Hints 

에서 템플릿 디버그 설정이있다. 이를 사용하려면 특정 구성 범위로 드릴 다운해야합니다 (기본값으로 설정할 수 없음)

이 중 하나를 수행하는 것이 직접적인 문제를 지적하지는 않지만 (잘 만하면) 당신은 개별적인 원인을 배제하게됩니다.

레이아웃에 대해 유의해야 할 중요한 사항이 있습니다. XML 파일의 이름은 임의적입니다. 레이아웃 작업은 모두이고 레이아웃 XML은 하나의 거대한 XML 파일로 결합됩니다. 그런 다음 각 요청에 대해이 큰 XML 파일은 페이지 요청의 "처리"에 따라 줄어 듭니다. 핸들은 < 기본값 인 > 또는 <checkout_cart_index>과 같습니다. 즉, 다른 레이아웃 파일에있는 어떤 내용이 체크 아웃 페이지에서 이 아닌이 아닌 customer.xml의 문제 일 수 있습니다.

작업중인 Magento 사이트에 컨트롤러가 있거나 두 개가 덮어 쓰기되어 Magento가 페이지 요청으로 찾는 레이아웃 핸들을 변경할 수도 있습니다.

요점은 여러 가지가 원인 일 수 있으며 Magento의 내부를 들여다 볼 필요가 있습니다.

http://alanstorm.com/2005/projects/Layoutviewer.tar.gz

당신이 그것을 설치하고 실행해야 할 때, 다음과 같은 쿼리 문자열과 상점에서 페이지를로드 (그것이 내가 일하고 있어요 실험 디버깅 일이) 개발 환경에서이 모듈을 설치

http://magento.example.com/customer/account/?showLayout=handles 

모든 요청에서 magento가 사용하는 핸들을 표시합니다. 당신은 customer_account_index

  • STORE_bare_us
  • THEME_ \ frontend_default_default
  • 에게

    1. 기본처럼 무언가의 목록이 표시됩니다

    4 번 뭔가 다른 (companyname_modulename_customer_account_index)이면, 그 customer_logged_in 귀하의 사이트에이 요청에 대한 맞춤 컨트롤러가 있음을 의미합니다. 그렇다면 <companyname_modulename_customer_account_index> 내부의 레이아웃에서 원하는 태그를 무시하는 태그를 찾아야합니다.

    다음으로, 당신은 브라우저에서 렌더링되는 XML 파일을 볼 수 다음 쿼리 문자열

    http://magento.example.com/customer/account/?showLayout=page 
    

    이있는 Magento의 URL을로드합니다. 이것은 요청의 최종 레이아웃 XML입니다. 출력 속성을 가진 태그 (대부분라는 이름의 루트)에 대한 봐

    <block type="page/html" name="root" output="toHtml" template="page/2columns-left.phtml"> 
    

    는 출력 특성이 젠토는 렌더링 시작 템플릿을 의미합니다 설정합니다.두 열 레이아웃이 아닌 경우 문제 해결에 더 가깝습니다.

    다음이가이 속성을 무시하는 경우 루트 모듈 내부

    <block type="core/text_list" name="left" as="left" ignore="1"/> 
    

    을 왼쪽라는 모듈을 찾아, 아마 해당 태그 레이아웃 어딘가에

    <remove name="left"/> 
    

    에게있을 것입니다. 이걸 제거하고 싶을거야.

    또한 루트 블록에 실제로 이름이 left 인 하위 블록이 있는지 확인하십시오. showLayout 쿼리 문자열 매개 변수

    <block type="page/html" name="root" output="toHtml" ... > 
        ... 
        <block type="core/text_list" name="left" as "left" /> 
        ... 
    </block> 
    
    마지막으로

    , 이것은 더 전성 검사

    http://magento.example.com/checkout/cart/?showLayout=package 
    

    지정 "패키지"는 당신에게 당신의 전체 패키지 레이아웃을 보여줍니다. 이것은 모든 layout.xml 파일을 하나의 파일로 결합한 것입니다. 이를 사용하여 magento가 추가중인 XML (캐시)에 대해 알고 있는지, 올바른 파일을 편집하고 있는지 확인할 수 있습니다. 또한 각 핸들 섹션에 예기치 않은 레이아웃 삽입이 있는지 확인하여 만족스럽지 않은 결과를 얻을 수 있습니다.

  • +1

    와우 ... 감사합니다 앨런, 당신은 전설입니다. 이 모듈은 실제로 매우 편리합니다. 루트 템플릿은 3columns.phtml로 설정되어 있지만, 내 OP의 코드에서 볼 수 있듯이 어떤 템플릿이 사용되는지 업데이트합니다. 나는 2columns-left.phtml 파일에 무엇인가 넣으려고 시도했기 때문에 이것이 작동한다는 것을 안다. 그것은 페이지에 나타난다. 또한 태그를 확인했지만 customer_account 페이지 내에 또는 관련 태그가 없습니다. 내가 말할 수있는 한, 그것은 무시되지 않고있다. 도움을 주셔서 감사합니다. – Remy

    +0

    "showLayout = page"의 내용을 게시 할 수 있습니까? –

    +0

    안녕하세요, Alan, 반환 된 xml로 OP를 업데이트했습니다. 당신의 도움에 다시 한번 많은 감사드립니다. – Remy

    2

    Alan의 모듈을 app/code/community에 넣으면 dolu에 대한 응답으로 (이 문제가있는 다른 사용자의 경우) app/etc/modules/Alanstormdotcom_Layoutviewer.xml을 편집하여 "community"코드 풀을 사용해야합니다 . 이 모듈은 기본적으로 app/code/local에 설치 될 것으로 예상됩니다 (적어도 Alan의 답변에 링크 된 버전).