/** * Apply custom layout handles to the splash page * * @param Fishpig_AttribtueSplash_Model_Page $splashPage * @return Fishpig_AttribtueSplash_PageController */ protected function _applyCustomViewLayout(Fishpig_AttributeSplash_Model_Page $splashPage) { $update = $this->getLayout()->getUpdate(); $update->addHandle('default'); $this->addActionLayoutHandles(); $update->addHandle('attributesplash_page_view_' . $splashPage->getId()); $update->addHandle('attributesplash_page_view_' . $splashPage->getAttributeModel()->getAttributeCode()); $this->loadLayoutUpdates(); $update->addUpdate($splashPage->getLayoutUpdateXml()); $this->generateLayoutXml()->generateLayoutBlocks(); if ($splashPage->getPageLayout()) { $this->getLayout()->helper('page/layout')->applyTemplate($splashPage->getPageLayout()); } else { if ($pageLayout = Mage::getStoreConfig('attributeSplash/page/template')) { $this->getLayout()->helper('page/layout')->applyTemplate($pageLayout); } } $this->_isLayoutLoaded = true; return $this; }
/** * Retrieve the group associated with the splash page * This will retrieve the most related group * If there isn't a group for the same store, the admin group will be returned * * @param Fishpig_AttributeSplash_Model_Page $page * @return Fishpig_AttributeSplash_Model_Group|false */ public function getSplashGroup(Fishpig_AttributeSplash_Model_Page $page) { $groups = Mage::getResourceModel('attributeSplash/group_collection')->addAttributeIdFilter($page->getAttributeModel()->getAttributeId())->addStoreFilter($page->getStoreId())->setCurPage(1)->setPageSize(1)->load(); return count($groups) > 0 ? $groups->getFirstItem() : false; }