In between Records in Arrays

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mpw5013
Forum Newbie
Posts: 2
Joined: Sun Jul 31, 2011 10:43 am

In between Records in Arrays

Post by mpw5013 »

I'm able to sort the first 6,000 records using the following command, but I can't figure out the next 6000.

This Works:

Code: Select all

$filterData = array( 
    'product_id' => array('lteq' => 6000)
    ); 
This doesn't:

Code: Select all

$filterData = array( 
    'product_id' => array('gteq' => 6001, 'to'=> 7000)
    );
Any ideas?
User avatar
twinedev
Forum Regular
Posts: 984
Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio

Re: In between Records in Arrays

Post by twinedev »

All those commands do is assign a value to the variable $filterData. You would need to post the code of where those values are used for us to help.

-Greg
mpw5013
Forum Newbie
Posts: 2
Joined: Sun Jul 31, 2011 10:43 am

Re: In between Records in Arrays

Post by mpw5013 »

twinedev wrote:All those commands do is assign a value to the variable $filterData. You would need to post the code of where those values are used for us to help.

-Greg
Greg,

Not a problem:

Code: Select all

//load up local xml file for processing
	$feed_xml = simplexml_load_file($superFile);
 
	// Begin SOAP Requests
	$client = new SoapClient($myDomain.'/api/?wsdl');
	$session = $client->login($myAPILogin, $myAPIKey);
 
	$updatedProducts = "";
 
	//some counters - counting loops this way lets me see and set where the count increments
	$x = 0;
 
	//some filter date to pass to the API - add more to filter your results further - see Magento API docs
	//$filterData = array('type'=>'simple');

/*  This works...
	$filterData = array( 
    'product_id' => array('lteq' => 6000)
    ); 
  */   
 
//This down doesn't.  
 	$filterData = array( 
    'product_id' => array('gt' => 2001),
    'product_id' => array('lteq' => 3000)
    );
    
    print_r($filterData); 
    /*
    
     $filterData = array( 
    'product_id' => array(10001, 'to'=> 14000)
    ); 
*/
 
	//get all my database products into an array
	$products = $client->call($session, 'catalog_product.list', array($filterData));
  
	//loop through my product array
	foreach ($products as $product) {...
User avatar
twinedev
Forum Regular
Posts: 984
Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio

Re: In between Records in Arrays

Post by twinedev »

I've never used SoapClient myself, but from looking at the documentation (http://www.php.net/manual/en/soapclient.call.php), the call method only takes 2 parameters, not 3 like you are doing, so I'm wondering if perhaps the original result if sorted by default to begin with?

If it is actually OK with 3, then another thing probably to double check is the docs for the API you are using as to what it is programmed to receive maybe?

Sorry I can't help ya more without having the live code to play with, but now that we know what you are using hopefully someone more familiar with it can help you.

-Greg
Post Reply