Tweeted twitter.com/StackMagento/status/977191451858800640
2 edited title
source | link

Magento API complex filter value from 2 columnanother key value

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

Magento API complex filter from 2 column

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();
       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

Magento API complex filter value from another key value

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

1
source | link

Magento API complex filter from 2 column

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();
       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