本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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();
}
}
}