且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在sales/Ordercontroller magento后端中获取sales_quote模型

更新时间:2023-11-29 23:16:22

我遇到了同样的问题.在看了一段时间的代码后,我遇到了这个功能:

I was having the same problem. After looking through the code for a while I came across this function:

Mage_Sales_Model_Quote::loadByIdWithoutStore()

我猜想常规的Mage_Sales_Model_Quote::load()函数会自动附加当前的storeview来加载报价对象.在这种情况下,storeview是admin,这意味着找不到引用ID的结果,并且返回的对象为空.

I guess the regular Mage_Sales_Model_Quote::load() function automatically attaches the current storeview to load the quote object. In this case the storeview is admin, which means no results will be found for the quote id and the returned object is empty.

根据您的情况,这应该可以正常工作:

In your case, this should work as expected:

$quote= Mage::getModel('sales/quote')->loadByIdWithoutStore($quoteid);