久久久久久久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 中跳過結帳以獲取可下載的產品)
主站蜘蛛池模板: 欧美日韩a| 午夜网| 一区二区播放 | 国产三级 | 亚洲a毛片 | 人人射人人草 | 成人av在线播放 | 玖玖色在线视频 | 亚洲草草视频 | 国产精品免费一区二区三区四区 | 在线观看国产www | 亚洲在线一区 | 精品久久久久久久久久 | 亚洲视频免费在线看 | 91精品国模一区二区三区 | 色视频网站 | 日日操视频 | 九九久久国产 | 国产黄色在线观看 | 一本一道久久a久久精品蜜桃 | 欧美日韩精选 | 伦理午夜电影免费观看 | 四虎影院美女 | 精品久久精品 | 91在线中文字幕 | 久草视频在线播放 | 中文字幕在线观看一区 | 日韩中文字幕2019 | 日韩高清国产一区在线 | 天天综合网永久 | 欧美性极品xxxx做受 | xxx.在线观看 | 91美女在线观看 | 亚洲国产精品激情在线观看 | 国产在线一区二区三区 | 日日噜噜噜夜夜爽爽狠狠视频, | 国产亚洲精品久久久久动 | 亚洲自拍偷拍欧美 | 精品九九久久 | 欧美人妇做爰xxxⅹ性高电影 | 亚洲人人|