Created
January 28, 2013 15:53
-
-
Save sergoslav/4656645 to your computer and use it in GitHub Desktop.
easyAjax fiseing cahce layout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Load custom layout | |
* | |
* @return Mage_Core_Model_Layout | |
*/ | |
protected function _loadCustomLayouts() | |
{ | |
$layout = Mage::app()->getLayout(); | |
$update = $layout->getUpdate(); | |
// load default custom handle | |
$update->addHandle('easy_ajax_default'); | |
// load action handle | |
$fullActionName = Mage::app()->getRequest()->getRequestedRouteName() . '_' . | |
Mage::app()->getRequest()->getRequestedControllerName() . '_' . | |
Mage::app()->getRequest()->getRequestedActionName(); | |
$update->addHandle('easy_ajax_' . strtolower($fullActionName)); | |
if (Mage::app()->useCache('layout')){ | |
$cacheId = $update->getCacheId().'_easy_ajax'; | |
$update->setCacheId($cacheId); | |
if (!Mage::app()->loadCache($cacheId)) { | |
foreach ($update->getHandles() as $handle) { | |
$update->merge($handle); | |
} | |
$update->saveCache(); | |
} else { | |
//load updates from cache | |
$update->load(); | |
} | |
} else { | |
//load updates | |
$update->load(); | |
} | |
//generate xml | |
$layout->generateXml(); | |
//generate layout blocks | |
$layout->generateBlocks(); | |
return $layout; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment