コード例 #1
0
ファイル: Models.php プロジェクト: beejhuff/magento-1.13.0.2
 /**
  * Save correct website list in giftwrapping
  *
  * @param Enterprise_GiftWrapping_Model_Wrapping $model
  * @return Enterprise_AdminGws_Model_Models
  */
 public function giftWrappingSaveBefore($model)
 {
     if (!$model->isObjectNew()) {
         $roleWebsiteIds = $this->_role->getRelevantWebsiteIds();
         // Website list that was assigned to current giftwrapping previously
         $origWebsiteIds = (array) $model->getResource()->getWebsiteIds($model->getId());
         // Website list that admin is currently trying to assign to current giftwrapping
         $postWebsiteIds = array_intersect((array) $model->getWebsiteIds(), $roleWebsiteIds);
         $websiteIds = array_merge(array_diff($origWebsiteIds, $roleWebsiteIds), $postWebsiteIds);
         $model->setWebsiteIds($websiteIds);
     }
     return $this;
 }
コード例 #2
0
 /**
  * Save attached websites
  *
  * @param  Enterprise_GiftWrapping_Model_Wrapping $wrapping
  * @return void
  */
 public function saveWrappingWebsiteData($wrapping)
 {
     $websiteIds = $wrapping->getWebsiteIds();
     $this->_getWriteAdapter()->delete($this->_websiteTable, array('wrapping_id = ?' => $wrapping->getId()));
     foreach ($websiteIds as $value) {
         $this->_getWriteAdapter()->insert($this->_websiteTable, array('wrapping_id' => $wrapping->getId(), 'website_id' => $value));
     }
 }