Beispiel #1
0
 protected function saveProductExtend($productId)
 {
     if (isset($_REQUEST['id']) && !empty($_REQUEST['id'])) {
         $model = ProductExtend::model()->findByAttributes(array('product_id' => $_REQUEST['id']));
     }
     if (empty($model)) {
         $model = new ProductExtend();
     }
     $message = array();
     $message['product_material'] = $_REQUEST['product_material'];
     //商品物料
     $message['warranty'] = $_REQUEST['warranty'];
     //质保
     $message['product_service'] = $_REQUEST['product_service'];
     //服务
     $message['product_size'] = $_REQUEST['product_size'];
     //尺寸
     $message['weight'] = $_REQUEST['weight'];
     //重量
     $message['make_date'] = $_REQUEST['make_date'];
     //生产日期
     $message['use_life'] = $_REQUEST['use_life'];
     //保质期
     $message['product_return'] = $_REQUEST['product_return'];
     //退换货政策
     $message['product_maintain'] = $_REQUEST['product_maintain'];
     //保养说明
     $message['use_notice'] = $_REQUEST['use_notice'];
     //使用说明
     $message['product_notice'] = $_REQUEST['product_notice'];
     //温馨提示
     $model->product_id = $productId;
     $model->other_info = serialize($message);
     $flag = $model->save();
     if (empty($flag)) {
         $error = $_REQUEST['id'] ? '修改商品扩展信息失败!' : '添加商品扩展信息失败!';
         throw new exception($error);
     }
     return true;
 }