/**
  * Initialise the view action layout for the page
  * This includes setting META data, page template and other similar things
  *
  * @param Fishpig_AttributeSplashPro_Model_Page $page
  * @return $this
  */
 protected function _initViewActionLayout(Fishpig_AttributeSplashPro_Model_Page $page)
 {
     $customHandles = array('default', 'splash_page_view_' . $page->getId());
     if ($template = $page->getTemplate()) {
         array_push($customHandles, 'page_' . $template, 'splash_page_view_' . strtoupper($template));
     }
     $this->_addCustomLayoutHandles($customHandles);
     $layout = $this->getLayout();
     if (($rootBlock = $layout->getBlock('root')) !== false) {
         $rootBlock->addBodyClass('splash-page-' . $page->getId());
     }
     if (($headBlock = $layout->getBlock('head')) !== false) {
         if ($page->getMetaDescription()) {
             $headBlock->setDescription($page->getMetaDescription());
         }
         if ($page->getMetaKeywords()) {
             $headBlock->setKeywords($page->getMetaKeywords());
         }
         if ($page->getRobots()) {
             $headBlock->setRobots($page->getRobots());
         }
         if (Mage::getStoreConfigFlag('splash/seo/use_canonical')) {
             $headBlock->addItem('link_rel', $page->getUrl(), 'rel="canonical"');
         }
         if (($title = $page->getPageTitle()) !== '') {
             $headBlock->setTitle($title);
         } else {
             $this->_title($page->getName());
         }
     }
     if (($breadBlock = $layout->getBlock('breadcrumbs')) !== false) {
         $breadBlock->addCrumb('home', array('link' => Mage::getUrl(), 'label' => $this->__('Home'), 'title' => $this->__('Home')));
         if (($categories = $this->_getCategoriesForBreadcrumbs($page)) !== false) {
             foreach ($categories as $category) {
                 $breadBlock->addCrumb('splash_category_' . $category->getId(), array('link' => $category->getUrl(), 'label' => $category->getName(), 'title' => $category->getName()));
             }
         }
         $breadBlock->addCrumb('splash_page', array('label' => $page->getName(), 'title' => $page->getName()));
     }
     // Initialize the messages blocks
     $this->_initLayoutMessages('core/session');
     $this->_initLayoutMessages('checkout/session');
     $this->_initLayoutMessages('customer/session');
     $this->_initLayoutMessages('catalog/session');
     return $this;
 }
示例#2
0
 /**
  * Retrieve the last modified date
  *
  * @param Fishpig_AttributeSplashPro_Model_Page $page
  * @return string
  */
 public function getLastModifiedDate(Fishpig_AttributeSplashPro_Model_Page $page)
 {
     return ($date = $page->getUpdatedAt()) ? substr($date, 0, strpos($date, ' ')) : date('Y-m-d');
 }
示例#3
0
 /**
  * Convert the filter data into a format used to pre-fill Admin forms
  *
  * @param Fishpig_AttributeSplashPro_Model_Page $page
  * @return array
  */
 protected function _loadAdminData(Fishpig_AttributeSplashPro_Model_Page $page)
 {
     $adminFilterData = array();
     if (is_array($options = $page->getOptionFilters())) {
         foreach ($options as $key => $data) {
             if (is_array($data) && isset($data['value']) && $data['value'] !== '') {
                 $adminFilterData['option_filters_' . $key . '_value'] = $data['value'];
                 $adminFilterData['option_filters_' . $key . '_operator'] = isset($data['operator']) && $data['operator'] ? $data['operator'] : 'AND';
                 $adminFilterData['option_filters_' . $key . '_apply_to'] = isset($data['apply_to']) && $data['apply_to'] ? $data['apply_to'] : '';
                 $adminFilterData['option_filters_' . $key . '_include_in_layered_nav'] = isset($data['include_in_layered_nav']) && $data['include_in_layered_nav'] ? (int) $data['include_in_layered_nav'] : 0;
             }
         }
     }
     if (is_array($prices = $page->getPriceFilters())) {
         foreach ($prices as $attribute => $price) {
             $adminFilterData['price_filters_' . $attribute . '_attribute'] = $attribute;
             $adminFilterData['price_filters_' . $attribute . '_min'] = $price['min'];
             $adminFilterData['price_filters_' . $attribute . '_max'] = $price['max'];
         }
     }
     if ($operator = $page->getCategoryOperator()) {
         $adminFilterData['category_operator'] = $operator;
     }
     $page->setAdminFilterData($adminFilterData);
 }