Пример #1
0
 /**
  * @return array List of fields to update with according values.
  */
 public function getStateToSave()
 {
     $toSave = parent::getStateToSave();
     foreach ($this->dirtyFields as $field) {
         switch ($field) {
             case 'regular_price':
                 $toSave['regular_price'] = $this->regularPrice;
                 break;
         }
     }
     $toSave['sales_enabled'] = $this->sales->isEnabled();
     $toSave['sales_from'] = $this->sales->getFrom()->getTimestamp();
     $toSave['sales_to'] = $this->sales->getTo()->getTimestamp();
     $toSave['sales_price'] = $this->sales->getPrice();
     $toSave['stock_manage'] = $this->stock->getManage();
     $toSave['stock_stock'] = $this->stock->getStock();
     $toSave['stock_allow_backorders'] = $this->stock->getAllowBackorders();
     $toSave['stock_sold'] = $this->stock->getSoldQuantity();
     if ($toSave['stock_manage']) {
         $toSave['stock_status'] = (int) (0 < $toSave['stock_stock']);
     } else {
         $toSave['stock_status'] = $this->stock->getStatus();
     }
     return $toSave;
 }
Пример #2
0
 /**
  * @return array List of fields to update with according values.
  */
 public function getStateToSave()
 {
     $toSave = parent::getStateToSave();
     $toSave['sales_enabled'] = $this->sales->isEnabled();
     $toSave['sales_from'] = $this->sales->getFrom()->getTimestamp();
     $toSave['sales_to'] = $this->sales->getTo()->getTimestamp();
     $toSave['sales_price'] = $this->sales->getPrice();
     return $toSave;
 }
Пример #3
0
 /**
  * @return array List of fields to update with according values.
  */
 public function getStateToSave()
 {
     $toSave = parent::getStateToSave();
     foreach ($this->dirtyFields as $field) {
         switch ($field) {
             case 'regular_price':
                 $toSave['regular_price'] = $this->regularPrice;
                 break;
             case 'external_url':
                 $toSave['external_url'] = $this->url;
                 break;
         }
     }
     $toSave['sales_enabled'] = $this->sales->isEnabled();
     $toSave['sales_from'] = $this->sales->getFrom()->getTimestamp();
     $toSave['sales_to'] = $this->sales->getTo()->getTimestamp();
     $toSave['sales_price'] = $this->sales->getPrice();
     return $toSave;
 }