0

eコマースを使用してdrupalでオフサイト支払いモジュールを作成しようとしています。特定の商品の数量と価格を調べる必要があります。Product1Quantity Product1Price Product2Quantity Product2Price など。

4

2 に答える 2

2

探している注文の order_id を取得する必要があります。これは、SQL クエリで実行できます。

order_idを取得したら、注文をロードできますcommerce_order_load($order_id)

参照: http://drupalcontrib.org/api/drupal/contributions!commerce!modules!order!commerce_order.module/function/commerce_order_load/7

$order オブジェクトがあれば、それを使って調べることができecho "<pre>"; print_r($order);ます。必要なすべての変数がそこにあると確信しています。

于 2013-10-08T23:33:38.257 に答える
0

これが私がやったことです。

    $order_wrapper = entity_metadata_wrapper('commerce_order', $order);
$quantityAndPrice = array();

foreach ( $order_wrapper->commerce_line_items as $line_item_wrapper )
{
    $quantityAndPrice .= round($line_item_wrapper->quantity->value()) ."";
    $quantityAndPrice .= $line_item_wrapper->commerce_unit_price->amount->value();
}
于 2013-10-11T14:59:39.303 に答える