示例#1
0
 /**
  * Add attribute to good
  * @param int $attr_id attribute id
  * @param string $value value
  * @return bool success
  */
 public function AddNewAttr($attr_id, $value)
 {
     $attr_value = new AttrValue();
     $attr_value->setAttributes(array('attr_id' => $attr_id, 'value' => $value));
     if (!$attr_value->save()) {
         new CDbException('error while creating new attribute value');
     }
     $attr = new GoodAttrVal();
     $attr->attr_value_id = $attr_value->id;
     $attr->good_id = $this->id;
     return $attr->save();
 }