Magento düzeni geçersiz kılma!

1 Cevap php

Ben tür yeni Magento için yaşıyorum, bu yüzden benim aptal soru için beni affet! Ben anlamak gibi Magento bütün kavramı en Magento mevcuttur temel bileşenleri geçersiz temelidir.

Yani benim anlayışına dayanan ben Magento onepage çıkış düzenini güncellemek için karar verdik. Ben kendi düzeni oluşturulur ve yapılandırma dosyasında benim düzen çıkış modülü düzenini günceller kurdum. Ama sorun aslında var olan baz düzenini güncelleme gelmez, baz düzeni ile o kendini değiştirir! Böyle hareket olabilir ya da ben yanlış mıyım?!

1 Cevap

In fact, the node in your config.xml file doesn't do an "update". As a matter of fact, I think you have done that in your config.xml :

<config>
    <frontend>
        <layout>
             <updates>
                  <checkout>
                        <file>mylayout.xml</file>
                  </checkout>
             </updates>
        </layout>
    </frontend>
</config>

ve mylayout.xml içinde değişiklikler yaptık.

Aslında yapmanız gereken:

<config>
    <frontend>
        <layout>
             <updates>
                  <mymodule>
                        <file>mylayout.xml</file>
                  </mymodule>
             </updates>
        </layout>
    </frontend>
</config>

Ve sonra, mylayout.xml in:

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

Benim kod bakarak ve birbirlerine dosyaları karşılaştırarak, nasıl çalıştığını daha iyi anlayacaksınız.

In fact, don't forget that all xml files are concatenated in magento. So that, all nodes in all config files, respecting the same order, will be concataneted.

Örneğin, bizim durumumuzda, magento config.xml dosyaları birleştirilmiş olacak ve sonuç içeren ONE dosyası:

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

Eğer <mymodule> ile değiştirilir olsaydı <checkout> edilen dosya baktım olurdu:

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

Note the mylayout.xml. This is the reason why the original layout file is completely replaced by your own layout :)

Bana açıklamak için, fransızca daha kolay anlaşılıyor umut olurdu ;)

Hugues.