public function addActionLayoutHandles() { parent::addActionLayoutHandles(); $layout = $this->getLayout(); $layout->getUpdate()->addHandle('checkout_onepage_success'); return $this; }
/** * Prepare menu and handles */ public function addActionLayoutHandles() { parent::addActionLayoutHandles(); $update = $this->getLayout()->getUpdate(); $update->addHandle('open_gallery'); $update->addHandle('open_gallery_scripts'); }
/** * Adds an additional layout handle based on view name, since * full action handle will always be the same. */ public function addActionLayoutHandles() { $r = parent::addActionLayoutHandles(); $update = $this->getLayout()->getUpdate(); $update->addHandle(strtolower($this->getHandlerActionHandle())); return $r; }
/** * Inits layout for viewing product page * * @param Mage_Catalog_Model_Product $product * @param Mage_Core_Controller_Front_Action $controller * * @return Mage_Catalog_Helper_Product_View */ public function initProductLayout($product, $controller) { $design = Mage::getSingleton('catalog/design'); $settings = $design->getDesignSettings($product); if ($settings->getCustomDesign()) { $design->applyCustomDesign($settings->getCustomDesign()); } $update = $controller->getLayout()->getUpdate(); $update->addHandle('default'); $controller->addActionLayoutHandles(); /* START OF CODE FOR CUSTOMIZATION OF PREMIUM PACKAGING */ /* $premium = false; $catIds = $product->getCategoryIds(); $premium = Mage::getModel('packaging/packaging')->bool_isPremiumPackaging($catIds, true); if($premium) { $update->addHandle('PRODUCT_TYPE_PREMIUM'); $update->addHandle('PRODUCT_' . $product->getId()); } else { */ $update->addHandle('PRODUCT_TYPE_' . $product->getTypeId()); $update->addHandle('PRODUCT_' . $product->getId()); /* } */ /* END OF CODE FOR CUSTOMIZATION OF PREMIUM PACKAGING */ $controller->loadLayoutUpdates(); // Apply custom layout update once layout is loaded $layoutUpdates = $settings->getLayoutUpdates(); if ($layoutUpdates) { if (is_array($layoutUpdates)) { foreach ($layoutUpdates as $layoutUpdate) { $update->addUpdate($layoutUpdate); } } } $controller->generateLayoutXml()->generateLayoutBlocks(); // Apply custom layout (page) template once the blocks are generated if ($settings->getPageLayout()) { $controller->getLayout()->helper('page/layout')->applyTemplate($settings->getPageLayout()); } $currentCategory = Mage::registry('current_category'); $root = $controller->getLayout()->getBlock('root'); if ($root) { $controllerClass = $controller->getFullActionName(); if ($controllerClass != 'catalog-product-view') { $root->addBodyClass('catalog-product-view'); } $root->addBodyClass('product-' . $product->getUrlKey()); if ($currentCategory instanceof Mage_Catalog_Model_Category) { $root->addBodyClass('categorypath-' . $currentCategory->getUrlPath())->addBodyClass('category-' . $currentCategory->getUrlKey()); } } return $this; }
/** * Inits layout for viewing product page * * @param Mage_Catalog_Model_Product $product * @param Mage_Core_Controller_Front_Action $controller * * @return Mage_Catalog_Helper_Product_View */ public function initProductLayout($product, $controller) { $design = Mage::getSingleton('catalog/design'); $settings = $design->getDesignSettings($product); if ($settings->getCustomDesign()) { $design->applyCustomDesign($settings->getCustomDesign()); } $update = $controller->getLayout()->getUpdate(); $update->addHandle('default'); $controller->addActionLayoutHandles(); $update->addHandle('PRODUCT_TYPE_' . $product->getTypeId()); $update->addHandle('PRODUCT_' . $product->getId()); if ($product->getAttributeSetId() == '9') { $categoryId = (int) Mage::app()->getStore()->getRootCategoryId(); $category = Mage::getModel('catalog/category')->setStoreId(Mage::app()->getStore()->getId())->load($categoryId); $layer = Mage::getSingleton('catalog/layer'); $productCollection = $layer->getProductCollection(); Mage::getModel('amfinder/finder')->getCompatibleCollection($product, $productCollection); if (Mage::registry('current_category')) { Mage::unregister('current_category'); } Mage::register('current_category', $category); Mage::getSingleton('catalog/session')->setLastVisitedCategoryId($category->getId()); Mage::register('finder_product', true); $update->removeHandle('catalog_product_view'); $update->addHandle('amfinder_index_index'); } $controller->loadLayoutUpdates(); // Apply custom layout update once layout is loaded $layoutUpdates = $settings->getLayoutUpdates(); if ($layoutUpdates) { if (is_array($layoutUpdates)) { foreach ($layoutUpdates as $layoutUpdate) { $update->addUpdate($layoutUpdate); } } } $controller->generateLayoutXml()->generateLayoutBlocks(); // Apply custom layout (page) template once the blocks are generated if ($settings->getPageLayout()) { $controller->getLayout()->helper('page/layout')->applyTemplate($settings->getPageLayout()); } $currentCategory = Mage::registry('current_category'); $root = $controller->getLayout()->getBlock('root'); if ($root) { $controllerClass = $controller->getFullActionName(); if ($controllerClass != 'catalog-product-view') { $root->addBodyClass('catalog-product-view'); } $root->addBodyClass('product-' . $product->getUrlKey()); if ($currentCategory instanceof Mage_Catalog_Model_Category) { $root->addBodyClass('categorypath-' . $currentCategory->getUrlPath())->addBodyClass('category-' . $currentCategory->getUrlKey()); } } return $this; }
/** * Inits layout for viewing product page * * @param Mage_Catalog_Model_Product $product * @param Mage_Core_Controller_Front_Action $controller * * @return Mage_Catalog_Helper_Product_View */ public function initProductLayout($product, $controller) { $design = Mage::getSingleton('catalog/design'); $settings = $design->getDesignSettings($product); if ($settings->getCustomDesign()) { $design->applyCustomDesign($settings->getCustomDesign()); } $update = $controller->getLayout()->getUpdate(); $update->addHandle('default'); $controller->addActionLayoutHandles(); $update->addHandle('PRODUCT_TYPE_' . $product->getTypeId()); $update->addHandle('PRODUCT_' . $product->getId()); $controller->loadLayoutUpdates(); // Apply custom layout update once layout is loaded $layoutUpdates = $settings->getLayoutUpdates(); if ($layoutUpdates) { if (is_array($layoutUpdates)) { foreach ($layoutUpdates as $layoutUpdate) { $update->addUpdate($layoutUpdate); } } } $controller->generateLayoutXml()->generateLayoutBlocks(); // Apply custom layout (page) template once the blocks are generated if ($settings->getPageLayout()) { $controller->getLayout()->helper('page/layout')->applyTemplate($settings->getPageLayout()); } else { if (Mage::getStoreConfig('mpanel/general/enabled') && Mage::getStoreConfig('mpanel/catalog/product_layout') != '') { $controller->getLayout()->helper('page/layout')->applyTemplate(Mage::getStoreConfig('mpanel/catalog/product_layout')); } } $currentCategory = Mage::registry('current_category'); $root = $controller->getLayout()->getBlock('root'); if ($root) { $controllerClass = $controller->getFullActionName(); if ($controllerClass != 'catalog-product-view') { $root->addBodyClass('catalog-product-view'); } $root->addBodyClass('product-' . $product->getUrlKey()); if ($currentCategory instanceof Mage_Catalog_Model_Category) { $root->addBodyClass('categorypath-' . $currentCategory->getUrlPath())->addBodyClass('category-' . $currentCategory->getUrlKey()); } } return $this; }
/** * Renders CMS page * * Call from controller action * * @param Mage_Core_Controller_Front_Action $action * @param integer $pageId * @return boolean */ public function renderPage(Mage_Core_Controller_Front_Action $action, $pageId = null) { $page = Mage::getSingleton('cms/page'); if (!is_null($pageId) && $pageId !== $page->getId()) { $page->setStoreId(Mage::app()->getStore()->getId()); if (!$page->load($pageId)) { return false; } } if (!$page->getId()) { return false; } if ($page->getCustomTheme()) { if (Mage::app()->getLocale()->IsStoreDateInInterval(null, $page->getCustomThemeFrom(), $page->getCustomThemeTo())) { list($package, $theme) = explode('/', $page->getCustomTheme()); Mage::getSingleton('core/design_package')->setPackageName($package)->setTheme($theme); } } $action->getLayout()->getUpdate()->addHandle('default')->addHandle('cms_page'); $action->addActionLayoutHandles(); if ($page->getRootTemplate()) { $action->getLayout()->helper('page/layout')->applyHandle($page->getRootTemplate()); } $action->loadLayoutUpdates(); $action->getLayout()->getUpdate()->addUpdate($page->getLayoutUpdateXml()); $action->generateLayoutXml()->generateLayoutBlocks(); if ($page->getRootTemplate()) { $action->getLayout()->helper('page/layout')->applyTemplate($page->getRootTemplate()); } if ($storage = Mage::getSingleton('catalog/session')) { $action->getLayout()->getMessagesBlock()->addMessages($storage->getMessages(true)); } if ($storage = Mage::getSingleton('checkout/session')) { $action->getLayout()->getMessagesBlock()->addMessages($storage->getMessages(true)); } $action->renderLayout(); return true; }
/** * Renders the attribute info page * Call from controller action * * @param Mage_Core_Controller_Front_Action $action */ public function renderAllAttributesPage(Mage_Core_Controller_Front_Action $action) { $action->getLayout()->getUpdate()->addHandle('default')->addHandle('dc_catalog_attributeinfo_all'); $action->addActionLayoutHandles(); $action->loadLayoutUpdates(); //$action->getLayout()->getUpdate()->addUpdate($attributeInfo->getLayoutUpdateXml()); $action->generateLayoutXml()->generateLayoutBlocks(); /*if (($attributeInfo->getRootTemplate()) && ('empty' != $attributeInfo->getRootTemplate())) { $action->getLayout()->helper('page/layout') ->applyTemplate($attributeInfo->getRootTemplate()); }*/ // show breadcrumbs if (Mage::getStoreConfig('web/default/show_cms_breadcrumbs') && ($breadcrumbs = $action->getLayout()->getBlock('breadcrumbs'))) { $breadcrumbs->addCrumb('home', array('label' => Mage::helper('dc_catalog')->__('Home'), 'title' => Mage::helper('dc_catalog')->__('Go to Home Page'), 'link' => Mage::getBaseUrl())); $attributeCode = Mage::registry('attribute_code'); $attribute = Mage::getSingleton('eav/config')->getAttribute('catalog_product', $attributeCode); if (is_array($labels = $attribute->getStoreLabels()) && isset($labels[Mage::app()->getStore()->getId()])) { $label = $labels[Mage::app()->getStore()->getId()]; } else { $label = $attribute->getFrontendLabel(); } $breadcrumbs->addCrumb('allvalues', array('label' => Mage::helper('dc_catalog')->__($label . 's'))); } if ($storage = Mage::getSingleton('catalog/session')) { $action->getLayout()->getMessagesBlock()->addMessages($storage->getMessages(true)); } if ($storage = Mage::getSingleton('checkout/session')) { $action->getLayout()->getMessagesBlock()->addMessages($storage->getMessages(true)); } $action->renderLayout(); return true; }
/** * Inject a layout handle to pull in the current active method. */ public function addActionLayoutHandles() { parent::addActionLayoutHandles(); Mage::getSingleton('core/layout')->getUpdate()->addHandle('customer_paymentinfo_' . strtolower($this->getRequest()->getRequestedActionName()) . '_' . Mage::registry('tokenbase_method')); return $this; }