Jump to content

PS 1.7 Webservice order_discounts


IcuScc

Recommended Posts

Hi friends.

I update to prestashop 1.7.

I use the API for get some information of my orders, but the webservice of order_discounts has dissapear in 1.7 version of Prestashop.

Can anybody to tellme why? and how to get the order discounts?

Link to comment
Share on other sites

  • 3 weeks later...

This issue is weird, because the logic has apparently not changed. The information is still recorded in the table [ps_]order_cart_rule exactly the same way as in v1.6.

It is possible to solve the issue (allowing the access via WebService) by changing the source code, but I'm not sure if this is a good idea. In my case, it worked after editing the file /classes/webservice/WebwerviceRequest.php and adding:

'order_discounts' => array('description' => 'Discounts of an order', 'class' => 'OrderDiscount'),

somewhere in the array declaration. I hope it helps.

Edited by javibeltran@pimesoft (see edit history)
Link to comment
Share on other sites

Diving into the sources I've found this was changed about 2 years ago

https://github.com/PrestaShop/PrestaShop/commit/93f7696f0287d5bb5d9ccdf11f77935e5412e59d#diff-6f9aef6c863f595ab49368d3ff7608ef

It is noticeable that the underlying class, OrderDiscountCore, is marked as deprecated even though it is obviously still in use (if not, the coupon system couldnt't work properly). 

Surely the core team must be planning to change the discounts system. It would be fine to clarify this point in order to be prepared for the future.

On the other hand, there is a better way to work around this issue by using the addWebserviceResources hook (which I didn't see at first) instead of touching the file directly.

Link to comment
Share on other sites

Welcome to Prestashop world. Changes occured with no reasons and no notification. Unit testing to be put in place urgentlt if it is not yet the case. The Best way to use the API is to create your own one! 

Link to comment
Share on other sites

  • 3 months later...
On 27/8/2018 at 5:38 AM, Olivia L Pope said:

Hi,

I also have created one called 'Welcome coupon' that should be shown to each client that registers.

When I go to the section my account -> my discount coupons to check that everything has gone correctly I realize that nothing appears and the coupon does not apply to the client who has just registered, what's more, nothing is shown

Hi Olivia,

What I've seen is that the coupon you created won't appear at "my discount coupons", as you probably were expecting to happen. I'm not sure if this is working this way by design or if it's actually a bug. 

On the other hand, the coupon will appear at the checkout pages. When the coupon is created with the "Highlight" option active, the coupon's code will explicitely appear at the checkout pages (at the right column when using the prestashop's classic theme) so that the user can see and use it easily. And, when the "Highlight" option is not active, the coupon's code will not appear but it'll still work if the user decides to use it by typing the code on the text box.

 

Edited by javibeltran@pimesoft (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...