Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[API] Filtering orders by date_add #10822

Open
Tracked by #10069
Ludofloria opened this issue Oct 3, 2018 · 7 comments
Open
Tracked by #10069

[API] Filtering orders by date_add #10822

Ludofloria opened this issue Oct 3, 2018 · 7 comments
Labels
1.7.4.2 Affects versions 1.7.6.0 Affects versions 1.7.7.x Branch Bug Type: Bug Minor Severity: minor bug > https://build.prestashop.com/news/severity-classification Ready Status: Issue is ready to be worked on Webservice Label: Which BO under menu is concerned WS Category: Web Service

Comments

@Ludofloria
Copy link

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)

@Ludofloria Ludofloria changed the title [API] Filtering order by date_add [API] Filtering orders by date_add Oct 3, 2018
@khouloudbelguith
Copy link
Contributor

khouloudbelguith commented Oct 3, 2018

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.

@khouloudbelguith khouloudbelguith added Bug Type: Bug Standard TBR Status: issue to be reproduced Webservice Label: Which BO under menu is concerned 1.7.4.2 Affects versions labels Oct 3, 2018
@Ludofloria
Copy link
Author

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

@marionf marionf added Ready Status: Issue is ready to be worked on and removed TBR Status: issue to be reproduced labels Oct 3, 2018
@marionf marionf removed their assignment Oct 3, 2018
@khouloudbelguith
Copy link
Contributor

@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.

@Ludofloria
Copy link
Author

Thanks for this extremely quick feedback :)

@marionf marionf added Minor Severity: minor bug > https://build.prestashop.com/news/severity-classification and removed Standard labels May 15, 2019
@marionf
Copy link
Contributor

marionf commented May 28, 2019

@khouloudbelguith Could you try to reproduce it with 1.7.6.0 ?

@khouloudbelguith
Copy link
Contributor

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!

@khouloudbelguith
Copy link
Contributor

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.7.4.2 Affects versions 1.7.6.0 Affects versions 1.7.7.x Branch Bug Type: Bug Minor Severity: minor bug > https://build.prestashop.com/news/severity-classification Ready Status: Issue is ready to be worked on Webservice Label: Which BO under menu is concerned WS Category: Web Service
Projects
None yet
Development

No branches or pull requests

4 participants