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

在 Magento 中獲取訂單增量 ID

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

問題描述

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

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.

我正在使用以下代碼,但在第二行出現錯誤;

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();

錯誤如下:

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

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

我想知道是否有人對如何獲取訂單增量 ID 有任何想法?這是在管理員中看到的參考編號,通常類似于:#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

推薦答案

如果您專門在結帳成功頁面上執行此操作 - 在 success.phtml 中 - 那么獲取訂單增量 ID 的代碼已在模板中可用, 因為它是顯示給客戶的.

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.

您只需要以下內容:

$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();

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

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

相關文檔推薦

Magento products by categories(按類別劃分的 Magento 產品)
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:兩個字段,匹配為 OR,而不是 AND)
quot;Error 404 Not Foundquot; in Magento Admin Login Page(“未找到錯誤 404在 Magento 管理員登錄頁面)
Skip Checkout in Magento for a downloadable product(在 Magento 中跳過結帳以獲取可下載的產品)
主站蜘蛛池模板: 久久久成人免费一区二区 | 18性欧美 | 国产麻豆乱码精品一区二区三区 | 在线观看国产视频 | 日韩精品久久久久 | 亚洲视频网| 色爱综合 | 欧美色a v | 欧美在线一区二区三区 | 国内精品久久久久久 | 久久福利 | 国产精品一区二区三区在线 | 色综合天天网 | 国产一区二区在线91 | 日本在线你懂的 | 欧美一级免费看 | 色视频欧美 | 91精品国产91久久久久久密臀 | 伊人网影院 | 中文字幕二区 | 亚洲精品一级 | 亚洲久久 | www.99re| 亚洲综合小视频 | 免费小视频在线观看 | 国产激情偷乱视频一区二区三区 | 亚洲精品一区二区三区四区高清 | 日韩一区二区免费视频 | 在线免费看黄 | 国产高潮好爽受不了了夜夜做 | 一区二区三区欧美在线 | 日韩91在线 | 亚洲iv一区二区三区 | 国产精品福利网站 | 久久91精品 | 黄色在线免费观看视频网站 | 欧美一区二区在线免费观看 | 成人精品久久 | 亚洲美女av网站 | 亚洲一区二区免费电影 | 日韩一区二区精品 |