Пример #1
0
 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
0
 /**
  * @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
0
 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
0
 /**
  * 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
0
 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
0
 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
0
 /**
  * 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;
 }
 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
0
 /**
  * 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
0
 private function saveCMSData(Mage_Core_Model_Abstract $CMSModel, array $CMSData)
 {
     $CMSModel->setData($CMSData);
     $CMSModel->setStores(array(0));
     $CMSModel->save();
 }
Пример #11
0
 public function save()
 {
     //var_dump($this->getData());
     return parent::save();
 }
Пример #12
0
 /**
  * Save object data
  *
  * @return Mage_Catalog_Model_Product_Compare_Item
  */
 public function save()
 {
     if ($this->hasCustomerId() || $this->hasVisitorId()) {
         parent::save();
     }
     return $this;
 }
Пример #13
0
 /**
  * @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();
 }
 public function save()
 {
     parent::save();
     $subscriptionHistory = Mage::getModel('adyen_subscription/subscription_history');
     $subscriptionHistory->saveFromSubscription($this);
     return $this;
 }
Пример #15
0
 public function save()
 {
     $this->setData('updated_at', gmdate('Y-m-d H:i:s'));
     parent::save();
 }
Пример #16
0
 /**
  * Save quote with prevention checking
  *
  * @return Mage_Sales_Model_Quote
  */
 public function save()
 {
     if ($this->_preventSaving) {
         return $this;
     }
     return parent::save();
 }
 /**
  * Save object
  * 
  * @param Mage_Core_Model_Abstract $object Product
  * 
  * @return void
  */
 protected function save(Mage_Core_Model_Abstract $object)
 {
     try {
         $object->save();
     } catch (Zend_Db_Statement_Exception $e) {
         throw $e;
     }
 }
Пример #18
0
 /**
  * Save wishlist.
  *
  * @return Mage_Wishlist_Model_Wishlist
  */
 public function save()
 {
     $this->_hasDataChanges = true;
     return parent::save();
 }
Пример #19
0
 public function save()
 {
     if (!$this->getFilename()) {
         $this->setFilename(preg_replace('/[^\\w\\d]/', '-', trim(strtolower($this->getName()))) . '.' . $this->getType());
     }
     if (strpos($this->getFilename(), '.') === false) {
         $this->setFilename($this->getFilename() . '.' . $this->getType());
     }
     if ($id = Mage::getModel('gomage_feed/item')->load($this->getFilename(), 'filename')->getId()) {
         if ($id != $this->getId()) {
             throw new Mage_Core_Exception(Mage::helper('gomage_feed')->__('Filename "%s" exists', $this->getFilename()));
         }
     }
     return parent::save();
 }
 /**
  * Save object data
  *
  * @return Mage_Core_Model_Abstract
  */
 public function save()
 {
     $this->setDate(now());
     parent::save();
 }
Пример #21
0
 public function save()
 {
     parent::save();
 }
Пример #22
0
 public function save()
 {
     $this->isDeleted(!($this->getDepartmentIds() || $this->getAdminRoleIds()));
     return parent::save();
 }
Пример #23
0
 /**
  * Set `updated_at` to be always changed
  *
  * @return Mage_Persistent_Model_Session
  */
 public function save()
 {
     $this->setUpdatedAt(gmdate('Y-m-d H:i:s'));
     return parent::save();
 }
Пример #24
0
 /**
  * Don't ever forget to save the quote when we're saving the recurring order
  * 
  */
 public function save()
 {
     if (!$this->_quote) {
         $this->_quote = $this->getQuote();
     }
     $this->_quote->save();
     $this->setData('updated_on', date(Widgetized_Recorder_Helper_Data::DATE_FORMAT, time()));
     $results = Mage::helper('recorder')->dateHasPassed($this->getData('start_date'));
     if ($results) {
         $this->setData('start_date', date(Widgetized_Recorder_Helper_Data::DATE_FORMAT, time()));
     }
     return parent::save();
 }
Пример #25
0
 public function save()
 {
     try {
         parent::save();
     } catch (Exception $e) {
         $this->unsetData('beacon_hash');
         $this->save();
     }
 }
Пример #26
0
 public function save()
 {
     $code = $this->_generateCode($this->getData('default_name'));
     $this->setData('code', $code);
     return parent::save();
 }