本文整理汇总了PHP中Mage_Core_Model_Abstract::setData方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Abstract::setData方法的具体用法?PHP Mage_Core_Model_Abstract::setData怎么用?PHP Mage_Core_Model_Abstract::setData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Model_Abstract
的用法示例。
在下文中一共展示了Mage_Core_Model_Abstract::setData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _afterLoad
/**
* Add customer group ids and website ids to rule data after load
*
* @param Mage_Core_Model_Abstract $object
*
* @return Mage_SalesRule_Model_Resource_Rule
*/
protected function _afterLoad(Mage_Core_Model_Abstract $object)
{
$object->setData('customer_group_ids', (array) $this->getCustomerGroupIds($object->getId()));
$object->setData('website_ids', (array) $this->getWebsiteIds($object->getId()));
parent::_afterLoad($object);
return $this;
}
示例2: 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;
}
示例3: _beforeSave
protected function _beforeSave(Mage_Core_Model_Abstract $object)
{
if (is_null($object->getOrigData())) {
$object->setData('create_date', Mage::helper('M2ePro')->getCurrentGmtDate());
}
$object->setData('update_date', Mage::helper('M2ePro')->getCurrentGmtDate());
return $this;
}
示例4: _afterLoad
protected function _afterLoad(Mage_Core_Model_Abstract $object)
{
if ($object->getId()) {
$stores = $this->lookupStoreIds($object->getId());
$object->setData('store_id', $stores);
$object->setData('stores', $stores);
}
return parent::_afterLoad($object);
}
示例5: _afterLoad
protected function _afterLoad(Mage_Core_Model_Abstract $object)
{
if ($object->getData('segments_codes')) {
if (is_string($object->getData('segments_codes'))) {
$object->setData('segments_codes', explode(',', $object->getData('segments_codes')));
}
} else {
$object->setData('segments_codes', array());
}
}
示例6: _beforeSave
/**
* Also serialize additional information
*
* @param Mage_Core_Model_Abstract $payment
*/
protected function _beforeSave(Mage_Core_Model_Abstract $payment)
{
$additionalInformation = $payment->getData('additional_information');
if (empty($additionalInformation)) {
$payment->setData('additional_information', null);
} elseif (is_array($additionalInformation)) {
$payment->setData('additional_information', serialize($additionalInformation));
}
return parent::_beforeSave($payment);
}
示例7: _afterLoad
protected function _afterLoad(Mage_Core_Model_Abstract $object)
{
$areas = @unserialize($object->getData('areas_content'));
if (is_array($areas)) {
$object->setData('areas_content', $areas);
} else {
$object->setData('areas_content', array('content' => $object->getData('areas_content')));
}
return $this;
}
示例8: _beforeSave
protected function _beforeSave(Mage_Core_Model_Abstract $object)
{
if (is_array($object->getData('value'))) {
$object->setData('value_serialized', serialize($object->getData('value')));
}
if (is_array($object->getData('target'))) {
$object->setData('target_serialized', serialize($object->getData('target')));
}
Mage::dispatchEvent('webforms_logic_before_save', array('logic' => $object));
return parent::_beforeSave($object);
}
示例9: _afterLoad
protected function _afterLoad(Mage_Core_Model_Abstract $object)
{
if ($object->getData('segments_cut')) {
$object->setData('segments_cut', explode(',', $object->getData('segments_cut')));
} else {
$object->setData('segments_cut', array());
}
if ($object->getData('segments_paste')) {
$object->setData('segments_paste', explode(',', $object->getData('segments_paste')));
} else {
$object->setData('segments_paste', array());
}
}
示例10: _afterLoad
protected function _afterLoad(Mage_Core_Model_Abstract $object)
{
$webform = Mage::getModel('webforms/webforms')->load($object->getData('webform_id'));
$select = $this->_getReadAdapter()->select()->from($this->getTable('webforms/results_values'))->where('result_id = ?', $object->getId());
$values = $this->_getReadAdapter()->fetchAll($select);
foreach ($values as $val) {
$object->setData('field_' . $val['field_id'], $val['value']);
$object->setData('key_' . $val['field_id'], $val['key']);
}
$object->setData('ip', long2ip($object->getCustomerIp()));
Mage::dispatchEvent('webforms_result_load', array('webform' => $webform, 'result' => $object));
return parent::_afterLoad($object);
}
示例11: _beforeSave
protected function _beforeSave(Mage_Core_Model_Abstract $object)
{
$currentTimestamp = Mage::helper('M2ePro')->getCurrentGmtDate();
if (is_null($object->getOrigData())) {
$object->setData('create_date', $currentTimestamp);
$object->setData('synch_date', $currentTimestamp);
}
$object->setData('update_date', $currentTimestamp);
if ($object->getOrigData('synch_date') != $object->getData('synch_date') && $object->getData('synch_date') == $object->getOrigData('update_date')) {
$object->setData('synch_date', $object->getData('update_date'));
}
return $this;
}
示例12: _afterLoad
/**
* @param Mage_Core_Model_Abstract $object
* @return self
*/
protected function _afterLoad(Mage_Core_Model_Abstract $object)
{
if ($object->getId()) {
$recipients = $this->lookupRecipients($object->getId());
$object->setData('recipients', $recipients);
if ($details = $this->lookupDetails($object->getId())) {
unset($details['trigger_id']);
foreach ($details as $name => $value) {
$object->setData($name, $value);
}
}
}
return parent::_afterLoad($object);
}
示例13: setPost
/**
* Set the post this comment is associated to
*
* @param Fishpig_Wordpress_Model_Post $post
* @return Fishpig_Wordpress_Model_Post_Comment
*/
public function setPost(Fishpig_Wordpress_Model_Post $post)
{
$this->setPostId($post->getId());
$this->setData('comment_post_ID', $post->getId());
return parent::setData('post', $post);
}
示例14: _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);
}
示例15: processFile
/**
* Uploads single file and set the relative file path in the model
*
* @param Mage_Core_Model_Abstract $object
* @param Jarlssen_UploaderComponent_Model_Config $config
*
* @throws Exception
*/
public function processFile(Mage_Core_Model_Abstract $object, Jarlssen_UploaderComponent_Model_Config $config)
{
$inputName = $config->getInputName();
$uploadPath = $config->getAbsoluteUploadPath();
try {
if ($result = $this->_upload($config, $uploadPath, $_FILES[$inputName]['name'])) {
$fileName = $result['file'];
$relativeFilePath = $config->getRelativeUploadPath() . DS . $fileName;
$object->setData($inputName, $relativeFilePath);
}
} catch (Exception $e) {
$object->setData($inputName, $object->getOrigData($inputName));
Mage::logException($e);
throw new Exception($e->getMessage(), $e->getCode(), $e);
}
}