I'm currently trying to filter some collection in core but I dont get why there doesn't seem to work so after couple days, I ask you all :
The problem lies here :
->addAttributeToFilter(array('attribute'=>'customer_firstname', 'like' => "{$data}/%")) Seems I can't get a filter with a variable alone. I wish I could get all firstanme with the piece "Do" in it.
$data = "Do"; $collection = Mage::getModel('sales/order') ->getCollection() ->addAttributeToFilter('store_id', array('in' => array($storeids)))/*Display all orders which have same website than current one*/ ->addAttributeToFilter(array('attribute'=>'customer_firstname', 'like' => "{$data}/%")) ->setPageSize(15) ->setCurPage(1) ->setOrder('created_at', 'DESC'); $this->setCollection($collection); Thanks a lot in advance
addAttributeToFilteris aliased toaddFieldToFilter