How can I filter customers by the fact if they have a quote in the sales_flat_quote
table? I could foreach
every customer to check if their email address is located in the sales_flat_quote
table, but that doesn't sound like a good way to do it.
1 Answer
You can filter that table with its corresponding collection model:
$quote = Mage::getResourceModel('sales/quote_collection')
->addAttributeToFilter('customer_id', $customer->getId())
->addAttributeToFilter('is_active', 1)
->getFirstItem();
if($quote) {
//customer has quote
}
You only need the customer ID.