openlabs / magento

Python API for Magento
Other
136 stars 82 forks source link

Magento logs error when Customer.list() called without filters. #2

Closed iiijjjii closed 13 years ago

iiijjjii commented 13 years ago

This isn't horribly critical but Magento logs an error message whenever the Customer.list() api call is used without filters. My solution was to pass an empty filters dict.

Here is specifics of the error:

errorCode: 8
errorMessage: Undefined variable: filters
errorFile: /srv/http/magento/app/code/core/Mage/Customer/Model/Customer/Api.php
errorLine: 101

Here is an excerpt of the code.

 96     public function items($filters)
 97     {
 98         $collection = Mage::getModel('customer/customer')->getCollection()
 99             ->addAttributeToSelect('*');
100
101         if (is_array($filters)) {
102             try {
103                 foreach ($filters as $field => $value) {
104                     if (isset($this->_mapAttributes[$field])) {
105                         $field = $this->_mapAttributes[$field];
106                     }
107
108                     $collection->addFieldToFilter($field, $value);
109                 }
110             } catch (Mage_Core_Exception $e) {
111                 $this->_fault('filters_invalid', $e->getMessage());
112             }
113         }