public function load($id, $field = null) { if (is_null($id)) { return $this->noRoutePage(); } return parent::load($id, $field); }
/** * Load object data * * @param integer $id * @return Mage_Core_Model_Abstract */ public function load($id, $field = null) { $this->setData(array()); $this->_quote = null; parent::load($id, $field); return $this; }
public function load($id, $field = null) { parent::load($id, $field); if ($this->getStoreId()) { $this->getMultiStoreValue(); } return $this; }
public function load($id = false, $column = false) { parent::load($id, 'order_id'); if (!$this->getId()) { $this->setId($id); } return $this; }
/** * Loads the associated attachment meta data * This data is stored as a serialized array * * @param int $id * @param string $field * @return Fishpig_Wordpress_Model_Post_Attachment_Abstract */ public function load($id, $field = null) { parent::load($id, $field); $this->loadSerializedData(); return $this; }
public function load($id, $field = null) { if (is_null($field) && !is_numeric($id)) { $this->_name = $id; return parent::load($this->getSignature(), 'signature'); } return parent::load($id, $field); }
/** * @param int $id * @param null $field * @return ISM_Slider_Model_Slider */ public function load($id, $field = null) { if (!intval($id) && is_string($id)) { $field = 'identifier'; } parent::load($id, $field); return $this; }
/** * Load a model by attribute code * * @param Mage_Core_Model_Abstract $model * @param string $attributeCode * @param string $value * @return Mage_Core_Model_Abstract */ protected function _loadExistingModel($model, $attributeCode, $value) { foreach ($model->getCollection() as $singleModel) { if ($singleModel->getData($attributeCode) == $value) { $model->load($singleModel->getId()); return $model; } } return $model; }
public function load($id, $field = null) { parent::load($id, $field); Mage::dispatchEvent($this->_eventPrefix . '_load_store_value_before', $this->_getEventData()); if ($this->getStoreId()) { $this->loadStoreValue(); } Mage::dispatchEvent($this->_eventPrefix . '_load_store_value_after', $this->_getEventData()); return $this; }
public function loadByCode($code) { if (empty($code) || strlen($code) > self::GIFT_CARD_CODE_MAX_LENGTH) { return $this; } $collection = $this->getCollection()->addFieldToFilter('code', $code)->setPageSize(1); if ($collection->count() == 0) { return $this; } return parent::load($collection->getFirstItem()->getId()); }
public function load($id, $field = null) { parent::load($id, $field); if ($this->getIsDeleted()) { return Mage::getModel('giftvoucher/giftvoucher'); } if ($this->getStatus() == Magestore_Giftvoucher_Model_Status::STATUS_ACTIVE && $this->getExpiredAt() && $this->getExpiredAt() < now()) { $this->setStatus(Magestore_Giftvoucher_Model_Status::STATUS_EXPIRED); } return $this; }
public function load($id, $field = null) { $store_id = $this->getStoreId(); if (!$store_id) { return parent::load($id, $field = null); } $cat = Mage::getModel('faq/categorystore')->loadByCatIdStore($id, $store_id); $this->setData($cat->getData()); $this->setId($id); return $this; }
/** * @return Lanot_Core_Block_Adminhtml_Grid_Abstract */ protected function _getItem() { if ($this->_item !== null) { return $this->_item; } $itemId = $this->getRequest()->getParam($this->_itemParam); $this->_item = $this->_getItemModel(); if ($itemId) { $this->_item->load($itemId); } return $this->_item; }
public function load($id, $field = null) { $store_id = $this->getStoreId(); if (!$store_id) { return parent::load($id, $field = null); } $faq = Mage::getModel('faq/faqstore')->loadByFaqIdStore($id, $store_id); if ($faq->getIsApplied() == '0') { $this->setData($faq->getData()); } elseif ($faq->getIsApplied() == '1' && !Mage::getSingleton('admin/session')->isLoggedIn()) { parent::load($id, $field = null); } else { $this->setData($faq->getData()); } $this->setId($id); return $this; }
public function load($id, $field = null) { parent::load($id, $field); $xml = Mage::getConfig()->getNode('modules/' . $id); $this->setId($id); $this->setDepends(array()); if ($xml) { $data = $xml->asCanonicalArray(); if (isset($data['depends']) && is_array($data['depends'])) { $data['depends'] = array_keys($data['depends']); } else { $data['depends'] = array(); } $this->addData($data); } return $this; }
/** * @see parent * * @param Bronto_Api $api */ public function onBeforeLogin($api) { if ($this->hasSetSession()) { $this->unsSessionId(); Mage::helper('bronto_common')->writeDebug('Session ID expired for token: ' . $this->getToken()); $this->_setOnce = false; } else { try { parent::load($api->getToken()); if ($this->hasSessionId()) { $api->setSessionId($this->getSessionId()); Mage::helper('bronto_common')->writeDebug('Hitting API sessionId cache for token: ' . $this->getToken()); $this->_setOnce = true; } } catch (Exception $e) { // Swallow read exceptions, in case of FTP install Mage::helper('bronto_common')->writeError('Failed to read from api session table: ' . $e->getMessage()); } } }
/** * Override load method to provide object cache * * @param mixed $id * @param string $field = null * @return $this */ public function load($id, $field = null) { if (!is_null($field)) { $id = $this->_encodeLoadingValue($id, $field); } if ($this->getSkipObjectCache()) { return parent::load($id, $field); } $class = get_class($this); if ($this->getPostType()) { $class = '::' . $this->getPostType(); } if (!isset(self::$_objectCache[$class])) { self::$_objectCache[$class] = array(); } if (is_null($field) && isset(self::$_objectCache[$class][$id])) { return self::$_objectCache[$class][$id]; } parent::load($id, $field); if ($this->getId()) { self::$_objectCache[$class][$id] = $this; } return $this; }
public function load($id, $field = null, $tree = false) { parent::load($id, $field); if ($this->getId() && $this->getId() == $this->getParentId()) { $this->setParentId(0); $this->parent = 0; $this->save(); } if ($this->getId() && $this->getId() == $this->getAfterId()) { $this->setAfterId(0); $this->save(); } if (!$this->getId() || $tree) { $this->getTrendsChildren(); } return $this; }
/** * Custom load * * @param int|string $id * @param string $field * @return Mage_Core_Model_Website */ public function load($id, $field = null) { if (!is_numeric($id) && is_null($field)) { $this->_getResource()->load($this, $id, 'code'); return $this; } return parent::load($id, $field); }
public function load($id, $field = null) { return parent::load($id, $field); }
/** * 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(); } } }
public function load($id, $field = 'guid') { return parent::load($id, $field); }
public function load($id, $field = null) { $this->_validated = false; $this->_isValid = false; parent::load($id); $this->_afterLoad(); $this->prepareData(); return $this; }
public function load($id, $field = null) { $this->_accountHash = $id; return parent::load($id, $field); }