Beispiel #1
0
 /**
  * Retrieve link on product rss feed tagged with loaded tag
  *
  * @return bool|string
  */
 public function getLinkUrl()
 {
     if ($this->_isRssEnabled && $this->_tagId) {
         /** @var $tagModel Mage_Tag_Model_Tag */
         $this->_tagModel->load($this->_tagId);
         if ($this->_tagModel && $this->_tagModel->getId()) {
             return $this->_coreUrlModel->getUrl('rss/catalog/tag', array('tagName' => urlencode($this->_tagModel->getName())));
         }
     }
     return false;
 }
Beispiel #2
0
 /**
  * Add summary data to specified object
  *
  * @deprecated after 1.4.0.0
  *
  * @param Mage_Tag_Model_Tag $object
  * @return Mage_Tag_Model_Tag
  */
 public function addSummary($object)
 {
     $read = $this->_getReadAdapter();
     $select = $read->select()->from(array('relation' => $this->getTable('tag/relation')), array())->joinLeft(array('summary' => $this->getTable('tag/summary')), 'relation.tag_id = summary.tag_id AND relation.store_id = summary.store_id', array('customers', 'products', 'popularity'))->where('relation.tag_id = :tag_id')->where('relation.store_id = :store_id')->limit(1);
     $bind = array('tag_id' => (int) $object->getId(), 'store_id' => (int) $object->getStoreId());
     $row = $read->fetchRow($select, $bind);
     if ($row) {
         $object->addData($row);
     }
     return $object;
 }
 /**
  * Checks whether the already marked this product in this store by this tag and by this customer.
  * 
  * @param Mage_Tag_Model_Tag_Relation $tagRelationModel
  * @param Mage_Tag_Model_Tag $tagModel
  * @return boolean
  */
 protected function _checkLinkBetweenTagCustomerProduct($tagRelationModel, $tagModel)
 {
     return count(Mage::getModel('tag/tag_relation')->loadByTagCustomer($tagRelationModel->getProductId(), $tagModel->getId(), $tagRelationModel->getCustomerId(), $tagRelationModel->getStoreId())->getProductIds()) > 0;
 }
Beispiel #4
0
 /**
  * Validate if user has exclusive access to tag
  *
  * @param Mage_Tag_Model_Tag $model
  */
 public function tagSaveBefore($model)
 {
     $storeIds = $model->getVisibleInStoreIds();
     // Remove admin store with id 0
     $storeIds = array_filter((array) $storeIds);
     if ($model->getId() && !$this->_role->hasExclusiveStoreAccess((array) $storeIds)) {
         $this->_throwSave();
     }
 }
 /**
  * Add summary data
  *
  * @param Mage_Tag_Model_Tag $object
  * @return Mage_Tag_Model_Tag
  */
 public function addSummary($object)
 {
     $select = $this->_getReadAdapter()->select()->from($this->getTable('summary'))->where('tag_id = ?', (int) $object->getId())->where('store_id = ?', (int) $object->getStoreId())->limit(1);
     $row = $this->_getReadAdapter()->fetchRow($select);
     if ($row) {
         $object->addData($row);
     }
     return $object;
 }