简体   繁体   中英

Loading a block from a controller in magento, cache issue?

I have two methods inside my controller i call to get html for various ajax updates.

    protected function _getDemoShippingMethodsHtml()
    {
        $layout = $this->getLayout();
        $update = $layout->getUpdate();
        $update->load('checkout_onepage_demoshippingmethod');
        $layout->generateXml();
        $layout->generateBlocks();
        $output = $layout->getOutput();

        return $output;
    }

    protected function _getSelectedDealerHtml()
    {
        $layout = $this->getLayout();
        $update = $layout->getUpdate();
        $update->load('checkout_onepage_selecteddealer');
        $layout->generateXml();
        $layout->generateBlocks();
        $output = $layout->getOutput();

        return $output;
    }

During one request to my controller if i call only one of these methods it loads the block as expected. The problem comes in where i try to call both of these function during one request. Which ever method is called first outputs the expected html, and the second method call outputs the exact same html as the first.

在使用的块类中,创建一个空的伪构造函数受保护的函数_construct(){}

try use clean cache programatically Mage::app()->cleanCache();

Clear Magento cache

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM