Good Afternoon,

I'm almost done, but something is wrong. I have 19k records that I need to sort through in an array, but I can't figure out how to get the in between records.

This works just fine:

$filterData = array( 
    'product_id' => array('lteq' => 6000)
    );

This doesn't:

$filterData = array( 
    'product_id' => array(6001, 'to'=> 12000)
    );

What is an in-between type command for an array? Is their a To: and From?

Member Avatar
diafol
$newarray = array_slice($array, 10, 210); //11th to 221st items

Or are you looking for something else? I wasn't aware that 'lteq' was a php attribute. Am I missing something here? Are you suing Magneto or similar?

$newarray = array_slice($array, 10, 210); //11th to 221st items

Or are you looking for something else? I wasn't aware that 'lteq' was a php attribute. Am I missing something here? Are you suing Magneto or similar?

That would work, but its trying to load the hole products list, thus causing the original memory error. I'm trying to figure out a way to load only a certain amount of products into memory and then compare them with an XML file.

Member Avatar
diafol

But the data is already in an array? I'm a little confused as to where you data is stored. Maybe you could use ajax to 'chunk up' the chosen items into manageable pieces. This may have the advantage of being able to use a progress bar. This should be reasonably trivial, especially if you use something like jQuery.

Technically no. It loading it. A perfect world I would run this statement:

//$filterData = array('type'=>'simple');

This would load all 19k products into the array / memory and allow me to sort through them.

The problem is I can only load 6,000 before I get a SOAP memory error.

Member Avatar
diafol

OK, I didn't realise that you were getting the data via SOAP. Hmm. I'm not aware of the $filterData usage. Can you show more of the code?

$myFilename22 = 'available_batchnynyn_022.xml';
 
 
  for ($i=1; $i <= 22; $i++) {

	 $superFile = ${'myFilename'.$i};
	  
	  
 
	//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');

/*
	$filterData = array( 
    'product_id' => array('lteq' => 6000)
    ); 
  */   
 
 	$filterData = array( 
    'product_id' => array('gt' => 2001),
    'product_id' => array('lteq' => 3000)
    );
    
    print_r($filterData); 
 
 
	//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) {
Member Avatar
diafol

I see, OK, I thought perhaps you were using Magneto.

I'm no expert on this, how about:

'product_id' => array('gt' => 2001, 'lteq' => 3000)