public function customizeOrder($info) { $prd_info = array(); if (isset($info['images'])) { $images = $info['images']; for ($i = 0; $i < count($images); $i++) { if ($i > 2) { break; } // maybe we should make image here $prd_info['image' . ($i + 1)] = $images[$i]; $prd_info['image' . ($i + 1) . '_400'] = $images[$i]; $prd_info['image' . ($i + 1) . '_thumb'] = $images[$i]; } } $product = Product::addCustomized($prd_info); $stone = Stone::add(array('weight' => $info['stone'])); $order = Order::addCustomized(array('order_no' => Order::makeOrderSn(), 'customer' => $this->id, 'product' => $product->id, 'material' => $info['material'], 'stone' => $stone->id, 'size' => $info['size'], 'carve_text' => $info['carve_text'], 'customer_remark' => $info['remark'])); if (isset($info['images'])) { CustomizeImage::add(array('order' => $order->id, 'images' => $info['images'])); } $order->submit(); }