Ejemplo n.º 1
0
 public function _construct()
 {
     parent::_construct();
     $this->_page = Mage::getSingleton('cms/page');
     if ($this->_page) {
         $this->_parseObjects['page'] = $this->_page;
     }
     $this->_parseObjects['store'] = Mage::getModel('seo/object_store');
     $this->init();
 }
Ejemplo n.º 2
0
 public function _construct()
 {
     $uid = Mage::helper('mstcore/debug')->start();
     parent::_construct();
     $this->_product = Mage::registry('current_product');
     if (!$this->_product) {
         $this->_product = Mage::registry('product');
     }
     if (!$this->_product) {
         return;
     }
     $this->_parseObjects['product'] = $this->_product;
     $this->setAdditionalVariable('product', 'url', $this->_product->getProductUrl());
     $this->setAdditionalVariable('product', 'final_price', $this->_product->getFinalPrice());
     $this->setAdditionalVariable('product', 'final_price_minimal', Mage::helper('seo')->getCurrentProductFinalPrice($this->_product));
     $this->setAdditionalVariable('product', 'final_price_range', Mage::helper('seo')->getCurrentProductFinalPriceRange($this->_product));
     $categoryId = $this->_product->getSeoCategory();
     $this->_category = Mage::registry('current_category');
     if ($this->_category && !$categoryId) {
         $this->_parseObjects['category'] = $this->_category;
     } elseif ($this->_product) {
         if (!$categoryId) {
             $categoryIds = $this->_product->getCategoryIds();
             if (count($categoryIds) > 0) {
                 //we need this for multi websites configuration
                 $categoryRootId = Mage::app()->getStore()->getRootCategoryId();
                 $category = Mage::getModel('catalog/category')->getCollection()->addFieldToFilter('path', array('like' => "%/{$categoryRootId}/%"))->addFieldToFilter('entity_id', $categoryIds)->setOrder('level', 'desc')->setOrder('entity_id', 'desc')->getFirstItem();
                 $categoryId = $category->getId();
             }
         }
         //load category with flat data attributes
         $category = Mage::getModel('catalog/category')->load($categoryId);
         $this->_category = $category;
         $this->_parseObjects['category'] = $category;
         if (!Mage::registry('seo_current_category')) {
             // to be sure that register will not be done twice
             Mage::register('seo_current_category', $category);
         }
     }
     $this->_parseObjects['store'] = Mage::getModel('seo/object_store');
     $this->init();
     Mage::helper('mstcore/debug')->end($uid, array('product_id' => $this->_parseObjects['product']->getId(), 'category_id' => isset($this->_parseObjects['category']) ? $this->_parseObjects['category']->getId() : false, 'store_id' => isset($this->_parseObjects['store']) ? $this->_parseObjects['store']->getId() : false));
 }
Ejemplo n.º 3
0
 public function _construct()
 {
     $uid = Mage::helper('mstcore/debug')->start();
     parent::_construct();
     $this->_category = Mage::registry('seo_current_category');
     if (!$this->_category) {
         $this->_category = Mage::registry('current_category');
     }
     if (!$this->_category) {
         return;
     }
     if ($this->_category && ($parent = $this->_category->getParentCategory())) {
         if (Mage::app()->getStore()->getRootCategoryId() != $parent->getId()) {
             if (($parentParent = $parent->getParentCategory()) && Mage::app()->getStore()->getRootCategoryId() != $parentParent->getId()) {
                 $this->setAdditionalVariable('category', 'parent_parent_name', $parentParent->getName());
             }
             $this->setAdditionalVariable('category', 'parent_name', $parent->getName());
             $this->setAdditionalVariable('category', 'parent_url', $parent->getUrl());
         }
         $this->setAdditionalVariable('category', 'url', $this->_category->getUrl());
         $this->setAdditionalVariable('category', 'page_title', $this->_category->getMetaTitle());
     }
     if ($this->_category) {
         $this->_parseObjects['category'] = $this->_category;
     }
     //мы можем создавать данную модель при расчете сео продукта
     $this->_product = Mage::registry('current_product');
     if ($this->_product) {
         $this->_parseObjects['product'] = $this->_product;
         $this->setAdditionalVariable('product', 'url', $this->_product->getProductUrl());
     }
     $this->_parseObjects['store'] = Mage::getModel('seo/object_store');
     $this->_parseObjects['pager'] = Mage::getModel('seo/object_pager');
     $this->_parseObjects['filter'] = Mage::getModel('seo/object_wrapper_filter');
     $this->init();
     Mage::helper('mstcore/debug')->end($uid, array('product_id' => isset($this->_parseObjects['product']) ? $this->_parseObjects['product']->getId() : false, 'category_id' => isset($this->_parseObjects['category']) ? $this->_parseObjects['category']->getId() : false, 'store_id' => isset($this->_parseObjects['store']) ? $this->_parseObjects['store']->getStoreId() : false));
 }
Ejemplo n.º 4
0
 public function parse($template)
 {
     return parent::parse($template);
 }