コード例 #1
0
ファイル: Product.class.php プロジェクト: Cloudrexx/cloudrexx
 /**
  * Stores the Product object in the database.
  *
  * Either updates or inserts the object, depending on the outcome
  * of the call to {@link recordExists()}.
  * Also stores associated Text records.
  * @return      boolean     True on success, false otherwise
  * @author      Reto Kohli <*****@*****.**>
  */
 function store()
 {
     //DBG::activate(DBG_ADODB);
     if ($this->recordExists()) {
         if (!$this->update()) {
             return false;
         }
         if (!Attributes::removeFromProduct($this->id)) {
             return false;
         }
     } else {
         if (!$this->insert()) {
             return false;
         }
     }
     if (!\Text::replace($this->id, FRONTEND_LANG_ID, 'Shop', self::TEXT_NAME, $this->name)) {
         return false;
     }
     if (!\Text::replace($this->id, FRONTEND_LANG_ID, 'Shop', self::TEXT_SHORT, $this->short)) {
         return false;
     }
     if (!\Text::replace($this->id, FRONTEND_LANG_ID, 'Shop', self::TEXT_LONG, $this->long)) {
         return false;
     }
     if (!\Text::replace($this->id, FRONTEND_LANG_ID, 'Shop', self::TEXT_KEYS, $this->keywords)) {
         return false;
     }
     if (!\Text::replace($this->id, FRONTEND_LANG_ID, 'Shop', self::TEXT_CODE, $this->code)) {
         return false;
     }
     if (!\Text::replace($this->id, FRONTEND_LANG_ID, 'Shop', self::TEXT_URI, $this->uri)) {
         return false;
     }
     //DBG::deactivate(DBG_ADODB);
     // Store Attributes, if any
     if (is_array($this->arrRelations)) {
         foreach ($this->arrRelations as $value_id => $ord) {
             if (!Attributes::addOptionToProduct($value_id, $this->id, $ord)) {
                 return false;
             }
         }
     }
     return true;
 }