3

I have a custom soap api for my magento 1 website, the problem is i dont know what array value to pass as the filters parameter so the parameter will work like this:

 $collections = Mage::getModel('namespace/module')->getCollection()
->addFieldToFilter('created_at', array(
                    array('null' => true),
                    array('lt' => new Zend_Db_Expr('updated_at'))
                  ));

here's my api custom function which receive filters as parameter:

public function mymodulelist($filters = null){
       $collections = Mage::getModel('namespace/module')->getCollection();
       $apiHelper = Mage::helper('api');
       $filters = $apiHelper->parseFilters($filters);
       try {
           foreach ($filters as $field => $value) {
               $collections->addFieldToFilter($field, $value);
           }
       } catch (Mage_Core_Exception $e) {
           $this->_fault('filters_invalid', $e->getMessage());
       }
}

i usually use a complex filter like this:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.