PrestaShop: catch Order state change

Trabla: PrestaShop: catch Order state change

Solving:

1. All order state changes are stored in table ps_order_history

2. Order state are changed using class  OrderHistoryCore
located here: .../prestashop/classes/order/OrderHistory.php

3. To override behavior of class OrderHistoryCore
create file OrderHistory.php and put into folder:
.../prestashop/override/classes/order/OrderHistory.php
and declare class this way and override method  changeIdOrderState  :
<?php 
class OrderHistory extends OrderHistoryCore{
      
    //Catch Order State Changes
    public function changeIdOrderState($new_order_state, $id_order, $use_existing_payment = false)
    {

          //COPY CODE from original method HERE   OrderHistoryCore->changeIdOrderState
         //and do your manipulations
         
     }

}

No comments:

Post a Comment