There are two fields in the sales_flat_quote table which appear to do exactly... nothing.

We are building a quote system for our client that uses Magento 1.9, now moved to OpenMage / Magento 1 LTS and want to use as much existing functionality as possible. For example, it makes sense to use the existing sales_flat_quote table as it already has an is_active switch making it easy to move quotes to and from the customer's cart.


This is_changed seems to be completely unused. However, it's set to 1 on every save via the method Mage_Sales_Model_Quote::_beforeSave():

if (!$this->hasChangedFlag() || $this->getChangedFlag() == true) {
} else {

This logic sets is_changed to 1 because ...ChangedFlag is never set anywhere in the OpenMage / Magento 1 LTS code.

Side note: Even after the code was migrated to 2.x, the 2.x developer exam notes state this field is not used. I can't find the equivalent code in 2.x (unless I'm looking in the wrong place); so presumably it really is not used in 2.x.

I also looked into whether there was any link between the methods Mage_Sales_Model_Quote::hasChangedFlag(), Mage_Sales_Model_Quote::getChangedFlag() and Varien_Object::hasDataChanges() because theoretically, these would have been the same sort of indicator, had is_changed even been used.

I think it's safe to say that this field should just not be used. If the original idea was to use it as some type of event indicator, it seems that it was never implemented.


The converted_at field seems to be logical in that it should represent when a quote was converted to an order. However, this is also always NULL (it's default DB value) indicating it's never set; and there does not appear to be anywhere in the code where it's set.


Note: is_active defaults in the DB to 1 and therefore Magento has to modify it calling Mage_Sales_Model_Quote::setIsActive(false) when needing it to be is_active=0.

is_active is the flag that Magento uses to determine whether this is the active shopping cart. In Mage_Checkout_Model_Session::getQuote(), this method creates a new

In order to qualify, it must have is_active=1 and the store_id must also match.

Caveat: In Mage_Persistent_Model_Observer::setLoadPersistentQuote(), Mage_Checkout_Model_Session::setLoadInactive() is called making Mage_Checkout_Model_Session::getQuote() load an inactive cart because persistent carts are shared across stores. I think?

How To Find A Completed Quote/Cart?

When a quote/cart is completed, the is_active value is set to 0 but that does not mean it was actually converted into an order. This is because when using the admin panel to create an order, the sales/quote object is also used in the adminhtml/session object whilst the order is being made.

sales/quote's created in the admin panel are always is_active=0. This is because if they were set to is_active=1 the frontend would pick it up as an active cart.

But you can't just switch a quote/cart from is_active=0 to is_active=1 because there might already be a is_active=1 in the customer's active session. For this, there is a method called Mage_Sales_Model_Quote::merge(Mage_Sales_Model_Quote $quote) that allows you to merge in another quote which is useful (and used) for moving admin orders to the customer's active cart in Mage_Adminhtml_Model_Sales_Order_Create::moveQuoteItem().

Note: Mage_Sales_Model_Observer::cleanExpiredQuotes() deletes all quotes where the is_active value is 0 and updated_at is before the System > Config > Checkout > Cart > Quote Lifetime (days) ($lifetime *= 86400) date/time. This means that is_active = 1 quote records are never deleted and the cart will live forever.

It seems the only way to find whether a quote/cart is completed to an order is to INNER JOIN the order table sales_flat_order.quote_id = sales_flat_quote.entity_id and test for the sales_flat_quote.entity_id field being NOT NULL if an order was created.

Further reading from a similar thread.

  • Have you looked into the column reserved_order_id in the quote table?
    – kiatng
    Dec 20, 2022 at 5:26
  • @kiatng yes we did look at that. But that could technically be set and order not placed in the event of a runtime exception. So it's not all that reliable. We need a sort of after-save event flag/indicator that is definitive.
    – HenryHayes
    Dec 21, 2022 at 8:27


Your Answer

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