magento - How to filter orders collection by customer phone? -
how can filter orders collection customer phone number? here try:
$orders = mage::getmodel('sales/order')->getcollection() ->addattributetofilter('customer_phone', array('like' => '%' . $_post['filter_client_phone'] . '%'))->load();
also how can filter orders collection attribute shipping information of order?
you may filter orders collection using below query $addresstable=mage::getsingleton("core/resource")->gettablename("sales/order_address"); $orders = mage::getmodel('sales/order')->getcollection(); $select=$orders->getselect()->joinleft(array('oa'=>$addresstable),'oa.parent_id=main_table.entity_id') ->where('oa.address_type=?','shipping') ->where('oa.telephone ?','%' . $_post['filter_client_phone'] . '%');
Comments
Post a Comment