当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Core_Model_Abstract::getEntityId方法代码示例

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


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

示例1: delete

 /**
  * Delete Code by entity id and import type
  *
  * @param Mage_Core_Model_Abstract $object
  *
  * @return $this
  */
 public function delete(Mage_Core_Model_Abstract $object)
 {
     $adapter = $this->_getWriteAdapter();
     if ($object->getImport() && $object->getEntityId()) {
         $values = array('entity_id = ?' => $object->getEntityId(), 'import = ?' => $object->getImport());
         $adapter->delete($this->getMainTable(), $values);
     }
     return $this;
 }
开发者ID:techpub,项目名称:PIMGento,代码行数:16,代码来源:Code.php

示例2: _afterDelete

 protected function _afterDelete(Mage_Core_Model_Abstract $object)
 {
     Mage::helper('udratings')->useEt($object->getEntityId());
     parent::_afterDelete($object);
     Mage::helper('udratings')->resetEt();
     return $this;
 }
开发者ID:xiaoguizhidao,项目名称:magento,代码行数:7,代码来源:Rating.php

示例3: getData

 /**
  * Sets indexer metadata for product entities
  *
  * @param Mage_Core_Model_Abstract $product
  * @return array
  */
 public function getData(Mage_Core_Model_Abstract $product)
 {
     $data = array();
     $data['entity_id'] = $product->getEntityId();
     $data['type_id'] = $product->getTypeId();
     $data['store_id'] = $product->getStoreId();
     $data['store_ids'] = $product->getStoreIds();
     $data['name_suggest'] = $this->_prepareNameSuggestField($product);
     $data['name_suggest_static'] = $product->getNameSuggestInputIndexValue();
     return $data;
 }
开发者ID:adrianoaguiar,项目名称:magento-elasticsearch-module,代码行数:17,代码来源:Product.php

示例4: aggregate

 /**
  * Aggregate
  *
  * @param Mage_Core_Model_Abstract $object
  */
 public function aggregate($object)
 {
     $readAdapter = $this->_getReadAdapter();
     $writeAdapter = $this->_getWriteAdapter();
     if (!$object->getEntityPkValue() && $object->getId()) {
         $object->load($object->getReviewId());
     }
     $ratingModel = Mage::getModel('rating/rating');
     $ratingSummaries = $ratingModel->getEntitySummary($object->getEntityPkValue(), false);
     foreach ($ratingSummaries as $ratingSummaryObject) {
         if ($ratingSummaryObject->getCount()) {
             $ratingSummary = round($ratingSummaryObject->getSum() / $ratingSummaryObject->getCount());
         } else {
             $ratingSummary = $ratingSummaryObject->getSum();
         }
         $reviewsCount = $this->getTotalReviews($object->getEntityPkValue(), true, $ratingSummaryObject->getStoreId());
         $select = $readAdapter->select()->from($this->_aggregateTable)->where('entity_pk_value = :pk_value')->where('entity_type = :entity_type')->where('store_id = :store_id');
         $bind = array(':pk_value' => $object->getEntityPkValue(), ':entity_type' => $object->getEntityId(), ':store_id' => $ratingSummaryObject->getStoreId());
         $oldData = $readAdapter->fetchRow($select, $bind);
         $data = new Varien_Object();
         $data->setReviewsCount($reviewsCount)->setEntityPkValue($object->getEntityPkValue())->setEntityType($object->getEntityId())->setRatingSummary($ratingSummary > 0 ? $ratingSummary : 0)->setStoreId($ratingSummaryObject->getStoreId());
         $writeAdapter->beginTransaction();
         try {
             if ($oldData['primary_id'] > 0) {
                 $condition = array("{$this->_aggregateTable}.primary_id = ?" => $oldData['primary_id']);
                 $writeAdapter->update($this->_aggregateTable, $data->getData(), $condition);
             } else {
                 $writeAdapter->insert($this->_aggregateTable, $data->getData());
             }
             $writeAdapter->commit();
         } catch (Exception $e) {
             $writeAdapter->rollBack();
         }
     }
 }
开发者ID:hazaeluz,项目名称:magento_connect,代码行数:40,代码来源:Review.php


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