I must to update a code created by another programmer. It uses php - SOAP
to connect Magento. I was digging to understand what he did and I found a query using Complex Filter against sales_order_invoice.list
. This is the Complex Filter:
$complexFilter = array(
'complex_filter' => array(
array(
'key' => 'CREATED_AT',
'value' => array(
'key' => 'from',
'value' => '2015-10-16 01:24:37'
)
),
array(
'key' => 'state',
'value' => array(
'key' => '=',
'value' => '2'
)
),
array(
'key' => 'store_id',
'value' => array(
'key' => 'in',
'value' => '5,6'
)
)
)
);
This is the code to connect:
$cli = new SoapClient("http://MYstaging.com/api/v2_soap/?wsdl");
$username = 'myuser';
$password = 'myPass';
$session_id = $cli->login($username, $password);
#$cli->__setCookie('XDEBUG_SESSION', 'netbeans-xdebug');
$result = $cli->salesOrderInvoiceList($session_id, $complexFilter);
As we can see, the query should retrieve some information from salesOrderInvoiceList
, and it does. This is the result:
array (size=1)
0 =>
object(stdClass)[2]
public 'increment_id' => string '500000001' (length=9)
public 'created_at' => string '2015-10-16 20:07:18' (length=19)
public 'order_currency_code' => string 'YYY' (length=3)
public 'order_id' => string '9' (length=1)
public 'state' => string '2' (length=1)
public 'grand_total' => string '00.0000' (length=7)
public 'invoice_id' => string '3' (length=1)
I do not understand this. If we check the Magendo doc to sales_order_invoice.list
, there is no store_id
content or field. So it should not be possible to use it as a filter. But it does exists in the sales_order_invoice.info
.
Well, if I change store_id
field for something that do not exist at all, lets say "BLAH_BLAH" certainly I would have nothing as result. And it is what is happening. And it makes sense. Behind the scenes maybe we have a sql 1054 (Unknow column) error.
$complexFilter = array(
'complex_filter' => array(
array(
'key' => 'CREATED_AT',
'value' => array(
'key' => 'from',
'value' => '2015-10-16 01:24:37'
)
),
array(
'key' => 'state',
'value' => array(
'key' => '=',
'value' => '2'
)
),
array(
'key' => 'BLAH_BLAH',
'value' => array(
'key' => 'in',
'value' => '5,6'
)
)
)
);
Can someone explain why salesOrderInvoiceList
is accepting store_id
as filter?
store_id
as a filter would be incredibly important.store_id
is very important. So the possible conclusion is the field exist in the table but not i documentation. Otherwise we should have the same error as fieldBLAH_BLAH