0

UPDATE :

it actually return the right value as long as the "Layouts cache" is disabled, but when I enable it the output is becomes incorrect.


I have this very simple piece of code which is supposed to return html code (located in my controller):

<?php
protected function _refreshDdateHtml(){
        $layout = $this->getLayout();
        $update = $layout->getUpdate();
        $update->load('checkout_onepage_refreshddate');
        $layout->generateXml();
        $layout->generateBlocks();
        $output = $layout->getOutput();
        return $output;
    }

However, the value of $output is not the same depending on the server where I run the code. However, the value of $output is not the same depending on if the layout cache is enabled or disabled.

I tried to find the source of the issue without result. Both the database and the file system can be different from one server to the other, but I can't know for sure where.

Here are more details:

Controller class definition:

class Something_Deliverydate_Checkout_OnepageController extends Mage_Checkout_OnepageController

The handle in the layout file:

<checkout_onepage_refreshddate>
        <remove name="right"/>
        <remove name="left"/>

        <block type="checkout/onepage_deliverydate" name="root" output="toHtml" template="deliverydate/checkout/onepage/refreshddate.phtml" />
</checkout_onepage_refreshddate>

The loaded handles seem to be the same on both servers though as this line give the same result:

var_dump(Mage::getSingleton('core/layout')->getUpdate()->getHandles());

Do you have an idea why the template called is different from one server to the other ? Do you have any idea why the output is changing depending on the cache status, even if the cache folder is empty ?

0

Just an idea: if you have different code bases and databases check whether in the one where you are not seeing the expected result the extension has been properly installed, the cache has been cleaned and the compilation (if active) has been refreshed.

What's more, activate logging in System > Configuration > ADVANCED > Developer > Log settings and check whether there are any errors in {magento_install_directory}/var/log/system.log and/or in {magento_install_directory}/var/log/exception.log.

Hope it helps.

3
  • Thank you, I didn't try before but the responsible for this difference in the output is the status of the layout cache: if enabled, it doesn't work. I updated the question accordingly.
    – TheTrueTDF
    Apr 4 '16 at 7:24
  • You say the cache folder is empty: unless you have alternative cache systems configured (redis, memcache) that folder shouldn't be empty with cache enabled; it can be a symptom of the fact that {magento_install_directory}/var/cache is not writable; in this case Magento stores cache under the /tmp folder of the system (assuming you are on a *nix system). Apr 4 '16 at 9:37
  • Sorry I meant the problem occurs even after I empty the cache manually (when then, the cache folder is empty). It's getting filled without problem too.
    – TheTrueTDF
    Apr 4 '16 at 9:38

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.