示例#1
0
 /**
  * Prepare anchor text using passed text as parameter.
  * If anchor text was not specified get entity name from DB.
  *
  * @return string
  */
 public function getAnchorText()
 {
     if (!$this->_anchorText && $this->_entityResource) {
         if (!$this->getData('anchor_text')) {
             $idPath = explode('/', $this->_getData('id_path'));
             if (isset($idPath[1])) {
                 $id = $idPath[1];
                 if ($id) {
                     $this->_anchorText = $this->_entityResource->getAttributeRawValue($id, 'name', Mage::app()->getStore());
                 }
             }
         } else {
             $this->_anchorText = $this->getData('anchor_text');
         }
     }
     return $this->_anchorText;
 }
 /**
  * Prepare category image URL using category ID.
  *
  * @return string
  */
 public function getCategoryImageUrl()
 {
     if ($this->hasStoreId()) {
         $store = Mage::app()->getStore($this->getStoreId());
     } else {
         $store = Mage::app()->getStore();
     }
     if (!$this->_categoryImageUrl && $this->_categoryResource) {
         $idPath = explode('/', $this->_getData('id_path'));
         if (isset($idPath[1])) {
             $id = $idPath[1];
             if ($id) {
                 $categoryImage = $this->_categoryResource->getAttributeRawValue($id, 'image', $store);
                 if ($categoryImage) {
                     $this->_categoryImageUrl = Mage::getBaseUrl('media') . 'catalog/category/' . $categoryImage;
                 }
             }
         }
     }
     return $this->_categoryImageUrl;
 }