1

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 1

2

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.

Your Answer

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

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