コード例 #1
0
ファイル: Product.php プロジェクト: bklein01/siberian_cms_2
 public function save()
 {
     $this->checkType();
     if (!$this->getIsDeleted()) {
         if (!$this->getPosition()) {
             $this->setPosition($this->findLastPosition($this->getValueId()));
         }
         if (!$this->getData('type')) {
             $this->setData('type', 'simple');
         }
         if ($this->getData('type') == 'simple') {
             $price = Core_Model_Language::normalizePrice($this->getData('price'));
             $this->setData('price', $price);
         }
         //MCommerce multi pictures
         $this->addPictures();
         $this->deletePictures();
         parent::save();
         if ($this->getNewCategoryIds()) {
             $this->getTable()->saveCategoryIds($this->getId(), $this->getNewCategoryIds());
         }
         $this->getType()->setProduct($this)->save();
     } else {
         parent::save();
     }
     return $this;
 }
コード例 #2
0
ファイル: Product.php プロジェクト: bklein01/SiberianCMS
 public function save()
 {
     $this->checkType();
     if (!$this->getPosition()) {
         $this->setPosition($this->findLastPosition($this->getValueId()));
     }
     if (!$this->getData('type')) {
         $this->setData('type', 'simple');
     }
     if ($this->getData('type') == 'simple') {
         $price = Core_Model_Language::normalizePrice($this->getData('price'));
         $this->setData('price', $price);
     }
     parent::save();
     if ($this->getNewCategoryIds()) {
         $this->getTable()->saveCategoryIds($this->getId(), $this->getNewCategoryIds());
     }
     $this->getType()->setProduct($this)->save();
     return $this;
 }