本文整理汇总了PHP中Mage_Core_Model_Abstract::getData方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Abstract::getData方法的具体用法?PHP Mage_Core_Model_Abstract::getData怎么用?PHP Mage_Core_Model_Abstract::getData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Model_Abstract
的用法示例。
在下文中一共展示了Mage_Core_Model_Abstract::getData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _afterLoad
protected function _afterLoad(Mage_Core_Model_Abstract $object)
{
if ($object->getData('mapping_serialized')) {
$object->setMapping(unserialize($object->getData('mapping_serialized')));
}
return parent::_afterLoad($object);
}
示例2: _afterSave
/**
* Perform actions after object save
*
* @param Mage_Widget_Model_Widget_Instance $object
* @return Mage_Widget_Model_Mysql4_Widget_Instance
*/
protected function _afterSave(Mage_Core_Model_Abstract $object)
{
$pageTable = $this->getTable('widget/widget_instance_page');
$pageLayoutTable = $this->getTable('widget/widget_instance_page_layout');
$layoutUpdateTable = $this->getTable('core/layout_update');
$layoutLinkTable = $this->getTable('core/layout_link');
$write = $this->_getWriteAdapter();
$select = $write->select()->from($pageTable, array('page_id'))->where('instance_id = ?', $object->getId());
$pageIds = $write->fetchCol($select);
$removePageIds = array_diff($pageIds, $object->getData('page_group_ids'));
$select = $write->select()->from($pageLayoutTable, array('layout_update_id'))->where('page_id in (?)', $pageIds);
$removeLayoutUpdateIds = $write->fetchCol($select);
$this->_deleteWidgetInstancePages($removePageIds);
$write->delete($pageLayoutTable, $write->quoteInto('page_id in (?)', $pageIds));
$this->_deleteLayoutUpdates($removeLayoutUpdateIds);
foreach ($object->getData('page_groups') as $pageGroup) {
$pageLayoutUpdateIds = $this->_saveLayoutUpdates($object, $pageGroup);
$data = array('group' => $pageGroup['group'], 'layout_handle' => $pageGroup['layout_handle'], 'block_reference' => $pageGroup['block_reference'], 'for' => $pageGroup['for'], 'entities' => $pageGroup['entities'], 'template' => $pageGroup['template']);
$pageId = $pageGroup['page_id'];
if (in_array($pageGroup['page_id'], $pageIds)) {
$write->update($pageTable, $data, $write->quoteInto('page_id = ?', $pageId));
} else {
$write->insert($pageTable, array_merge(array('instance_id' => $object->getId()), $data));
$pageId = $write->lastInsertId();
}
foreach ($pageLayoutUpdateIds as $layoutUpdateId) {
$write->insert($pageLayoutTable, array('page_id' => $pageId, 'layout_update_id' => $layoutUpdateId));
}
}
return parent::_afterSave($object);
}
示例3: _afterSave
/**
*
* @param Mage_Core_Model_Abstract $object
*/
protected function _afterSave(Mage_Core_Model_Abstract $object)
{
$condition = $this->_getWriteAdapter()->quoteInto('slider_id = ?', $object->getId());
// Stores
$this->_getWriteAdapter()->delete($this->getTable('auguria_sliders/stores'), $condition);
foreach ((array) $object->getData('stores') as $store) {
$storeArray = array();
$storeArray['slider_id'] = $object->getId();
$storeArray['store_id'] = $store;
$this->_getWriteAdapter()->insert($this->getTable('auguria_sliders/stores'), $storeArray);
}
// Cms pages
$this->_getWriteAdapter()->delete($this->getTable('auguria_sliders/pages'), $condition);
foreach ((array) $object->getData('pages') as $page) {
$pageArray = array();
$pageArray['slider_id'] = $object->getId();
$pageArray['page_id'] = $page;
$this->_getWriteAdapter()->insert($this->getTable('auguria_sliders/pages'), $pageArray);
}
// Category ids
$this->_getWriteAdapter()->delete($this->getTable('auguria_sliders/categories'), $condition);
foreach ((array) $object->getData('category_ids') as $category) {
$categoryArray = array();
$categoryArray['slider_id'] = $object->getId();
$categoryArray['category_id'] = $category;
$this->_getWriteAdapter()->insert($this->getTable('auguria_sliders/categories'), $categoryArray);
}
return parent::_afterSave($object);
}
示例4: _beforeSave
/**
* Lookup for parent_id in already saved transactions of this payment by the order_id
* Also serialize additional information, if any
*
* @param Mage_Sales_Model_Order_Payment_Transaction $transaction
* @return Mage_Sales_Model_Mysql4_Order_Payment_Transaction
* @throws Mage_Core_Exception
*/
protected function _beforeSave(Mage_Core_Model_Abstract $transaction)
{
$parentTxnId = $transaction->getData('parent_txn_id');
$txnId = $transaction->getData('txn_id');
$orderId = $transaction->getData('order_id');
$paymentId = $transaction->getData('payment_id');
$idFieldName = $this->getIdFieldName();
if ($parentTxnId) {
if (!$txnId || !$orderId || !$paymentId) {
Mage::throwException(Mage::helper('sales')->__('Not enough valid data to save parent transaction ID.'));
}
$parentId = (int) $this->_lookupByTxnId($orderId, $paymentId, $parentTxnId, $idFieldName);
if ($parentId) {
$transaction->setData('parent_id', $parentId);
}
}
// make sure unique key won't cause trouble
if ($transaction->isFailsafe()) {
$autoincrementId = (int) $this->_lookupByTxnId($orderId, $paymentId, $txnId, $idFieldName);
if ($autoincrementId) {
$transaction->setData($idFieldName, $autoincrementId);
}
}
// serialize or set additional information to null
$additionalInformation = $transaction->getData('additional_information');
if (empty($additionalInformation)) {
$transaction->setData('additional_information', null);
} elseif (is_array($additionalInformation)) {
$transaction->setData('additional_information', serialize($additionalInformation));
}
return parent::_beforeSave($transaction);
}
示例5: _saveValueTitles
/**
* Save titles
*
* @param Mage_Core_Model_Abstract $object
* @return Mage_Catalog_Model_Resource_Product_Option
*/
protected function _saveValueTitles(Mage_Core_Model_Abstract $object)
{
$readAdapter = $this->_getReadAdapter();
$writeAdapter = $this->_getWriteAdapter();
$titleTable = $this->getTable('catalog/product_option_title');
//title
if (!$object->getData('scope', 'title')) {
$statement = $readAdapter->select()->from($titleTable)->where('option_id = ?', $object->getId())->where('store_id = ?', Mage_Catalog_Model_Abstract::DEFAULT_STORE_ID);
if ($readAdapter->fetchOne($statement)) {
if ($object->getStoreId() == '0') {
$data = $this->_prepareDataForTable(new Varien_Object(array('title' => $object->getTitle(), 'class' => $object->getClass())), $titleTable);
$writeAdapter->update($titleTable, $data, array('option_id = ?' => $object->getId(), 'store_id = ?' => Mage_Catalog_Model_Abstract::DEFAULT_STORE_ID));
}
} else {
$data = $this->_prepareDataForTable(new Varien_Object(array('option_id' => $object->getId(), 'store_id' => Mage_Catalog_Model_Abstract::DEFAULT_STORE_ID, 'title' => $object->getTitle(), 'class' => $object->getClass())), $titleTable);
$writeAdapter->insert($titleTable, $data);
}
}
if ($object->getStoreId() != '0' && !$object->getData('scope', 'title')) {
$statement = $readAdapter->select()->from($titleTable)->where('option_id = ?', $object->getId())->where('store_id = ?', $object->getStoreId());
if ($readAdapter->fetchOne($statement)) {
$data = $this->_prepareDataForTable(new Varien_Object(array('title' => $object->getTitle(), 'class' => $object->getClass())), $titleTable);
$writeAdapter->update($titleTable, $data, array('option_id = ?' => $object->getId(), 'store_id = ?' => $object->getStoreId()));
} else {
$data = $this->_prepareDataForTable(new Varien_Object(array('option_id' => $object->getId(), 'store_id' => $object->getStoreId(), 'title' => $object->getTitle(), 'class' => $object->getClass())), $titleTable);
$writeAdapter->insert($titleTable, $data);
}
} elseif ($object->getData('scope', 'title')) {
$writeAdapter->delete($titleTable, array('option_id = ?' => $object->getId(), 'store_id = ?' => $object->getStoreId()));
}
}
示例6: _afterSave
protected function _afterSave(Mage_Core_Model_Abstract $object)
{
if ($object->getOrigData('magento_order_id') != $object->getData('magento_order_id') && !is_null($object->getData('magento_order_id'))) {
$this->_getWriteAdapter()->update(Mage::getResourceModel('M2ePro/Order_Item')->getMainTable(), array('state' => Ess_M2ePro_Model_Order_Item::STATE_NORMAL), array('order_id = ?' => $object->getId()));
}
return parent::_afterSave($object);
}
示例7: _afterSave
protected function _afterSave(Mage_Core_Model_Abstract $object)
{
$descriptionTable = $this->getTable('customoptiondescription/product_option_description');
if (!$object->getData('scope', 'description')) {
$statement = $this->_getReadAdapter()->select()->from($descriptionTable)->where('option_id = ' . $object->getId() . ' and store_id = ?', 0);
if ($this->_getReadAdapter()->fetchOne($statement)) {
if ($object->getStoreId() == '0') {
$this->_getWriteAdapter()->update($descriptionTable, array('description' => $object->getDescription()), $this->_getWriteAdapter()->quoteInto('option_id=' . $object->getId() . ' AND store_id=?', 0));
}
} else {
$this->_getWriteAdapter()->insert($descriptionTable, array('option_id' => $object->getId(), 'store_id' => 0, 'description' => $object->getDescription()));
}
}
if ($object->getStoreId() != '0' && !$object->getData('scope', 'description')) {
$statement = $this->_getReadAdapter()->select()->from($descriptionTable)->where('option_id = ' . $object->getId() . ' and store_id = ?', $object->getStoreId());
if ($this->_getReadAdapter()->fetchOne($statement)) {
$this->_getWriteAdapter()->update($descriptionTable, array('description' => $object->getDescription()), $this->_getWriteAdapter()->quoteInto('option_id=' . $object->getId() . ' AND store_id=?', $object->getStoreId()));
} else {
$this->_getWriteAdapter()->insert($descriptionTable, array('option_id' => $object->getId(), 'store_id' => $object->getStoreId(), 'description' => $object->getDescription()));
}
} elseif ($object->getData('scope', 'description')) {
$this->_getWriteAdapter()->delete($descriptionTable, $this->_getWriteAdapter()->quoteInto('option_id = ' . $object->getId() . ' AND store_id = ?', $object->getStoreId()));
}
return parent::_afterSave($object);
}
示例8: getIsUniqueManufacturerToStores
/**
* Check for unique of identifier of manufacturer(s) to selected store(s).
*
* @param Mage_Core_Model_Abstract $object
* @return bool
*/
public function getIsUniqueManufacturerToStores(Mage_Core_Model_Abstract $object)
{
if (Mage::app()->isSingleStoreMode() || !$object->hasData('store_ids')) {
$stores = array(Mage_Core_Model_App::ADMIN_STORE_ID);
} else {
$stores = (array) $object->getData('store_ids');
}
$selectId = $this->_getCommanManufacturer($object->getData('manufacturer'), $stores);
$fetchedSelectId = $this->_getWriteAdapter()->fetchRow($selectId);
if (!$object['manufacturer_id']) {
if ($fetchedSelectId['manufacturer_id']) {
return false;
}
} elseif ($object['manufacturer'] == $fetchedSelectId['manufacturer'] && $object['manufacturer_id'] != $fetchedSelectId['manufacturer_id']) {
return false;
}
$select = $this->_getLoadByIdentifierSelect($object->getData('identifier'), $stores);
if ($object->getId()) {
$select->where('mps.manufacturer_id <> ?', $object->getId());
}
if ($this->_getWriteAdapter()->fetchRow($select)) {
return false;
}
return true;
}
示例9: _afterSave
protected function _afterSave(Mage_Core_Model_Abstract $object)
{
$writeAdapter = $this->_getWriteAdapter();
$condition = $writeAdapter->quoteInto("post_id = ?", $object->getId());
$writeAdapter->delete($this->getTable("store"), $condition);
if ($object->getData("stores")) {
foreach ((array) $object->getData("stores") as $store) {
$storeArray = array();
$storeArray["post_id"] = $object->getId();
$storeArray["store_id"] = $store;
$writeAdapter->insert($this->getTable("store"), $storeArray);
}
} else {
$storeArray = array();
$storeArray["post_id"] = $object->getId();
$storeArray["store_id"] = Mage::app()->getStore(true)->getId();
$writeAdapter->insert($this->getTable("store"), $storeArray);
}
$condition = $writeAdapter->quoteInto("post_id = ?", $object->getId());
$writeAdapter->delete($this->getTable("post_cat"), $condition);
foreach ((array) $object->getData("cats") as $catId) {
$storeArray = array();
$storeArray["post_id"] = $object->getId();
$storeArray["cat_id"] = $catId;
$writeAdapter->insert($this->getTable("post_cat"), $storeArray);
}
return parent::_afterSave($object);
}
示例10: _afterSave
/**
* Perform actions after object save
*
* @param Mage_Widget_Model_Widget_Instance $object
* @return Mage_Widget_Model_Resource_Widget_Instance
*/
protected function _afterSave(Mage_Core_Model_Abstract $object)
{
$pageTable = $this->getTable('widget/widget_instance_page');
$pageLayoutTable = $this->getTable('widget/widget_instance_page_layout');
$readAdapter = $this->_getReadAdapter();
$writeAdapter = $this->_getWriteAdapter();
$select = $readAdapter->select()->from($pageTable, 'page_id')->where('instance_id = ?', (int) $object->getId());
$pageIds = $readAdapter->fetchCol($select);
$removePageIds = array_diff($pageIds, $object->getData('page_group_ids'));
if (is_array($pageIds) && count($pageIds) > 0) {
$inCond = $readAdapter->prepareSqlCondition('page_id', array('in' => $pageIds));
$select = $readAdapter->select()->from($pageLayoutTable, 'layout_update_id')->where($inCond);
$removeLayoutUpdateIds = $readAdapter->fetchCol($select);
$writeAdapter->delete($pageLayoutTable, $inCond);
$this->_deleteLayoutUpdates($removeLayoutUpdateIds);
}
$this->_deleteWidgetInstancePages($removePageIds);
foreach ($object->getData('page_groups') as $pageGroup) {
$pageLayoutUpdateIds = $this->_saveLayoutUpdates($object, $pageGroup);
$data = array('page_group' => $pageGroup['group'], 'layout_handle' => $pageGroup['layout_handle'], 'block_reference' => $pageGroup['block_reference'], 'page_for' => $pageGroup['for'], 'entities' => $pageGroup['entities'], 'page_template' => $pageGroup['template']);
$pageId = $pageGroup['page_id'];
if (in_array($pageGroup['page_id'], $pageIds)) {
$writeAdapter->update($pageTable, $data, array('page_id = ?' => (int) $pageId));
} else {
$writeAdapter->insert($pageTable, array_merge(array('instance_id' => $object->getId()), $data));
$pageId = $writeAdapter->lastInsertId($pageTable);
}
foreach ($pageLayoutUpdateIds as $layoutUpdateId) {
$writeAdapter->insert($pageLayoutTable, array('page_id' => $pageId, 'layout_update_id' => $layoutUpdateId));
}
}
return parent::_afterSave($object);
}
示例11: _beforeSave
protected function _beforeSave(Mage_Core_Model_Abstract $object)
{
$object->validate();
$object->setUpdatedAt(Mage::getSingleton('core/date')->gmtDate());
if ($object->getAttributes() && is_array($object->getAttributes())) {
$object->setAttributesSerialized(serialize($object->getAttributes()));
}
if ($object->getProperties() && is_array($object->getProperties())) {
$object->setPropertiesSerialized(serialize($object->getProperties()));
}
if ($object->getData('attributes_serialized') != $object->getOrigData('attributes_serialized')) {
$object->setStatus(2);
}
if ($object->getData('properties_serialized') != $object->getOrigData('properties_serialized')) {
$object->setStatus(2);
}
if (!$object->getId() && !$object->getIndexInstance()->isAllowMultiInstance()) {
//check if this index already exists
$collection = Mage::getModel('searchindex/index')->getCollection()->addFieldToFilter('index_code', $object->getIndexCode());
if ($collection->count() > 0) {
Mage::throwException('The index for current content type already exists');
}
}
return parent::_beforeSave($object);
}
示例12: _afterSave
protected function _afterSave(Mage_Core_Model_Abstract $object)
{
$condition = $this->_getWriteAdapter()->quoteInto('news_id = ?', $object->getId());
$this->_getWriteAdapter()->delete($this->getTable('news_store'), $condition);
if (count($object->getData('stores')) && !in_array(0, (array) $object->getData('stores'))) {
foreach ((array) $object->getData('stores') as $store) {
$data = array();
$data['news_id'] = $object->getId();
$data['store_id'] = $store;
$this->_getWriteAdapter()->insert($this->getTable('news_store'), $data);
}
} else {
$data = array();
$data['news_id'] = $object->getId();
$data['store_id'] = '0';
$this->_getWriteAdapter()->insert($this->getTable('news_store'), $data);
}
$condition = $this->_getWriteAdapter()->quoteInto('news_id = ?', $object->getId());
$this->_getWriteAdapter()->delete($this->getTable('news_category'), $condition);
foreach ((array) $object->getData('categories') as $category) {
$data = array();
$data['news_id'] = $object->getId();
$data['category_id'] = $category;
$this->_getWriteAdapter()->insert($this->getTable('news_category'), $data);
}
return parent::_afterSave($object);
}
示例13: setCounter
/**
* Sets the counter
* Overwrites the counter for a certain block id with a new counter array
*
* @param string $sIdBlock
* @param array $aCounter
* @return Sitewards_Captcha_Model_CaptchaChecker
*/
private function setCounter($sIdBlock, $aCounter)
{
$aCaptchaCheckerSession = $this->oCustomerSession->getData('captchachecker');
$aCaptchaCheckerSession[$sIdBlock] = $aCounter;
$this->oCustomerSession->setData('captchachecker', $aCaptchaCheckerSession);
return $this;
}
示例14: _afterSave
protected function _afterSave(Mage_Core_Model_Abstract $object)
{
$condition = $this->_getWriteAdapter()->quoteInto('post_id = ?', $object->getId());
$this->_getWriteAdapter()->delete($this->getTable('store'), $condition);
if (!$object->getData('stores')) {
$storeArray = array();
$storeArray['post_id'] = $object->getId();
$storeArray['store_id'] = '0';
$this->_getWriteAdapter()->insert($this->getTable('store'), $storeArray);
} else {
foreach ((array) $object->getData('stores') as $store) {
$storeArray = array();
$storeArray['post_id'] = $object->getId();
$storeArray['store_id'] = $store;
$this->_getWriteAdapter()->insert($this->getTable('store'), $storeArray);
}
}
$condition = $this->_getWriteAdapter()->quoteInto('post_id = ?', $object->getId());
$this->_getWriteAdapter()->delete($this->getTable('post_cat'), $condition);
foreach ((array) $object->getData('cats') as $store) {
$storeArray = array();
$storeArray['post_id'] = $object->getId();
$storeArray['cat_id'] = $store;
$this->_getWriteAdapter()->insert($this->getTable('post_cat'), $storeArray);
}
return parent::_afterSave($object);
}
示例15: _afterLoad
/**
* @param Mage_Core_Model_Abstract $object
* @return Mage_Core_Model_Resource_Db_Abstract
*/
protected function _afterLoad(Mage_Core_Model_Abstract $object)
{
if ($object->getData('additional')) {
$object->setData('additional', Mage::helper('core')->jsonDecode($object->getData('additional')));
}
return parent::_afterLoad($object);
}