久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

在 Magento 中獲取訂單增量 ID

Get Order Increment Id in Magento(在 Magento 中獲取訂單增量 ID)
本文介紹了在 Magento 中獲取訂單增量 ID的處理方法,對大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我正在嘗試在 Magento 中的 success.phtml 頁面上獲取訂單增量 ID,以便我可以將其用于會(huì)員跟蹤.

I'm trying to get the Order Increment Id in Magento, on the success.phtml page so that I can use this for affiliate tracking.

我正在使用以下代碼,但在第二行出現(xiàn)錯(cuò)誤;

I'm using the following code, but it is giving an error on the second line;

$order = Mage::getSingleton('sales/order')->getLastOrderId();
$lastOrderId = $order->getIncrementId();

錯(cuò)誤如下:

致命錯(cuò)誤:在第 34 行調(diào)用非對象上的成員函數(shù) getIncrementId():$LastOrderId = $order->getIncrementId();

Fatal error: Call to a member function getIncrementId() on a non-object on line 34: $LastOrderId = $order->getIncrementId();

我想知道是否有人對如何獲取訂單增量 ID 有任何想法?這是在管理員中看到的參考編號(hào),通常類似于:#1000123

I was wondering if anyone has any ideas on how to get the Order Increment Id? This is the reference number seen in the admin, usually something like: #1000123

推薦答案

如果您專門在結(jié)帳成功頁面上執(zhí)行此操作 - 在 success.phtml 中 - 那么獲取訂單增量 ID 的代碼已在模板中可用, 因?yàn)樗秋@示給客戶的.

If you're specifically doing this on the checkout success page - in success.phtml - then the code to get the order increment ID is already available in the template, since it is displayed to the customer.

您只需要以下內(nèi)容:

$orderId = $this->getOrderId();

請注意,這不適用于其他頁面,因此,對于那些頁面,您需要使用:

Note that this won't work on other pages so, for those, you'd need to use:

$orderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();

這篇關(guān)于在 Magento 中獲取訂單增量 ID的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Magento products by categories(按類別劃分的 Magento 產(chǎn)品)
Resource interpreted as image but transferred with MIME type text/html - Magento(資源被解釋為圖像但使用 MIME 類型 text/html 傳輸 - Magento)
Is there an event for customer account registration in Magento?(Magento 中是否有客戶帳戶注冊事件?)
Magento addFieldToFilter: Two fields, match as OR, not AND(Magento addFieldToFilter:兩個(gè)字段,匹配為 OR,而不是 AND)
quot;Error 404 Not Foundquot; in Magento Admin Login Page(“未找到錯(cuò)誤 404在 Magento 管理員登錄頁面)
Skip Checkout in Magento for a downloadable product(在 Magento 中跳過結(jié)帳以獲取可下載的產(chǎn)品)
主站蜘蛛池模板: 日韩视频二区 | 成人免费福利视频 | 亚洲国产小视频 | 亚洲男人天堂网 | 午夜看看| 亚洲第一色 | 91午夜精品亚洲一区二区三区 | 日本特黄一级片 | 精品免费国产一区二区三区四区 | 天天操夜夜撸 | 伊人久久精品视频 | 男女裸体无遮挡做爰 | 亚洲区一区二 | 国产黄色在线观看 | 天天干天天干天天干 | 国产精品一区三区 | 欧美一级欧美三级 | 欧美不卡在线 | 91视频在线 | 天天操天天干天天 | 亚洲国产91 | 免费av网站在线观看 | 国产日韩欧美一区二区 | 国产免费自拍视频 | 一级特黄aaaaaa大片 | 久久精品国产亚洲 | 最新超碰 | 久久久久久黄色 | 欧美日韩在线免费观看 | 又黄又爽又色视频 | 午夜视频在线播放 | 成人免费网站在线观看 | 亚洲综合免费 | 黄色小视频在线播放 | 黄色免费观看视频 | 亚洲激情网站 | 在线一区视频 | 亚洲一区二区免费视频 | 精品久久久久久久 | 国产精品视频一区二区三区 | 高清无码|