Jump to content

Cannot Cancel Order


Recommended Posts

Hello,

 

I have a problem with my online shop, in back office exactly. I cannot cancel orders! I tried finding a solution, but nothing. And the strangest thing was i discovered this when i had to cancel two orders i had. I went to the orders, canceled the first, it was alright. No error, it worked. Then found the second one, clicked cancel order and error! Ok try again I said, cancel order, Error! So i don't know what happened but since then i cannot cancel orders. I would appreciate if you guys could help me out. Here is the error message:

 

[PrestaShopException]

Property StockAvailable->id_product_attribute is empty
at line 909 in file classes/ObjectModel.php

904. }
905.
906. $message = $this->validateField($field, $this->$field);
907. if ($message !== true) {
908. if ($die) {
909. throw new PrestaShopException($message);
910. }
911. return $error_return ? $message : false;
912. }
913. }
914.
Link to comment
Share on other sites

For everyone with the same problem I'll post here what helped me solve it.

 

Search for file Core/Business/Stock/Core_Business_Stock_StockManager.php . At line 126 I had:

 

$stockAvailable->quantity = $stockAvailable->quantity + $delta_quantity;
$stockAvailable->id_product = (int)$product->id;
$stockAvailable->update(); 

The problem is that is not correct. It must look like this:

$stockAvailable->quantity = $stockAvailable->quantity + $delta_quantity;
$stockAvailable->id_product = (int)$product->id;
$stockAvailable->id_product_attribute = (int)$id_product_attribute;
$stockAvailable->update(); 

 

More to the point line $stockAvailable->id_product_attribute = (int)$id_product_attribute; was missing.

 

Hope this helps!

  • Like 3
Link to comment
Share on other sites

  • 5 weeks later...
  • 2 weeks later...
  • 1 month later...
  • 2 months later...

I have 1.6.1.1 and have applied the above fix. still cannot cancel an order. get this error:

 

[PrestaShopException]

Property StockAvailable->id_product_attribute is empty
at line 909 in file classes/ObjectModel.php

904.             }
905.
906.             $message = $this->validateField($field, $this->$field);
907.             if ($message !== true) {
908.                 if ($die) {
909.                     throw new PrestaShopException($message);
910.                 }
911.                 return $error_return ? $message : false;
912.             }
913.         }
914.

    ObjectModelCore->validateFields - [line 246 - classes/ObjectModel.php]
    ObjectModelCore->getFields - [line 652 - classes/ObjectModel.php]
    ObjectModelCore->update - [line 406 - classes/stock/StockAvailable.php] - [1 Arguments]
    StockAvailableCore->update - [line 128 - Core/Business/Stock/Core_Business_Stock_StockManager.php]
    Core_Business_Stock_StockManager->updateQuantity - [line 472 - classes/stock/StockAvailable.php] - [4 Arguments]
    StockAvailableCore::updateQuantity - [line 206 - classes/order/OrderHistory.php] - [4 Arguments]
    OrderHistoryCore->changeIdOrderState - [line 531 - controllers/admin/AdminOrdersController.php] - [3 Arguments]
    AdminOrdersControllerCore->postProcess - [line 178 - classes/controller/Controller.php]
    ControllerCore->run - [line 367 - classes/Dispatcher.php]
    DispatcherCore->dispatch - [line 58 - admin/index.php]

Link to comment
Share on other sites

  • 9 months later...

Same problem as occured. when i update order status "canceled " it shows error.

 

the error like : 

This page isn’t working

www.hindhome.com is currently unable to handle this request.

HTTP ERROR 500
 
any ONE CAN HELP ME ?

Currently i am using prestashop 1.7.0.3

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