2 Comments

how to resolve conflicts between layouts

Get a list of products with Tiered or special pricing
Show filters in empty category layered navigation page 1.9

I have two conflicting modules,unbxed and criteo

appdesignfrontendbasedefaultlayoutunbxdsearch.xml:

section 1(unbxed module):

   <catalogsearch_result_index>
//somecode which is not important for us
   <reference name="before_body_end">
            <block name="unbxd.search" template="unbxd/search/result.phtml" after="-" type="core/template"/>
        </reference>
    </catalogsearch_result_index>

the other module has the following:
section 2(criteo module):

appdesignfrontendbasedefaultlayoutzefirtrackerscriteo.xml
  <catalogsearch_result_index>
    <reference name="before_body_end">
      <block type="conversiontracking/criteo_search" name="criteo.search" template="zefir/conversiontracking/criteo/search.phtml" />
    </reference>
  </catalogsearch_result_index>

I am not sure what is the best way to resolve conflict, I need to have both phtml files being included on the result page.

P.S: if I remove section 2, the result.phtml shows up but if I don’t I only see search.phtml from criteo, therefore section 2 is overwriting section 1 for some reason which I cannot figure it out and by the way one block type is core/template and the other one is comming from the module which is conversiontracking/criteo_search

here is unbxed config.xml as requested:

<?xml version="1.0"?>
<config>
    <modules>
        <Unbxd_Search>
            <version>1.0.22</version>
        </Unbxd_Search>
    </modules>
    <frontend>
        <layout>
            <updates>
                <unbxd_search>
                    <file>unbxd/search.xml</file>
                </unbxd_search>
            </updates>
        </layout>
    </frontend>
    <global>
        <models>
            <unbxd_search>
                <class>Unbxd_Search_Model</class>
                <resourceModel>unbxd_search_resource</resourceModel>
            </unbxd_search>
            <unbxd_search_resource>
                <class>Unbxd_Search_Model_Resource</class>
            </unbxd_search_resource>
        </models>
        <helpers>
            <unbxd_search>
                <class>Unbxd_Search_Helper</class>
            </unbxd_search>
            <catalogsearch>
                <rewrite>
            <data>Unbxd_Search_Helper_Catalogsearch</data>
        </rewrite>
        </catalogsearch>
        </helpers>
        <blocks>
            <unbxd_search>
                <class>Unbxd_Search_Block</class>
            </unbxd_search>
            <catalog>
                <rewrite><layer_view>Unbxd_Search_Block_Catalog_Layer_View</layer_view>
                </rewrite>
            </catalog>
            <catalogsearch>
                <rewrite>
                    <layer>Unbxd_Search_Block_Catalogsearch_Layer</layer>
                    <autocomplete>Unbxd_Search_Block_Autocomplete</autocomplete>
                </rewrite>
            </catalogsearch>
            <enterprise_search>
                <rewrite>
                    <catalogsearch_layer>Unbxd_Search_Block_Catalogsearch_Enterprise_Layer</catalogsearch_layer>
                </rewrite>
            </enterprise_search>
        </blocks>
        <resources>
            <unbxd_search_setup>
                <setup>
                    <module>Unbxd_Search</module>
                    <class>Mage_Core_Model_Resource_Setup</class>
                </setup>
            </unbxd_search_setup>
        </resources>
    </global>

    //some code
</config>

I have done this:

  var_dump($this->getLayout()->getXmlString());

and here is the order the layout has it:

   <reference name="before_body_end">
      <block type="core/template" name="unbxd.search" template="unbxd/search/result.phtml"/>
   </reference>
   <reference name="before_body_end">
      <block type="conversiontracking/criteo_search" name="criteo.search" template="zefir/conversiontracking/criteo/search.phtml" />
   </reference>

I think because the criteo is loaded after the unbxed, it is just showing the criteo but not sure how to fix this.

Related Posts

Get a list of products with Tiered or special pricing
Show filters in empty category layered navigation page 1.9

2 Comments on this article

  • User November 12, 2016

    Have noticed that if any block which we added before body end having fatal error then it will stop further execution.So please review error log files and make sure there is no any error appear which are loaded before unbxd layout.

    Reply

  • User November 12, 2016

    This isn’t a conflict per say. Based on just the two layouts you’ve added, the two template should be added just fine, without problems. The hole pretext for Magento to allow any handle in any layout file is to allow for exactly what is happening in your case! It allows any module to add to anything on any page on the site – that’s flexbility!!

    try remove the after=”-” from the unboxed search layout, the after=”-” might be causing problems.

    Reply

Add a comment

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax