Search code examples
phpsortingmagentomagento-soap-api

Sort Customer and Product details in magento SOAP API


Is there any predefined function/method using magento SOAP API to getting customer,product other details in sorted List/data. I want to sort customer details by email, last name ,first name or by other detail Using Magento SOAP API.


Solution

  • if(isset($_REQUEST['field_name']))
        {
           $collection = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('*');
           $collection->setOrder($_REQUEST['field_name'],'ASC');
           $collection->load();
           $data=$collection->toArray();
    }
    

    I used above code and it work. We can put any thing like first name ,last name,email etc in place of field_name and it will short according to it.