1

I am creating a module called Mdeprojects_Discount. I have added the following folders

app/local/Mdeprojects/Discount/[plus all relevant folders required]

app/design/frontend/mdediscount/default/layout/

app/design/frontend/mdediscount/default/template/discount/

In the layout folder I have added local.xml and that works as expected. My other layout file which I have in the folder is not loading when I call it, this has been checked by badly formatting the layout file, but I have received no errors. (cacheing is off, errors are on).

In my controller I have ran var_dump($this->getLayout()->getUpdate()->getHandles()) this returns an empty array. But I am using Commercebug and under the Layout tab and "Handles for this request" title, one of the handles returned is <mdeprojects_discount_remainder_remainder />

Why is commerce bug returning a handle and my command not returning anything? (i'm hoping if this is solved, it will also solve why my layout file isn't loading)

app/local/Mdeprojects/Discount/etc/config.xml

<config>
<frontend>
    <routers>
        <mdeprojects_discount>
            <use>standard</use>
            <args>
                <module>Mdeprojects_Discount</module>
                <frontName>discount</frontName>
            </args>
        </mdeprojects_discount>
    </routers>
    <layout>
        <updates>
            <mdeprojects_remainder>
                <file>mdeprojects/remainder.xml</file>
            </mdeprojects_remainder>
        </updates>
    </layout>
</frontend>
</config>

app/local/Mdeprojects/Discount/controllers/RemainderController.php

class Mdeprojects_Discount_RemainderController
    extends Mage_Core_Controller_Front_Action
{
    public function remainderAction()
    {
        var_dump($this->getLayout()->getUpdate()->getHandles());
        $this->loadLayout()->renderLayout();
    }
}

===

EDIT

===

I have tried changing my controller file to

    public function remainderAction()
{
    $this->loadLayout()->renderLayout();
    Zend_Debug::dump($this->getLayout()->getUpdate()->getHandles());
}

this also tells me that the mdeprojects_discount_remainder_remainder handle is being called. But I am still unable to work out why my layout file is not being loaded?

2

I think it should be remainder instead of mdeprojects_remainder. At least this is what I use for my extensions

<config>
<frontend>
    [...]
    <layout>
        <updates>
            <remainder>
                <file>mdeprojects/remainder.xml</file>
            </remainder>
        </updates>
    </layout>
</frontend>
</config>
  • unfortunatly I have tried that and it has had no effect. What has confused me is that the local.xml in that file is being loaded, so I must have my file structure correct – tony09uk Dec 3 '13 at 12:25
2

I have solved my issue thanks to this answer.

The layout was not being called because I had set the wrong path so I changed this

<layout>
    <updates>
        <mdeprojects_remainder>
            <file>mdeprojects/remainder.xml</file>
        </mdeprojects_remainder>
    </updates>
</layout>

to this

<layout>
    <updates>
        <mdeprojects_remainder>
            <file>remainder.xml</file>
        </mdeprojects_remainder>
    </updates>
</layout>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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