Проблема с XML-макетом моей учетной записи Magento


У меня возникли проблемы с получением customer.xml файл макета для правильной работы на страницах "Мой аккаунт" клиента.

Ссылки навигации и ранее заказанные элементы, которые обычно находятся в левой части страницы, не будут отображаться на странице, но если я изменю имя ссылки на "содержимое" в xml-файле, оно появится (за исключением того, что оно, очевидно, находится с правой стороны). Я проверил шаблон, на который он ссылается (2columns-left.phtml), и getChildHtml ("левый") является там в правильном положении.

Блок, вызывающий проблему:

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

Это было в основном скопировано прямо с другого нашего сайта, где это работает на 100%. Я перепробовал все, что мог придумать (например, изменил имя ссылки как в шаблоне, так и в 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>
Author: Remy, 2009-07-06

2 answers

Сначала о главном. Убедитесь, что вы очистили кэш приложения Magento. Весь XML-файл макета кэшируется Magento, поэтому для внесения каких-либо изменений недостаточно поместить туда новый файл.

Похоже, что ваша левая колонка не отображается. Вот несколько возможных причин этого

  1. Для вашего корневого шаблона устанавливается что-то другое, кроме макета с двумя столбцами слева

  2. В макет вводится тег где-то, что мешает вашей левой колонке

  3. Ваш "левый" блок переопределяется, чтобы в нем не было дочерних блоков, необходимых для правильного отображения

Итак, шаг 1 - выяснить, какой из трех это. Поместите произвольный, но заметный текст во все ваши файлы php/phtml (я склоняюсь к чему-то вроде

Один

,

Два

и т. Д.), Чтобы вы могли определить, какие файлы на самом деле загружаются.

Также есть отладка шаблона установка в

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

, который делает нечто подобное. Если вы хотите использовать это, вам нужно будет перейти к определенной области конфигурации (вы не можете установить ее по умолчанию).

Хотя выполнение любого из этих действий не укажет на прямую проблему, они (надеюсь) позволят вам исключить отдельные причины.

Есть важная вещь, которую следует иметь в виду в отношении макетов. Имена этих XML-файлов являются произвольными. Их способ работы с макетами заключается в том, что все XML-формат макета объединен в один гигантский XML-файл. Затем для каждого запроса этот большой XML-файл уменьшается в зависимости от того, что "обрабатывает" запрос страницы. Дескриптор - это что-то вроде или . Другими словами, что-то в любом из ваших других файлов макета может вызывать у вас проблемы на странице оформления заказа, а не просто вещи в customer.xml .

Также возможно, что на сайте Magento, с которым вы работаете, есть один или два переопределенных контроллера, которые изменят макет обрабатывает то, что ищет Magento при любом запросе страницы.

Суть в том, что есть ряд вещей, которые могут быть причиной этого, и нам нужно заглянуть внутрь внутренних органов Magento. Установите этот модуль в свою среду разработки (я работаю над экспериментальной отладкой)

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

Когда он будет запущен и запущен, загрузите страницу в свой магазин со следующим запросом строка

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

Здесь будут показаны дескрипторы, используемые magento для любого запроса. Вы должны увидеть список чего-то вроде

  1. по умолчанию
  2. склад_баре_ус
  3. ТЕМА_\интерфейс_дефолт_дефолта
  4. пользователь_аккаунт_индекс
  5. пользователь_логгед_ин

Если номер 4 - это что-то другое (имя_компании_модулена_кастомер_аккаунта_индекс), это означает, что на вашем сайте есть пользовательский контроллер для этого запроса. Если это так, вам захочется взглянуть для тегов в ваших макетах внутри , которые могут переопределять то, что вы хотите сделать.

Затем загрузите URL-адрес Magento со следующей строкой запроса

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

Вы должны увидеть XML-файл, отображаемый в браузере. Это окончательный XML-файл макета вашего запроса. Найдите тег (скорее всего, с именем root) с набором выходных атрибутов

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

Выходной атрибут означает, что это шаблон, с которого Magento начнет рендеринг. Если это это не ваш макет из двух столбцов, вы ближе к решению своей проблемы.

Затем найдите модуль с именем left внутри корневого модуля

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

Если у этого есть атрибут игнорировать, вероятно, будет соответствующий тег

<remove name="left"/>

Где-то в вашем макете. Вы захотите удалить это.

Кроме того, убедитесь, что в вашем корневом блоке действительно есть дочерний блок с оставленным именем.

<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

Указание "пакет" в параметре строки запроса showLayout покажет вам ваш весь макет пакета. Это все твое layout.xml файлы объединены в один. Вы можете использовать это, чтобы убедиться, что magento знает о добавляемом вами XML (кэш), и убедиться, что вы редактируете правильные файлы. Вы также можете привести пример каждого раздела дескриптора, чтобы найти неожиданные изменения компоновки, которые дают вам результаты, которые вас не устраивают.

 19
Author: Alan Storm, 2015-08-06 22:33:48

В ответ на dolu (для всех, у кого есть эта проблема), если вы разместите модуль Алана в приложении/коде/сообществе, вам нужно отредактировать app/etc/modules/Alanstormdotcom_Layoutviewer.xml для использования пула кодов "сообщество". Модуль по умолчанию предполагается установить в приложении/коде/локальном (по крайней мере, версия, связанная с ответом Алана здесь).

 2
Author: Del F, 2010-05-27 00:39:49