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; }
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; }