Ответ 1
Фактически, node в вашем файле config.xml не выполняет "обновление". На самом деле, я думаю, вы сделали это в своем config.xml:
<config>
<frontend>
<layout>
<updates>
<checkout>
<file>mylayout.xml</file>
</checkout>
</updates>
</layout>
</frontend>
</config>
и вы внесли свои изменения в mylayout.xml.
На самом деле вам нужно сделать:
<config>
<frontend>
<layout>
<updates>
<mymodule>
<file>mylayout.xml</file>
</mymodule>
</updates>
</layout>
</frontend>
</config>
И затем, в mylayout.xml:
<checkout_cart_index> <!-- this corresponds to the section where you want to add your block (or modify an existing block -->
<reference name="content">
<reference name="checkout.cart">
<block type="mymodule/myblock" name="checkout.mymodule.myblock"></block>
</reference>
</reference>
</checkout_cart_index>
Изучая мой код и сравнивая файлы друг с другом, вы лучше поймете, как это работает.
На самом деле не забывайте, что все xml файлы объединены в magento. Таким образом, все узлы во всех конфигурационных файлах, соблюдая один и тот же порядок, будут конкатенатированы.
Например, в нашем случае файлы config.xml magento будут конкатенированы, а результат - ОДИН файл, содержащий:
<config>
<!-- some nodes... -->
<!-- some nodes... -->
<!-- some nodes... -->
<frontend>
<layout>
<updates>
<mymodule>
<file>mylayout.xml</file>
</mymodule>
<checkout> <!-- this is the node from the config.xml of the Checkout Module-->
<file>checkout.xml</file>
</checkout>
<!-- some layout updates nodes from other config files... -->
</updates>
</layout>
</frontend>
<!-- some nodes... -->
<!-- some nodes... -->
</config>
Если вы заменили <mymodule>
на <checkout>
, результирующий файл посмотрел бы:
<config>
<!-- some nodes... -->
<!-- some nodes... -->
<!-- some nodes... -->
<frontend>
<layout>
<updates>
<checkout>
<file>mylayout.xml</file>
</checkout>
<!-- some layout updates nodes from other config files... -->
</updates>
</layout>
</frontend>
<!-- some nodes... -->
<!-- some nodes... -->
</config>
Обратите внимание на mylayout.xml. Вот почему исходный файл макета полностью заменен вашим собственным макетом:)
Надеюсь, что ясно, на французском мне было бы легче объяснить;)
Хьюг.