Take the 2-minute tour ×
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It's 100% free, no registration required.

I created a module that uses the "before_body_end". On some pages a second module also uses before_body_end. Is there a way to dermine the order ?

example:

<div class='mymodule'></div>
<div class='3rdpartymodule'></div>
</body>

to :

<div class='3rdpartymodule'></div>
<div class='mymodule'></div>
</body>
share|improve this question

3 Answers 3

up vote 2 down vote accepted

An addendum to @marius' answer, rather than place the core dependency in a core override you can state the dependency in your own module so that disabling it also disables the dependency:

<?xml version="1.0"?>
<config>
    <modules>
        <YourCompany_YourModule>
            <active>true</active>
            <codePool>community</codePool>
        </YourCompany_YourModule>
        <Mage_Customer>
            <depends>
                <YourCompany_YourModule/>
            </depends>
        </Mage_Customer>
    </modules>
</config>
share|improve this answer

in the layout XML of your extension add the after attribute to the block declaration.

<reference name="before_body_end">
   <block type="your/module" name="your_module" after="-" template="your/module.phtml"/>
</reference>

As long as the other extension doesn't do the same you should be good and your block should always be inserted last.

share|improve this answer

Make you module depend on the third party module. Add this in app/etc/modules/[Namespace]_[Module].xml

<depends>
    <Thirdparty_Module />
</depends>
share|improve this answer
    
Looks a bit like a hack. It would also mean that the third party module can't be disabled. –  Fran Mar 12 at 15:53
    
Not a hack. A workaround. See my answer for an addendum to this method, @Fran –  philwinkle Mar 12 at 17:15
    
This is not actually a hack. It's a feature :). If you don't like this approach you can try what @SanderMangel posted. I don't know how I didn't thing of that. It's kind of obvious. –  Marius Mar 13 at 8:26
    
Sorry but this is a dirty solution. @Sander provided the right answer there. Your solution would imply the first module DEPENDS on the other one, which is absolutely not true. Not saying it's not going to work, it's just not a very clean way to achieve it. –  Fran Mar 13 at 17:18
    
@Fran I totally agree with you on this. –  Marius Mar 13 at 17:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.