jtg Posted November 16, 2016 Share Posted November 16, 2016 Hi guys, Prestashop 1.7 webservice does not include the order_discounts resource. In version 1.6 this resource allowed to get order cart rules. It is important for me to obtain the different discounts applied to an order, but with the new version of Prestashop 1.7 I can't find any resource that returns the order cart rules. Is it not possible now to obtain the cart rules related with an order via webservice? Link to comment Share on other sites More sharing options...
Marco Torcolacci Posted March 27, 2018 Share Posted March 27, 2018 has this problem been solved? Link to comment Share on other sites More sharing options...
javibeltran@pimesoft Posted May 7, 2018 Share Posted May 7, 2018 (edited) 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 May 7, 2018 by javibeltran@pimesoft (see edit history) Link to comment Share on other sites More sharing options...
javibeltran@pimesoft Posted May 8, 2018 Share Posted May 8, 2018 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 More sharing options...
Daniel Díaz Posted January 15, 2020 Share Posted January 15, 2020 I have developed and requested the PR to github but they do not accept it ... https://github.com/PrestaShop/PrestaShop/pull/16710 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now