久久久久久久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 中跳過結帳以獲取可下載的產品)
主站蜘蛛池模板: 久久久久久久夜 | 国产精品资源在线观看 | 涩涩操| 欧美精品影院 | 玖玖视频免费 | 亚洲精品在线免费 | 国产精品永久久久久久久www | 欧美亚洲国产一区 | 欧美狠狠操| 日韩第1页 | 日本精品一区二区三区四区 | 天天干.com| 精品一二区 | 天天干国产| 久久久久久网站 | 欧美涩 | 亚洲九九 | 国产亚洲一区精品 | 日韩无| 成人国产一区二区三区精品麻豆 | 精国产品一区二区三区 | 欧美精品一区二区三区蜜桃视频 | 精品久久中文字幕 | 国产乱码精品一区二区三区忘忧草 | 亚洲成人黄色 | 国产精品久久久久久一级毛片 | 日韩毛片在线视频 | 911网站大全在线观看 | 欧美视频在线看 | 国产在线精品一区二区 | 欧美无乱码久久久免费午夜一区 | 欧美激情第一区 | chengrenzaixian| 精品国产乱码久久久久久蜜退臀 | 欧美激情视频一区二区三区在线播放 | 国产成人在线视频免费观看 | 欧美网址在线观看 | 久久精品在线 | 日韩三级一区 | 激情久久网 | 日韩三级在线 |