本文整理汇总了PHP中Mage_Core_Model_Abstract::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Abstract::save方法的具体用法?PHP Mage_Core_Model_Abstract::save怎么用?PHP Mage_Core_Model_Abstract::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Model_Abstract
的用法示例。
在下文中一共展示了Mage_Core_Model_Abstract::save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _testUpdate
protected function _testUpdate()
{
foreach ($this->_updateData as $key => $value) {
$this->_model->setDataUsingMethod($key, $value);
}
$this->_model->save();
$model = $this->_getEmptyModel();
$model->load($this->_model->getId());
foreach ($this->_updateData as $key => $value) {
PHPUnit_Framework_Assert::assertEquals($value, $model->getDataUsingMethod($key), 'CRUD Update "' . $key . '" error');
}
}
示例2: save
/**
* @param \Mage_Core_Model_Abstract $product
* @param array $gallery
* @param bool $save
* @throws ProductMediaGalleryImageNotFound
* @throws \Exception
*/
public static function save(\Mage_Core_Model_Abstract $product, array $gallery, $save = true)
{
if (!@file_exists($gallery['image'])) {
throw new ProductMediaGalleryImageNotFound('Specified product fixture gallery image does not exists -> ' . $gallery['image']);
}
$product->addImageToMediaGallery($gallery['image'], ['image', 'thumbnail', 'small_image'], false, false);
if ($save) {
$product->save();
}
}
示例3: save
public function save()
{
if (!$this->getStoreId()) {
return parent::save();
}
$cate_store = Mage::getModel('faq/faqstore')->loadByFaqIdStore($this->getFaqId(), $this->getStoreId());
$id = $cate_store->getId();
$cate_store->setData($this->getData())->setId($id)->save();
return $this;
}
示例4: save
/**
* Ovewrite default save method
*/
public function save()
{
//Se a flag de gravação de log está ativada
if ($this->grava_log) {
try {
parent::save();
} catch (Exception $e) {
$mensagem = '(' . Mage::getModel('core/date')->date("Y-m-d H:i:s") . ') ' . PHP_EOL . serialize($this->getData()) . PHP_EOL . PHP_EOL;
Mage::log($mensagem, Zend_Log::DEBUG);
}
}
}
示例5: save
public function save()
{
$speed = $this->getConfSpeed();
$title = $this->getTitle();
// Validate speed
if (!is_numeric($speed)) {
Mage::getSingleton('core/session')->addError("Speed must be set using numerical value only.");
return false;
}
// Validate title
if (preg_match('/[^-_. 0-9A-Za-z]/', $title)) {
Mage::getSingleton('core/session')->addError("Title must be alphanumeric and contain only spaces, dashes, or underscores.");
return false;
}
return parent::save();
}
示例6: save
public function save()
{
if (!$this->getStoreLatitude() || !$this->getStoreLongitude()) {
$address['street'] = $this->getAddress();
$address['city'] = $this->getCity();
$address['region'] = $this->getRegion();
$address['zipcode'] = $this->getZipcode();
$address['country'] = $this->getCountryName();
$coordinates = Mage::getModel('storepickup/gmap')->getCoordinates($address);
if ($coordinates) {
$this->setStoreLatitude($coordinates['lat']);
$this->setStoreLongitude($coordinates['lng']);
} else {
$this->setStoreLatitude('0.000');
$this->setStoreLongitude('0.000');
}
}
return parent::save();
}
示例7: save
/**
* Save object data
*
* @see Mage_Core_Model_Abstract::save()
* @return Mage_Reports_Model_Product_Index_Abstract
*/
public function save()
{
if (!$this->hasVisitorId()) {
$this->setVisitorId($this->getVisitorId());
}
if (!$this->hasCustomerId()) {
$this->setCustomerId($this->getCustomerId());
}
if (!$this->hasStoreId()) {
$this->setStoreId($this->getStoreId());
}
if (!$this->hasAddedAt()) {
$this->setAddedAt(now());
}
// Thanks to new performance tweaks it is possible to switch off visitor logging
// This check is needed to make sure report record has either visitor id or customer id
if ($this->hasVisitorId() || $this->hasCustomerId()) {
parent::save();
}
return $this;
}
示例8: save
public function save()
{
$is_canceled = false;
if ($this->getId()) {
$data = $this->getData();
$this->load($this->getId());
if ($this->getStatus() != 2 && isset($data['status']) && $data['status'] == 2) {
$is_canceled = true;
$this->noticeCanceled();
}
$this->setData($data);
}
parent::save();
if ($is_canceled) {
$auction = Mage::getModel('auction/productauction')->load($this->getProductauctionId());
$lastBid = $auction->getLastBid();
if ($lastBid->getId() < $this->getId()) {
$lastBid->noticeHighest();
}
}
}
示例9: save
/**
* Save model plus its options
* Ensures saving options in case when resource model was not changed
*/
public function save()
{
$hasDataChanges = $this->hasDataChanges();
$this->_flagOptionsSaved = false;
parent::save();
if ($hasDataChanges && !$this->_flagOptionsSaved) {
$this->_saveItemOptions();
}
}
示例10: saveCMSData
private function saveCMSData(Mage_Core_Model_Abstract $CMSModel, array $CMSData)
{
$CMSModel->setData($CMSData);
$CMSModel->setStores(array(0));
$CMSModel->save();
}
示例11: save
public function save()
{
//var_dump($this->getData());
return parent::save();
}
示例12: save
/**
* Save object data
*
* @return Mage_Catalog_Model_Product_Compare_Item
*/
public function save()
{
if ($this->hasCustomerId() || $this->hasVisitorId()) {
parent::save();
}
return $this;
}
示例13: _saveFixtureWithModelAndData
/**
* @param MagentoModel $mageModel
* @param $data
* @return mixed
* @throws \Exception
*/
protected function _saveFixtureWithModelAndData(MagentoModel $mageModel, $data)
{
MagentoStoreScope::setAdminStoreScope();
$mageModel->setData($data);
$mageModel->save();
MagentoStoreScope::setCurrentStoreScope();
return $mageModel->getId();
}
示例14: save
public function save()
{
parent::save();
$subscriptionHistory = Mage::getModel('adyen_subscription/subscription_history');
$subscriptionHistory->saveFromSubscription($this);
return $this;
}
示例15: save
public function save()
{
$this->setData('updated_at', gmdate('Y-m-d H:i:s'));
parent::save();
}