简体   繁体   中英

get magento order id from customer data

I'm having problems getting a collection with join working. I'm trying to get the order ID's connected to customer telephone numbers, saved in sales_flat_order_address . So a join on the collection with sales/order and a filter based on the variable with my phone number in it. I've tried all sorts of combinations, but so far I only get errors and right now I've deleted my code and will try from scratch. Any ideas or links to tutorials about this?

Small code snippet below

$customer = Mage::getModel('customer/customer')->getCollection()
->addAttributeToFilter('attribute_code', value)->load();
//Here your attribute code is phone
$orderCollection = Mage::getModel(’sales/order’)->getCollection();
$orderCollection->getSelect()->where(’e.customer_id =’.$customer->getId()); 

:)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM