Does the sales/quote object work differently than other objects when loading? See the following..


$quote = Mage::getModel('sales/quote')->getCollection()
    ->addFieldToFilter('entity_id', $quoteId)
print_r($quote->getData()); // shows right data

Does not work:

$quote = Mage::getModel('sales/quote')->load($quoteId);
print_r($quote->getData()); // empty

Both $quote are of the correct of class, Mage_Sales_Model_Quote.

  • with 5 upvotes i dont understand how this question is marked as off-topic and non-reproducible. this problem can be reproduced. Simply load a quote on frontend order view page and on admin order view page, it will work differently.webbiedave's answer works perfectly in this scenario. Jul 16, 2015 at 6:02

3 Answers 3


Set the store first:

$store = Mage::getSingleton('core/store')->load(1);

$quote = Mage::getModel('sales/quote')->setStore($store)->load($quoteId);

Nope, Mage_Sales_Model_Quote is like all the other db based models. You make something wrong. Maybe hardcode the $quoteId? Are you sure it is correct? Both codes should work.

  • Yeah, I've tried using the an integer in place of $quoteId. I'm starting to think maybe $quoteId needs to be a string or something. My script is currently running, so I'll check tomorrow.
    – laketuna
    Mar 20, 2014 at 22:38
  • Hmm, it does not work on another instance, either, with the quote entity ID hard-corded in string or integer. Fabian, have you tried the piece of the code I've posted?
    – laketuna
    Mar 21, 2014 at 14:11
  • 1
    While the model is just like other db models, the resource model Mage_Sales_Model_Resource_Quote implements a hardcoded filter on store id by _getLoadSelect(). The way around it is to use Mage::getResourceSingleton('sales/quote')->loadByIdWithoutStore($quote, $order->getQuoteId()). Now if only I can tell it to NOT load a full customer object and start a session, I'm a happy camper.
    – user4351
    Dec 22, 2014 at 6:50
  • 3
    For anyone facing the same: it's the SalesRule/Model/Observer.php that instantiates a session on quote items load. Just to get to the customerGroupId. I've solved this by rewrite Sales_Model_Quote and setting the customer group id in Mage::registry and teaching Mage_SalesRule_Model_Observer->addProductAttributes to first look there.
    – user4351
    Dec 22, 2014 at 8:31
  • 2
    Just saw this. I voted to re-open. Thanks Melvyn.
    – laketuna
    May 18, 2015 at 13:51

You could use

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

It works in Magnto Enterprise ver.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.