Prestashop: [API] Filtering orders by date_add

Created on 3 Oct 2018  路  7Comments  路  Source: PrestaShop/PrestaShop

Describe the bug
When querying the API using this type of URL :
https://www.myprestashopsite.com/api/orders/?display=full&filter[current_state]=[4|5|25]&filter[date_add]=[2018-07-01,2018-07-31]&date=1&sort=date_add_DESC (_or ASC_)

It doesn't show orders that are placed on the 1st of July, or on the 31st of July. I have to change my filter this way :
filter[date_add]=[2018-06-30,2018-08-01]

Only then I have thoses orders.

To Reproduce
Steps to reproduce the behavior:

  1. Query the API with a date filter
  2. Order those by date (to better see the problem)

Additionnal information
PrestaShop version: 1.7.3.3
PHP version: 7.0 (FPM)

1.7.4.2 1.7.6.0 1.7.7.x Bug Minor To Do WS Webservice

All 7 comments

Hi @Ludofloria,

When I use the date_add filter, I don't get any result.
There is no filter on date_add and date_upd for order object.
Access the following URL - http://shop_name/api/orders/?display=full&filter[date_add]=[2018-09-27] which should give me the orders between the orders added in this date but the XML response for the above method says

<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<errors>
<error>
<code>
<![CDATA[ 32 ]]>
</code>
<message>
<![CDATA[
This filter does not exist. Did you mean: "total_paid"? The full list is: "id", "id_address_delivery", "id_address_invoice", "id_cart", "id_currency", "id_lang", "id_customer", "id_carrier", "current_state", "module", "invoice_number", "invoice_date", "delivery_number", "delivery_date", "valid", "shipping_number", "id_shop_group", "id_shop", "secure_key", "payment", "recyclable", "gift", "gift_message", "mobile_theme", "total_discounts", "total_discounts_tax_incl", "total_discounts_tax_excl", "total_paid", "total_paid_tax_incl", "total_paid_tax_excl", "total_paid_real", "total_products", "total_products_wt", "total_shipping", "total_shipping_tax_incl", "total_shipping_tax_excl", "carrier_tax_rate", "total_wrapping", "total_wrapping_tax_incl", "total_wrapping_tax_excl", "round_mode", "round_type", "conversion_rate", "reference"
]]>
</message>
</error>
</errors>
</prestashop>

Reported in the forge.

In order to this filter to work, you have to add "&date=1" ;)

@Ludofloria, thanks!

Yes, you are right, to show orders that are placed on the 1st of July, or on the 31st of July. I have to change my filter this way :
filter[date_add]=[2018-06-30,2018-08-01]
This issue is added to our bug roadmap.

Thanks for this extremely quick feedback :)

@khouloudbelguith Could you try to reproduce it with 1.7.6.0 ?

Hi @marionf,

Yes, I manage to reproduce the issue with PS1.7.6.0.
I have those orders
image

If I make a filter like this http://presta1760/api/orders/?display=full&filter[date_add]=[2019-05-24,2019-05-28]&date=1

I have only the five first products, the orders created on 2019-05-28 are not displayed
image

We need to change the filter to 2019-05-29, to display them

Thanks!

Hi,

I manage to reproduce the issue with PS1770rc1build2.
I try to filter by this api/orders/?display=[id]&filter[date_add]=[2020-10-22,2020-11-22]&date=1
But I have all orders.

Thanks!

Was this page helpful?
0 / 5 - 0 ratings