• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Mage_Catalog_Model_Abstract类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Mage_Catalog_Model_Abstract的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Catalog_Model_Abstract类的具体用法?PHP Mage_Catalog_Model_Abstract怎么用?PHP Mage_Catalog_Model_Abstract使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Mage_Catalog_Model_Abstract类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: afterSave

 /**
  * After Save Attribute manipulation
  *
  * @param Mage_Catalog_Model_Abstract $object
  * @return $this
  */
 public function afterSave($object)
 {
     //        var_dump($object);exit;
     $hasChanges = $object->dataHasChangedFor($this->getAttribute()->getName());
     if (!$hasChanges) {
         return $this;
     }
     $data = $object->getData($this->getAttribute()->getName());
     return $this;
 }
开发者ID:tormit,项目名称:Ho_Import,代码行数:16,代码来源:Profile.php


示例2: _saveAttributeValue

 /**
  * Insert or Update attribute data
  *
  * @param Mage_Catalog_Model_Abstract $object
  * @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute
  * @param mixed $value
  * @return Mage_Catalog_Model_Resource_Abstract
  */
 protected function _saveAttributeValue($object, $attribute, $value)
 {
     $write = $this->_getWriteAdapter();
     //set default store id
     $storeId = Mage_Catalog_Model_Abstract::DEFAULT_STORE_ID;
     $table = $attribute->getBackend()->getTable();
     /**
      * If we work in single store mode all values should be saved just
      * for default store id
      * In this case we clear all not default values
      */
     if (Mage::app()->isSingleStoreMode()) {
         $storeId = $this->getDefaultStoreId();
         $write->delete($table, array('attribute_id = ?' => $attribute->getAttributeId(), 'entity_id = ?' => $object->getEntityId(), 'store_id <> ?' => $storeId));
     }
     $data = new Varien_Object(array('entity_type_id' => $attribute->getEntityTypeId(), 'attribute_id' => $attribute->getAttributeId(), 'store_id' => $storeId, 'entity_id' => $object->getEntityId(), 'value' => $this->_prepareValueForSave($value, $attribute)));
     $bind = $this->_prepareDataForTable($data, $table);
     if ($attribute->isScopeStore()) {
         /**
          * Update attribute value for store
          */
         $this->_attributeValuesToSave[$table][] = $bind;
     } else {
         if ($attribute->isScopeWebsite() && $storeId != $this->getDefaultStoreId()) {
             /**
              * Update attribute value for website
              */
             $storeIds = Mage::app()->getStore($storeId)->getWebsite()->getStoreIds(true);
             foreach ($storeIds as $storeId) {
                 $bind['store_id'] = (int) $storeId;
                 $this->_attributeValuesToSave[$table][] = $bind;
             }
         } else {
             /**
              * Update global attribute value
              */
             $bind['store_id'] = $this->getDefaultStoreId();
             $this->_attributeValuesToSave[$table][] = $bind;
         }
     }
     return $this;
 }
开发者ID:magebrew,项目名称:magentoSetBaseImage,代码行数:50,代码来源:Product.php


示例3: _updateAttributeForStore

 /**
  * Update attribute value for specific store
  *
  * @param   Mage_Catalog_Model_Abstract $object
  * @param   object $attribute
  * @param   mixed $value
  * @param   int $storeId
  * @return  Mage_Catalog_Model_Resource_Eav_Mysql4_Abstract
  */
 protected function _updateAttributeForStore($object, $attribute, $value, $storeId)
 {
     $entityIdField = $attribute->getBackend()->getEntityIdField();
     $select = $this->_getWriteAdapter()->select()->from($attribute->getBackend()->getTable(), 'value_id')->where('entity_type_id=?', $object->getEntityTypeId())->where("{$entityIdField}=?", $object->getId())->where('store_id=?', $storeId)->where('attribute_id=?', $attribute->getId());
     /**
      * When value for store exist
      */
     if ($valueId = $this->_getWriteAdapter()->fetchOne($select)) {
         $this->_getWriteAdapter()->update($attribute->getBackend()->getTable(), array('value' => $this->_prepareValueForSave($value, $attribute)), 'value_id=' . $valueId);
     } else {
         $this->_getWriteAdapter()->insert($attribute->getBackend()->getTable(), array($entityIdField => $object->getId(), 'entity_type_id' => $object->getEntityTypeId(), 'attribute_id' => $attribute->getId(), 'value' => $this->_prepareValueForSave($value, $attribute), 'store_id' => $storeId));
     }
     return $this;
 }
开发者ID:joebushi,项目名称:magento-mirror,代码行数:23,代码来源:Abstract.php


