2

私のマジェントの問題であなたの助けが必要です。注文を追跡するための成功ページの追跡コードがあります。これは私の追跡コードです:

<script language="javascript" type="text/javascript">
(function(){
var properties = {};
properties.billing_orderid      = 'PLEASE ADD A UNIQUE ORDER ID'; // this id must be unique otherwise we will count the conversion only once
properties.billing_address      = 'NULL'; // if needed
properties.billing_customerid   = 'NULL'; // if needed
properties.billing_sum          = 'ADD BASKET VALUE HERE, ONLY . SIGN ALLOWED';

// each line represents a product, please add neccassary line for each product and put the right values into it
properties.ec_Event=[
 // Syntax: Action, ProductID, Name, Price, Category, Number of Items, NULL, NULL, NULL
 // please avoid any ' sign in each value especially in the product name or make the right javascript quoting by using \' instead of single '
 ['buy' /* stay fix */ 'YOUR PRODUCT ID', 'PRODUCT NAME', 'PRICE', 'CATEGORY', NUMER OF ITEMS, 'NULL' /* stay fix */, 'NULL' /* stay fix */, 'NULL' /* stay fix */],
 ['buy', 'ABC123', 'Nike shoe ', '50.00', 'shoes/nike', 2,'NULL', 'NULL', 'NULL']];
A3320.trackEvent(properties);
})();
</script>

合計金額を取得する方法を知っています:

$total = sprintf("%1\$.2f",$grandTotal);

しかし、製品リストを取得する方法がわかりません。あなたの誰かが私にヒントを持っていますか?

どうもありがとうございました!

ドイツからのご挨拶、ライシス

4

1 に答える 1

4

成功ページでは、オーダー ID にアクセスできます。$this->getOrderId();

注文をロードし、注文アイテムをループして製品を取得するよりも:

$_order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
foreach ($_order->getAllItems() as $item) {
// do stuff with the item or optionally load them to get full product.
}

PS: SKU または ID でロードできます:$product = Mage::getModel('catalog/product')->loadByAttributeまたは$product = Mage::getModel('catalog/product')->load(<productID>)

于 2013-01-17T09:31:54.380 に答える