Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

API customer.list Attributes help
 
Destreyf
Jr. Member
 
Total Posts:  26
Joined:  2009-01-20
 

Hello, I’m quite new to the workings of Magento, and i am having some troubles with the SOAP API calls particularly the customer.list resource (as described in the title), i was wondering what the attributes were for the array argument of the call.

my understanding of it is that you would pass in the first name/last name and such, but this doesn’t seem to be the case, i can’t get the results from my remove search to filter at all.

Here is my code as i have it for now, to do the testing, but it still pulls up both clients, even though i’m trying to get only the firstname of “John”, another question is, does the API support wildcards?

John, Cameron (test data)

<?php
$client        
= new SoapClient('path_to_soap');
$sessionId    $client->login('xxxxxxxx''xxxxxxxxxxxx');
$data        $client->call($sessionId'customer.list', array('firstname'=>'John'));
?>
<div class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-top">Search Customers</div>
//Search options will go here when complete.
<div class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header">Search Results</div>
<
table>
    <
tr>
        <
td><strong>First Name</strong></td>
        <
td><strong>Last Name</strong></td>
        <
td><strong>Email Address</strong></td>
        <
td><strong>Date Created</strong></td>
        <
td></td>
    </
tr>
    
<?php
    
foreach($data as $k=>$v){
    ?>
    
<tr>
        <
td><?=$v['firstname'];?></td>
        <
td><?=$v['lastname'];?></td>
        <
td><?=$v['email'];?></td>
        <
td><?=date('F dS Y',strtotime($v['created_at']));?></td>
        <
td><a href="?p=<?=$this->HideURL('clients/view_client');?>&id;=<?=$v['customer_id'];?>">View</a></td>
    </
tr>
    
<?
    }
    ?>
</table>
<?php $client->endSession($session); ?>

Any help with this would be greatly appreciated.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Destreyf
Jr. Member
 
Total Posts:  26
Joined:  2009-01-20
 

Okay, so i figured out one way to do it, but as more and more customers are added it will continue to slow down, causing it to become extremely inefficient when pulling thousands of records. here my my modified code

<?php
$client        
= new SoapClient('path_to_soap');
$sessionId    $client->login('xxxxxxxx''xxxxxxxxxxxx');
$data        $client->call($sessionId'customer.list');
?>
<div class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-top">Search Customers</div>
//Search options will go here when complete.
<div class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header">Search Results</div>
<
table>
    <
tr>
        <
td><strong>First Name</strong></td>
        <
td><strong>Last Name</strong></td>
        <
td><strong>Email Address</strong></td>
        <
td><strong>Date Created</strong></td>
        <
td></td>
    </
tr>
    
<?php
    
foreach($data as $k=>$v){
     
//continues the script (skipping this row) if the requested data is not found
       
if(isset($dat['firstname']) && !eregi($dat['firstname'],$v['firstname']))continue; }
    
if(isset($dat['lastname']) && !eregi($dat['lastname'],$v['lastname']))continue; }
    
if(isset($dat['email']) && !eregi($dat['email'],$v['email']))continue; }
    
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
?>
    
<tr>
        <
td><?=$v['firstname'];?></td>
        <
td><?=$v['lastname'];?></td>
        <
td><?=$v['email'];?></td>
        <
td><?=date('F dS Y',strtotime($v['created_at']));?></td>
        <
td><a href="?p=<?=$this->HideURL('clients/view_client');?>&id;=<?=$v['customer_id'];?>">View</a></td>
    </
tr>
    
<?
    }
    ?>
</table>
<?php $client->endSession($session); ?>

I really hope this help someone out with a quick fix, in the mean time any further help would be greatly appreciated.

 
Magento Community Magento Community
Magento Community
Magento Community
 
till
Member
 
Total Posts:  58
Joined:  2007-12-17
 

Your web api call is wrong, instead, try this:

$data $client->call($sessionId'customer.list', array(array('firstname'=>'John')));
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top