条件付きアクションのカスタムphpコードを追加する場合、drupal / ubercartは2つのphp変数($orderと$account)を提供します。これらの変数は、完了したばかりのチェックアウトの注文とアカウントに関する情報を保持します。
これらのオブジェクトがどのように構成されているかについてのインターネットドキュメントのどこにも見つかりません...このドキュメントがどこにあるか、またはこれらのオブジェクトがどのように設定されているかは誰でも知っていますか?
ありがとう
条件付きアクションのカスタムphpコードを追加する場合、drupal / ubercartは2つのphp変数($orderと$account)を提供します。これらの変数は、完了したばかりのチェックアウトの注文とアカウントに関する情報を保持します。
これらのオブジェクトがどのように構成されているかについてのインターネットドキュメントのどこにも見つかりません...このドキュメントがどこにあるか、またはこれらのオブジェクトがどのように設定されているかは誰でも知っていますか?
ありがとう
かなり標準的なインストールで $order オブジェクトがどのように見えるかを次に示します (インストールによっては少し異なる場合があります。もちろん、注文内の製品によって、アイテム セクションがどのように見えるかが決まります。
stdClass Object
(
[order_id] => 123
[uid] => 456
[order_status] => payment_received
[order_total] => 100
[product_count] => 1
[primary_email] => test@example.com
[delivery_first_name] => Test
[delivery_last_name] => Customer
[delivery_phone] => 123-123-1234
[delivery_company] => ABC Company, Inc.
[delivery_street1] => 123 Easy St.
[delivery_street2] =>
[delivery_city] => Anytown
[delivery_zone] => 39
[delivery_postal_code] => 12345
[delivery_country] => 840
[billing_first_name] => Test
[billing_last_name] => Customer
[billing_phone] => 123-123-1234
[billing_company] => ABC Company, Inc.
[billing_street1] => 123 Easy St.
[billing_street2] =>
[billing_city] => Anytown
[billing_zone] => 39
[billing_postal_code] => 12345
[billing_country] => 840
[payment_method] => credit
[data] => Array
(
[cc_data] => ***encrypted credit card data***
)
[created] => 1295455508
[modified] => 1295457962
[host] => 127.0.0.1
[products] => Array
(
[0] => stdClass Object
(
[order_product_id] => 245
[order_id] => 123
[nid] => 5
[title] => Test Product
[manufacturer] =>
[model] => TEST-PRODUCT-SKU
[qty] => 1
[cost] => 100.00000
[price] => 100.00000
[weight] => 0
[data] => Array
(
[attributes] => Array
(
)
[shippable] => 1
[module] => uc_product
)
[order_uid] => 456
)
)
[payment_details] =>
[quote] => Array
(
[method] => flatrate_1
[accessorials] => 0
[rate] => 7.00000
[quote_form] =>
)
[line_items] => Array
(
[0] => Array
(
[line_item_id] => subtotal
[type] => subtotal
[title] => Subtotal
[amount] => 100
[weight] => 0
[data] =>
)
[1] => Array
(
[line_item_id] => 194
[type] => shipping
[title] => Flat Rate Shipping
[amount] => 7.00000
[weight] => 1
[data] =>
)
)
)
$account
ユーザーオブジェクトです。$order
ubercart 注文オブジェクトです。これらのオブジェクトの両方にいくつかの最小値が定義されていますが、実際には何でも含めることができます。その理由は、Drupal ではモジュールがユーザー オブジェクトを展開できるようにするのに対し、ubercart ではモジュールが注文オブジェクトを展開できるようにするためです。
このような状況で行う最善の方法は、オブジェクトを調べて、必要なものに到達する方法を見つけることです。
devel モジュールを使用すると、 を使用して変数をきれいに出力したり、 を使用しdsm()
て変数 ta ログ ファイルをダンプしたりできますdd()
。これらは、変数情報を取得する 2 つの方法です。