1

It's really common to get the quote with an existing session.

Mage::getSingleton('checkout/session')->getQuote();

But now I want to get the quote by user without any session (Magento 1.9). Do you have an advice for me?

2
  • Your only need if you want to load a quote without session is a customer, take a look at my answer. Commented Jan 28, 2016 at 15:31
  • @SimonSolutions In which place you want to get the quote? During checkout steps?
    – sv3n
    Commented Jul 18, 2017 at 0:08

5 Answers 5

2

If you take a look at Mage_Sales_Model_Quote class you can see the function loadByCustomer.
With that you only need a Mage_Customer_Model_Customer object instance.

/** @var Mage_Customer_Model_Customer $customer **/
$quote = Mage::getModel('sales/quote')->loadByCustomer($customer);
1

If want to get Cart/Quote details then must need Quote id.

Using Mage::getModel('sales/quote') Model with help of Quote id,you can get details

Without Quote id is not possible to get data.

1

You can simply get the quote by customer with out session as below.

Mage::getModel('sales/quote')->loadByCustomer($this->_customer);
0

You could try to get it by customer_id, at least the data supports it but i doubt that it is possible with "normal magento model api" without a session.

0

=> You can simply use load method of the model :

/*@var $quote Mage_Sales_Model_Quote*/

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

It may be helpful for you.

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.