示例4: isEntityVisible

 public function isEntityVisible(Mage_Catalog_Model_Abstract $entity, $customerGroupId = null)
 {
     // if the module is deactivated or a store view all entities are visible
     if (!$this->isModuleActive($entity->getStoreId())) {
         return true;
     }
     $cachedState = $entity->getData(self::HIDE_GROUPS_ATTRIBUTE_STATE_CACHE);
     if (!is_null($cachedState)) {
         return $cachedState;
     }
     // Default to the current customer group id
     if (is_null($customerGroupId)) {
         $customerGroupId = $this->getCustomerGroupId();
     }
     $groupIds = $entity->getData(self::HIDE_GROUPS_ATTRIBUTE);
     if (!is_array($groupIds) && !is_string($groupIds)) {
         // If the value isn't set on the entity mode fall back to querying the db index table
         $visibility = Mage::getResourceSingleton('netzarbeiter_groupscatalog2/filter')->isEntityVisible($entity, $customerGroupId);
         $entity->setData(self::HIDE_GROUPS_ATTRIBUTE_STATE_CACHE, $visibility);
         return $visibility;
     }
     /* @var $entityType string The entity type code for the specified entity */
     $entityType = $this->getEntityTypeCodeFromEntity($entity);
     if (is_string($groupIds)) {
         if ('' === $groupIds) {
             // This case will not happen in production:
             // at least USE_DEFAULT or USE_NONE should be in the value array.
             // Just your average paranoia...
             $groupIds = array();
         } else {
             $groupIds = explode(',', $groupIds);
         }
     }
     if (in_array(self::USE_NONE, $groupIds)) {
         $groupIds = array();
     } elseif (in_array(self::USE_DEFAULT, $groupIds)) {
         // Get the default settings for this entity type without applying the mode settings
         $groupIds = $this->getEntityVisibleDefaultGroupIds($entityType, $entity->getStore(), false);
     }
     // If the configured mode is 'show' the list of group ids must be inverse
     $groupIds = $this->applyConfigModeSettingByStore($groupIds, $entityType, $entity->getStore());
     $visibility = in_array($customerGroupId, $groupIds);
     $entity->setData(self::HIDE_GROUPS_ATTRIBUTE_STATE_CACHE, $visibility);
     return $visibility;
 }
开发者ID:aniljaiswal,项目名称:order-confirmation,代码行数:45,代码来源:Data.php


