trace Posted August 7, 2017 Share Posted August 7, 2017 (edited) Where is it edited? And how?OrderDetail.php or OrderHistory.php? Necessary: If product has feature_id == 2 && feature_value == 1 (This has already been created and applied to certain products) , do not update quantity, if status changed to "CANCEL" (but not "ERROR"). Edited August 7, 2017 by trace (see edit history) Link to comment Share on other sites More sharing options...
Scully Posted August 9, 2017 Share Posted August 9, 2017 You post misses your prestashop version in use. Up to V 1.6. the corresponding function is part of orderhistory.php. The corresponding lines look like this one StockAvailable::updateQuantity($product['product_id'], $product['product_attribute_id'], (int)$product['product_quantity'], $order->id_shop); You just needed to enhance the pre-existing if statements with your attribut and feature ids. If you use PS 1.7 the story might be completely different. 1 Link to comment Share on other sites More sharing options...
trace Posted August 9, 2017 Author Share Posted August 9, 2017 (edited) You post misses your prestashop version in use. Up to V 1.6. the corresponding function is part of orderhistory.php. Thank you for your reply. I use Prestashop 1.6.1.11 How to enhance it? Edited August 9, 2017 by trace (see edit history) Link to comment Share on other sites More sharing options...
Scully Posted August 9, 2017 Share Posted August 9, 2017 Thank you for your reply. I use Prestashop 1.6.1.11 How to enhance it? Have you read my post #2 ? It points you to the place where you have to implement the enhancement. Link to comment Share on other sites More sharing options...
trace Posted August 9, 2017 Author Share Posted August 9, 2017 Have you read my post #2 ? It points you to the place where you have to implement the enhancement. I mean I don't know how to do that. I am not a php Developer. I trying to do something, but not enough knowledge. Link to comment Share on other sites More sharing options...
Scully Posted August 9, 2017 Share Posted August 9, 2017 Then it could be an option to get yourself familiar with php - at least trying to get in. But trying to change prestashop core without any PHP knowledge might end in troubles. The culprit for your scenario is the following: The feature itself isn't stored on the products table. You needed to scan the feature table for the product first. If your feature is connected to the product which is cancelled, do not perform the stock action. In my opinion, it's not a good idea to hook up the change on an attribute value. Instead I would as example create a invisible "virtual" category and put in the related products to this category. Or flag it somehow else. Long story in short: it's a bit more than 10 minutes to achieve this - even for an experienced developer. The option might be to ask and pay a developer to do it for you. 1 Link to comment Share on other sites More sharing options...
trace Posted August 9, 2017 Author Share Posted August 9, 2017 The culprit for your scenario is the following: The feature itself isn't stored on the products table. You needed to scan the feature table for the product first. If your feature is connected to the product which is cancelled, do not perform the stock action. In my opinion, it's not a good idea to hook up the change on an attribute value. Instead I would as example create a invisible "virtual" category and put in the related products to this category. Or flag it somehow else. Fully understood. If it's too complicated, then maybe it's worth trying with status? When the buyer makes an order using the module, the order is assigned a new status "Preorder" in config "PS_OS_PREORDER" (It already works.) New question: How to edit the file OrderHistory.php? If the order was "PS_OS_PREORDER" and changed to "PS_OS_CANCEL" do not increase the quantity of the products? P.S: Sorry for my English Link to comment Share on other sites More sharing options...
Scully Posted August 9, 2017 Share Posted August 9, 2017 An order may have several products - so order status is also not the way I would handle this. On the other hand: I don't understand what your issue is. If an order is placed, the stock decreases. If an order is cancelled, the stock increases with the same quantity. That's the way it should work. Link to comment Share on other sites More sharing options...
trace Posted August 10, 2017 Author Share Posted August 10, 2017 (edited) An order may have several products - so order status is also not the way I would handle this. On the other hand: I don't understand what your issue is. If an order is placed, the stock decreases. If an order is cancelled, the stock increases with the same quantity. That's the way it should work. I has module for preorder. In my case, buyers can pre-order only one product. This module is activated if the quantity of the product has 1 unit and the product has the feature "Pre-order". And this orders in admin panel has status PS_OS_PREORDER. If buyer do pre-order, then the quantity of products does not decrease. Just one problem - If I changed status to "CANCEL" it increases the quantity of product. P.S: Once again, sorry for my English. Edited August 10, 2017 by trace (see edit history) Link to comment Share on other sites More sharing options...
Scully Posted August 10, 2017 Share Posted August 10, 2017 (edited) I got it now. So if it is a bug (according to your detailled description it looks like) you might search the forum for others who have encountered the same problem. Or find somebody to do the change for you by fixing orderhistory.php. Or try to delete the product from the order before you cancel the order. This handling is done somehow different from the direct cancel actions. Edited August 10, 2017 by Scully (see edit history) 1 Link to comment Share on other sites More sharing options...
Jagotic Posted February 26, 2019 Share Posted February 26, 2019 looking for the same issue, after cancellation product doesn't add to real quantity. what should we do now. Is there any solution for NEWBIES ? 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