1

サービスモジュールとRESTサーバーをインストールして、製品と詳細のリストを取得しました。商品表示ノードと商品IDしか取得できません。

しかし、DrupalCommerceから製品の価格と在庫情報を取得する方法。

すべてのノードのリスト(製品表示ノードを含む)

http://drupalcommerce.myappdemo.com/services/node

単一の商品表示ノードを取得する http://drupalcommerce.myappdemo.com/services/node/37

ただし、製品IDは提供されますが、製品価格は提供されません。

入手方法を教えてください。

4

2 に答える 2

1

このAPIを確認してください。

 $order = commerce_cart_order_load($uid);
   // Get the order for user just logged in.
    $order_authenticated = reset(commerce_order_load_multiple(array(), array('uid' => $this->store_customer->uid, 'status' => 'cart'), TRUE));
   //update the order status
    $form_state['order'] = commerce_order_status_update($order, 'checkout_checkout', TRUE);
    // Load the order status object for the current order.
    $order_status = commerce_order_status_load($order->status);
    $profile = commerce_customer_profile_load($order->data['profiles'][$checkout_pane['pane_id']]);
    $order = commerce_order_load($order->order_id);
   // Give other modules a chance to alter the order statuses.
    drupal_alter('commerce_order_status_info', $order_statuses);
     $order_state = commerce_order_state_load($order_status['state']);
      // Load the line items for temporary storage in the form array.
    $line_items = commerce_line_item_load_multiple($line_item_ids);
    // load line item
    commerce_line_item_load($line_item_id)
    //load the commerce product
    $product = commerce_product_load($product_id)
     // Load the referenced products.
    $products = commerce_product_load_multiple($product_ids);
于 2012-03-24T06:28:52.403 に答える
1
  1. CommerceServicesモジュールをインストールします。

  2. サービスエンドポイントの「 product-display->retrieve」および「product->retrieve」リソースを有効にします。

  3. ?q = my_service_endpoint / product-display / 123.jsonでGETを実行すると、ノード123の製品表示情報が取得されます。これには、このノードによって参照される製品のIDも含まれます(製品456など)。 )、製品の価格と一緒に。

  4. オプションで、 ?q = my_service_endpoint / product / 456.jsonでGETを実行します。これにより、ID456の製品のより完全な製品情報が取得されます。

于 2013-08-02T02:32:24.117 に答える