示例5: isEnabledProduct

 /**
  * isEnabledProduct
  *
  * @param Mage_Catalog_Model_Abstract $product
  * @return boolean
  */
 public function isEnabledProduct(Mage_Catalog_Model_Abstract $product)
 {
     return Mage_Catalog_Model_Product_Status::STATUS_ENABLED == $product->getStatus();
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:10,代码来源:Data.php


示例6: _setAttributeValue

 /**
  * Initialize attribute value for object
  *
  * @param Mage_Catalog_Model_Abstract $object
  * @param array $valueRow
  * @return Mage_Catalog_Model_Resource_Abstract
  */
 protected function _setAttributeValue($object, $valueRow)
 {
     $attribute = $this->getAttribute($valueRow['attribute_id']);
     if ($attribute) {
         $attributeCode = $attribute->getAttributeCode();
         $isDefaultStore = $valueRow['store_id'] == $this->getDefaultStoreId();
         if (isset($this->_attributes[$valueRow['attribute_id']])) {
             if ($isDefaultStore) {
                 $object->setAttributeDefaultValue($attributeCode, $valueRow['value']);
             } else {
                 $object->setAttributeDefaultValue($attributeCode, $this->_attributes[$valueRow['attribute_id']]['value']);
             }
         } else {
             $this->_attributes[$valueRow['attribute_id']] = $valueRow;
         }
         $value = $valueRow['value'];
         $valueId = $valueRow['value_id'];
         $object->setData($attributeCode, $value);
         if (!$isDefaultStore) {
             $object->setExistsStoreValueFlag($attributeCode);
         }
         //            $attribute->getBackend()->setEntityValueId($object, $valueId);
         $attribute->getBackend()->setValueId($valueId);
     }
     return $this;
 }
开发者ID:eniuz,项目名称:entitytype-manager,代码行数:33,代码来源:Entity.php


示例7: _generateNextUrlKeySuffix

 /**
  * Generate unique url key if current url key already occupied
  *
  * @param Mage_Catalog_Model_Abstract $object
  * @return Mage_Catalog_Model_Abstract
  */
 protected function _generateNextUrlKeySuffix(Mage_Catalog_Model_Abstract $object)
 {
     $prefixValue = $object->getData($this->getAttribute()->getAttributeCode());
     $requestPathField = new Zend_Db_Expr($this->_connection->quoteIdentifier('value'));
     //select increment part of request path and cast expression to integer
     $urlIncrementPartExpression = $this->_eavHelper->getCastToIntExpression($this->_connection->getSubstringSql($requestPathField, strlen($prefixValue) + 1, $this->_connection->getLengthSql($requestPathField) . ' - ' . strlen($prefixValue)));
     $prefixRegexp = preg_quote($prefixValue);
     $orCondition = $this->_connection->select()->orWhere($this->_connection->prepareSqlCondition('value', array('regexp' => '^' . $prefixRegexp . '$')))->orWhere($this->_connection->prepareSqlCondition('value', array('regexp' => '^' . $prefixRegexp . '-[0-9]*$')))->getPart(Zend_Db_Select::WHERE);
     $select = $this->_connection->select();
     $select->from($this->getAttribute()->getBackendTable(), new Zend_Db_Expr('MAX(ABS(' . $urlIncrementPartExpression . '))'))->where('value LIKE :url_key')->where('entity_id <> :entity_id')->where(implode('', $orCondition));
     $bind = array('url_key' => $prefixValue . '%', 'entity_id' => (int) $object->getId());
     $suffix = $this->_connection->fetchOne($select, $bind);
     if (!is_null($suffix)) {
         $suffix = (int) $suffix;
         $object->setData($this->getAttribute()->getAttributeCode(), sprintf('%s-%s', $prefixValue, ++$suffix));
     }
     return $object;
 }
开发者ID:QiuLihua83,项目名称:magento-enterprise-1.13.1.0,代码行数:24,代码来源:Urlkey.php


示例8: testIsReadonly

 /**
  * @covers Mage_Catalog_Model_Abstract::isReadonly
  * @covers Mage_Catalog_Model_Abstract::setIsReadonly
  */
 public function testIsReadonly()
 {
     $this->assertFalse($this->_model->isReadonly());
     $this->_model->setIsReadonly(true);
     $this->assertTrue($this->_model->isReadonly());
 }
开发者ID:relue,项目名称:magento2,代码行数:10,代码来源:AbstractTest.php


示例9: _updateAttributeForStore

 /**
  * Update attribute value for specific store
  *
  * @param Mage_Catalog_Model_Abstract $object
  * @param object $attribute
  * @param mixed $value
  * @param int $storeId
  * @return Mage_Catalog_Model_Resource_Abstract
  */
 protected function _updateAttributeForStore($object, $attribute, $value, $storeId)
 {
     $adapter = $this->_getWriteAdapter();
     $table = $attribute->getBackend()->getTable();
     $entityIdField = $attribute->getBackend()->getEntityIdField();
     $select = $adapter->select()->from($table, 'value_id')->where('entity_type_id = :entity_type_id')->where("{$entityIdField} = :entity_field_id")->where('store_id = :store_id')->where('attribute_id = :attribute_id');
     $bind = array('entity_type_id' => $object->getEntityTypeId(), 'entity_field_id' => $object->getId(), 'store_id' => $storeId, 'attribute_id' => $attribute->getId());
     $valueId = $adapter->fetchOne($select, $bind);
     /**
      * When value for store exist
      */
     if ($valueId) {
         $bind = array('value' => $this->_prepareValueForSave($value, $attribute));
         $where = array('value_id = ?' => (int) $valueId);
         $adapter->update($table, $bind, $where);
     } else {
         $bind = array($idField => (int) $object->getId(), 'entity_type_id' => (int) $object->getEntityTypeId(), 'attribute_id' => (int) $attribute->getId(), 'value' => $this->_prepareValueForSave($value, $attribute), 'store_id' => (int) $storeId);
         $adapter->insert($table, $bind);
     }
     return $this;
 }
开发者ID:barneydesmond,项目名称:propitious-octo-tribble,代码行数:30,代码来源:Abstract.php


示例10: _lockAttribute

 /**
  * Lock a specific category or product attribute so that it can not be editted through the interface.
  * @param Mage_Eav_Model_Entity_Attribute $attribute
  * @param Mage_Catalog_Model_Abstract     $model
  * @param                                 $profile
  */
 protected function _lockAttribute(Mage_Eav_Model_Entity_Attribute $attribute, Mage_Catalog_Model_Abstract $model, $profile)
 {
     $note = $attribute->getNote() ? $attribute->getNote() : '';
     if ($attribute->getAttributeCode() == 'ho_import_profile') {
         return;
     }
     if ($note) {
         $note .= "<br />\n";
     }
     $note .= Mage::helper('ho_import')->__("Locked by import: <i>%s</i>", $profile);
     $model->lockAttribute($attribute->getAttributeCode());
     $attribute->setNote($note);
 }
开发者ID:tormit,项目名称:Ho_Import,代码行数:19,代码来源:Observer.php


示例11: _afterSave

 /**
  * Init indexing process after category save
  *
  * @return Mage_Catalog_Model_Category
  */
 protected function _afterSave()
 {
     $result = parent::_afterSave();
     Mage::getSingleton('Mage_Index_Model_Indexer')->processEntityAction($this, self::ENTITY, Mage_Index_Model_Event::TYPE_SAVE);
     return $result;
 }
开发者ID:natxetee,项目名称:magento2,代码行数:11,代码来源:Category.php


示例12: getCollection

 public function getCollection()
 {
     return parent::getCollection();
 }
开发者ID:evinw,项目名称:project_bloom_magento,代码行数:4,代码来源:Product.php


示例13: afterCommitCallback

 /**
  * Callback function which called after transaction commit in resource model
  *
  * @return Mage_Catalog_Model_Product
  */
 public function afterCommitCallback()
 {
     parent::afterCommitCallback();
     /** @var \Mage_Index_Model_Indexer $indexer */
     $indexer = Mage::getSingleton('index/indexer');
     $indexer->processEntityAction($this, self::ENTITY, Mage_Index_Model_Event::TYPE_SAVE);
     return $this;
 }
开发者ID:cewolf2002,项目名称:magento,代码行数:13,代码来源:Product.php


示例14: delete

 public function delete()
 {
     parent::delete();
     Mage::dispatchEvent($this->_eventPrefix . '_delete_after_done', array($this->_eventObject => $this));
     return $this;
 }
开发者ID:albertobraschi,项目名称:magento-design-training,代码行数:6,代码来源:Product.php


示例15: _construct

 protected function _construct()
 {
     parent::_construct();
     $this->_init('prolabels/index');
 }
开发者ID:jokusafet,项目名称:MagentoSource,代码行数:5,代码来源:Index.php


示例16: getImage

 /**
  * Sets product image from it's child if possible
  *
  * @return string
  */
 public function getImage()
 {
     $this->getTypeInstance()->setImageFromChildProduct($this);
     return parent::getImage();
 }
开发者ID:natxetee,项目名称:magento2,代码行数:10,代码来源:Product.php


示例17: _beforeDelete

 /**
  * Before delete process
  *
  * @return Mage_Catalog_Model_Category
  */
 protected function _beforeDelete()
 {
     $this->_protectFromNonAdmin();
     if ($this->getResource()->isForbiddenToDelete($this->getId())) {
         Mage::throwException("Can't delete root category.");
     }
     return parent::_beforeDelete();
 }
开发者ID:jauderho,项目名称:magento-mirror,代码行数:13,代码来源:Category.php


示例18: _beforeDelete

 protected function _beforeDelete()
 {
     $this->_protectFromNonAdmin();
     return parent::_beforeDelete();
 }
开发者ID:HelioFreitas,项目名称:magento-pt_br,代码行数:5,代码来源:Category.php


示例19: setOrigData

 /**
  * Set original loaded data if needed
  *
  * @param string $key
  * @param mixed $data
  * @return Varien_Object
  */
 public function setOrigData($key = null, $data = null)
 {
     if (Mage::app()->getStore()->isAdmin()) {
         return parent::setOrigData($key, $data);
     }
     return $this;
 }
开发者ID:Rinso,项目名称:magento-mirror,代码行数:14,代码来源:Product.php


示例20: getCacheIdTags

 /**
  * Get cahce tags associated with object id
  *
  * @return array
  */
 public function getCacheIdTags()
 {
     $tags = parent::getCacheIdTags();
     $affectedCategoryIds = $this->getAffectedCategoryIds();
     if (!$affectedCategoryIds) {
         $affectedCategoryIds = $this->getCategoryIds();
     }
     foreach ($affectedCategoryIds as $categoryId) {
         $tags[] = Mage_Catalog_Model_Category::CACHE_TAG . '_' . $categoryId;
     }
     return $tags;
 }
开发者ID:codercv,项目名称:urbansurprisedev,代码行数:17,代码来源:Product.php



注:本文中的Mage_Catalog_Model_Abstract类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Mage_Catalog_Model_Category类代码示例发布时间:2022-05-23
下一篇:
PHP Mage_Catalog_Block_Product_List类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap