Note that there are some explanatory texts on larger screens.

plurals
  1. POControl the number of results from a Magento API call
    primarykey
    data
    text
    <p>I have a program that we use to connect our Magento store to our back end Inventory Control system via the API. Currently what it does is query the Magento API for all orders in Pending status, inserts them into the back end system, then sets their status to Processing in Magento. Due to limitations on our Inventory system, we can only insert a limited number of orders at a time. We control this by running the whole process through an if loop as shown below (FYI, code has been edited down to show only the key parts of this problem):</p> <pre><code>//The maximum number of orders to download $iMaxCount = 10 ; try { $proxy = new SoapClient($wsdl_url); } catch (Exception $e) { echo 'Caught exception: ', $e-&gt;getMessage(), "\n"; } $sessionId = $proxy-&gt;login($login, $password); //fetch the pending orders from the site $field = array(array('status'=&gt;array( 'pending') )); $arr = $proxy-&gt;call($sessionId, 'sales_order.list', $field); $iCnt = 0; foreach($arr as $key =&gt; $value){ //only down up to the max count if ($iCnt &lt; $iMaxCount) { [... Do the updating and insertion part of the program ...] $iCnt++; } //End of looping through orders </code></pre> <p>The obvious downfall of doing it this way is I still have to pull all Pending orders even though I am going to be working with only 10 of them. i.e. If I have 200 pending orders, the API returns all 200 of them, processes 10, then skips the rest. What I want to do is modify the filter of the API call to pull only 10 orders at a time of status Processing. This would allow me to remove the if loop overhead and make the program run more efficiently because it only gets the data it needs. </p> <p>Does anyone know how to apply that type of filter? Everything I have seen suggest you can only do this if you know the order numbers and set limits based on that. Thanks for your help!!!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload