Changeset 20138
- Timestamp:
- 2011/02/11 18:56:57 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_5-dev/data/class/pages/mypage/LC_Page_Mypage_Order.php
r20116 r20138 64 64 function action() { 65 65 $objCustomer = new SC_Customer(); 66 $objCartSess = new SC_CartSession();67 66 68 67 //受注詳細データの取得 69 $arr Disp= $this->lfGetOrderDetail($_POST['order_id']);68 $arrOrderDetail = $this->lfGetOrderDetail($_POST['order_id']); 70 69 71 70 //ログインしていない、またはDBに情報が無い場合 72 if (!$objCustomer->isLoginSuccess(true) or count($arrDisp) == 0){71 if (!$objCustomer->isLoginSuccess(true) || empty($arrOrderDetail)){ 73 72 SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR); 74 73 } 75 74 76 for($num = 0; $num < count($arrDisp); $num++) { 77 $product_class_id = $arrDisp[$num]['product_class_id']; 78 $quantity = $arrDisp[$num]['quantity']; 79 $product_type_id = $arrDisp[$num]['product_type_id']; 80 81 $objCartSess->addProduct($product_class_id, $quantity, $product_type_id); 82 } 75 $this->lfAddCartProducts($arrOrderDetail); 83 76 SC_Response_Ex::sendRedirect(CART_URLPATH); 84 77 } … … 95 88 // 受注詳細データの取得 96 89 function lfGetOrderDetail($order_id) { 97 $objQuery = new SC_Query(); 98 $objCustomer = new SC_Customer(); 90 $objQuery = SC_Query::getSingletonInstance(); 91 92 $objCustomer = new SC_Customer(); 99 93 //customer_idを検証 100 $customer_id = $objCustomer->getValue("customer_id");101 $order_count = $objQuery->count("dtb_order", "order_id = ? and customer_id = ?", array($order_id, $customer_id));94 $customer_id = $objCustomer->getValue("customer_id"); 95 $order_count = $objQuery->count("dtb_order", "order_id = ? and customer_id = ?", array($order_id, $customer_id)); 102 96 if ($order_count != 1) return array(); 103 $col = "product_class_id, quantity, product_type_id"; 104 $table = "dtb_order_detail LEFT JOIN dtb_products_class USING(product_class_id)"; 105 $where = "order_id = ?"; 97 98 $col = "product_class_id, quantity, product_type_id"; 99 $table = "dtb_order_detail LEFT JOIN dtb_products_class USING(product_class_id)"; 100 $where = "order_id = ?"; 106 101 $objQuery->setOrder("product_class_id"); 107 $arr Ret= $objQuery->select($col, $table, $where, array($order_id));108 return $arr Ret;102 $arrOrderDetail = $objQuery->select($col, $table, $where, array($order_id)); 103 return $arrOrderDetail; 109 104 } 105 106 // 商品をカートに追加 107 function lfAddCartProducts($arrOrderDetail) { 108 109 $objCartSess = new SC_CartSession(); 110 foreach($arrOrderDetail as $order_row) { 111 112 $objCartSess->addProduct($order_row['product_class_id'], 113 $order_row['quantity'], 114 $order_row['product_type_id']); 115 } 116 } 117 110 118 111 119 }
Note: See TracChangeset
for help on using the changeset viewer.