Beispiel #1
0
 /**
  * Add meta information from product to head block
  *
  * @return Mage_Catalog_Block_Product_View
  */
 protected function _prepareLayout()
 {
     $_layoutData = parent::_prepareLayout();
     $headBlock = $this->getLayout()->getBlock('head');
     if ($headBlock) {
         $product = $this->getProduct();
         $headBlock->addLinkRel('image_src', $product->getImageUrl());
         $baseUrl = Mage::getBaseUrl();
         if (!strpos($this->helper('core/url')->getCurrentUrl(), "?")) {
             $currentUrl = $this->helper('core/url')->getCurrentUrl();
         } else {
             $currentUrl = substr($this->helper('core/url')->getCurrentUrl(), 0, strpos($this->helper('core/url')->getCurrentUrl(), "?"));
         }
         if ($currentUrl === $baseUrl) {
             $_defaultTitle = htmlspecialchars(html_entity_decode(trim(Mage::getStoreConfig('design/head/default_title')), ENT_QUOTES, 'UTF-8'));
             $headBlock->setTitle($_defaultTitle);
             $headBlock->setDescription(Mage::getStoreConfig('design/head/default_description'));
             $headBlock->setKeywords(Mage::getStoreConfig('design/head/default_keywords'));
             $params = array('_ignore_category' => true);
             $headBlock->removeItem('link_rel', $product->getUrlModel()->getUrl($product, $params));
             $headBlock->addLinkRel('canonical', $baseUrl);
         }
     }
     //        return parent::_prepareLayout();
     return $_layoutData;
 }
Beispiel #2
0
 protected function _prepareLayout()
 {
     $product = $this->getProduct();
     if (!$product) {
         return parent::_prepareLayout();
     }
     if (!Mage::getStoreConfig('ammeta/product/enabled')) {
         return parent::_prepareLayout();
     }
     $hlp = Mage::helper('ammeta');
     //templates configuration for products in categories
     $config = $hlp->getConfigByProduct($product);
     // product attribute => template name
     $pairs = array('meta_title' => 'title', 'meta_description' => 'description', 'meta_keyword' => 'keywords', 'short_description' => 'short_description', 'description' => 'full_description');
     foreach ($pairs as $attrCode => $patternName) {
         if ($product->getData($attrCode)) {
             continue;
         }
         $pattern = Mage::getStoreConfig('ammeta/product/' . $patternName);
         foreach ($config as $item) {
             if ($item->getData($patternName)) {
                 // get first not empty pattern
                 $pattern = $item->getData($patternName);
                 break;
             }
         }
         if ($pattern) {
             $product->setData($attrCode, $hlp->parse($product, $pattern));
         }
     }
     return parent::_prepareLayout();
 }
Beispiel #3
0
 protected function _prepareLayout()
 {
     if ($this->isAvailable()) {
         $headBlock = $this->getLayout()->getBlock('head');
         if ($headBlock) {
             $headBlock->addCss('css/mageho/atos/atos.css');
         }
     }
     return parent::_prepareLayout();
 }
 public function _prepareLayout()
 {
     $product = Mage::registry('current_product');
     $product_type = $product->getTypeId();
     if ($product_type == "grouped") {
         $this->setTemplate('callforprice/callforprice_grouped.phtml');
     } else {
         $this->setTemplate('callforprice/callforprice_simple.phtml');
     }
     return parent::_prepareLayout();
 }
Beispiel #5
0
 protected function _prepareLayout()
 {
     $breadcrumbsBlock = $this->getLayout()->getBlock('breadcrumbs');
     parent::_prepareLayout();
     if ($breadcrumbsBlock) {
         $breadcrumbsBlock->addCrumb('product', array('label' => $this->getProduct()->getName(), 'link' => $this->getProduct()->getProductUrl()));
         $breadcrumbsBlock->addCrumb('reviews', array('label' => Mage::helper('review')->__('Product Reviews')));
     }
     $toolbar = $this->getLayout()->createBlock('page/html_pager', 'detailed_review_list.toolbar')->setCollection($this->_getCollection());
     $this->setChild('toolbar', $toolbar);
     return $this;
 }
Beispiel #6
0
 /**
  * Prepare layout
  *
  * @return Enterprise_GiftRegistry_Block_Product_View
  */
 protected function _prepareLayout()
 {
     $block = $this->getLayout()->getBlock('customize.button');
     if ($block && $this->_isGiftRegistryRedirect()) {
         $block->setTemplate('giftregistry/product/customize.phtml');
     }
     $block = $this->getLayout()->getBlock('product.info.addtocart');
     if ($block && $this->_isGiftRegistryRedirect()) {
         $block->setTemplate('giftregistry/product/addtocart.phtml');
         $block->setAddToGiftregistryUrl($this->getAddToGiftregistryUrl());
     }
     return parent::_prepareLayout();
 }
Beispiel #7
0
 protected function _prepareLayout()
 {
     $this->getLayout()->createBlock('catalog/breadcrumbs');
     $headBlock = $this->getLayout()->getBlock('head');
     if ($headBlock) {
         $product = $this->getProduct();
         $title = $product->getMetaTitle();
         if ($title) {
             $headBlock->setTitle($title);
         }
         $keyword = $product->getMetaKeyword();
         $currentCategory = Mage::registry('current_category');
         if ($keyword) {
             $headBlock->setKeywords($keyword);
         } elseif ($currentCategory) {
             $headBlock->setKeywords($product->getName());
         }
         $description = $product->getMetaDescription();
         if ($description) {
             $headBlock->setDescription($description);
         } else {
             $headBlock->setDescription($product->getDescription());
         }
         $robots = $product->getMetaRobots();
         if ($robots) {
             $headBlock->setRobots($robots);
         } else {
             $headBlock->setRobots($product->getMetaRobots());
         }
         if ($this->helper('catalog/product')->canUseCanonicalTag()) {
             $params = array('_ignore_category' => true);
             $headBlock->addLinkRel('canonical', $product->getUrlModel()->getUrl($product, $params));
         }
     }
     return parent::_prepareLayout();
 }
 public function _prepareLayout()
 {
     $this->setProduct(Mage::registry('current_product'));
     $this->setTemplate('callforprice/callforprice_product_addtocart.phtml');
     return parent::_prepareLayout();
 }
 public function _prepareLayout()
 {
     $this->setTemplate('webpos/admin/webpos/checkout/product/view.phtml');
     return parent::_prepareLayout();
 }
Beispiel #10
0
 protected function _prepareLayout()
 {
     $lengthBlock = $this->getLayout()->addBlock('core/template', 'length_product')->setTemplate('mto/length_product.phtml');
     $this->setChild('length_product', $lengthBlock);
     return parent::_prepareLayout();
 }