2014-06-24 3 views
2

woo-commerce 플러그인을 사용하여 주문 세부 정보뿐만 아니라 주문 세부 정보를 모두 알려줄 수 있습니다. 하나 개의 쿼리wooocommerce에서 결제 쿠스 터 제품 및 배송 세부 정보를 포함한 모든 주문 세부 정보를 얻는 방법

내가 모두 내가 ORDER_ID 필요 예컨대 데이터

, 고객 번호, 구매 주문 번호, 주문 TYPE (DROP 배), 이름, 주소, 국가와 같은 배송 주소 세부 필요 국가, 우편 번호, 전화 번호, 지금 제품 이름, 제품 수량

모든 사용자와 관련하여이 모든 세부 사항이 필요합니다. 누구든지 도와 줄 수 있습니까?

답변

7

이것은 우연한 상인이 온라인 상인이 아닌 판매자 계정으로 지불을 처리하기 위해 작성한 맞춤 플러그인에서 가져온 것입니다. 이것은 모든 주문 데이터를 가져 와서 사용하기 위해 배열에 배치하는 함수입니다. 배송비는 필요 없기 때문에 배송비를 공백으로 남겨 뒀지 만 결제 정보와 동일한 방식으로 얻을 수 있습니다. 도움이되기를 바랍니다.

function get_itransact_args($order) 
    { 
     global $woocommerce; 
     $order_id = $order->id; 
     $billing_first_name = get_post_meta($order_id,'_billing_first_name',true); 
     $billing_last_name = get_post_meta($order_id,'_billing_last_name',true); 
     $billing_company = get_post_meta($order_id,'_billing_company',true); 
     $billing_address = get_post_meta($order_id,'_billing_address_1',true); 
     $billing_address2 = get_post_meta($order_id,'_billing_address_2',true); 
     $billing_city = get_post_meta($order_id,'_billing_city',true); 
     $billing_postcode = get_post_meta($order_id,'_billing_postcode',true); 
     $billing_country = get_post_meta($order_id,'_billing_country',true); 
     $billing_state = get_post_meta($order_id,'_billing_state',true); 
     $billing_email = get_post_meta($order_id,'_billing_email',true); 
     $billing_phone = get_post_meta($order_id,'_billing_phone',true); 
     $billing_paymethod = get_post_meta($order_id,'_payment_method',true); 


     $data = array();    
     $data['customerReference'] = $order_id.'-'.$order->order_key; 
     $data['description'] = "Payment for order id ".$order_id; 
     $data['email'] = $order->billing_email; 
     $data['INVNUM'] = $order_id; 
     $data['amount'] = number_format($order->get_total(), 2, '.', ''); 
     $data['gatewayurl'] = $this->gatewayurl; 
     $data['vendor_id'] = $this->vendorid; 
     $items = $order->get_items(); 
     foreach($items as $item) { 
      $item_id = $item['product_id']; 
      $product = new WC_Product($item_id); 
      $data["".$item_id ."-desc"] = $item['name']; 
      $data["".$item_id ."-cost"] = $product->price; 
      $data["".$item_id ."-qty"] = $item['qty']; 
     } 
     $shipping = $order->get_shipping(); 
     $data["0-desc"] = 'shipping'; 
     $data["0-cost"] = $shipping; 
     $data["0-qty"] = 1; 
     $data['ret_addr'] = add_query_arg('order', $order->id, add_query_arg('key', $order->order_key, get_permalink(woocommerce_get_page_id('pay')))); 
     $data['address'] = $billing_address. " " . $billing_address2; 
     $data['city'] = $billing_city; 
     $data['country'] = $billing_country; 
     $data['first_name'] = $billing_first_name; 
     $data['last_name'] = $billing_last_name; 
     $data['phone'] = $billing_phone; 
     $data['state'] = $billing_state; 
     $data['zip'] = $billing_postcode; 

     $data['saddr'] = ''; 
     $data['scity'] = ''; 
     $data['sctry'] = ''; 
     $data['sfname'] = ''; 
     $data['slname'] = ''; 
     $data['sstate'] = ''; 
     $data['szip'] = ''; 
     return $data; 
    } 
관련 문제