It is necessary after successful ordering in OcStore to send data from this order to an external endpoint, it was supposed to use a curl request.

The problem arose in the fact that it is not entirely clear where the final php script contains all the necessary information and in which you can add this query.

I tried to use success.php for this purpose (catalog / controller / checkout / success.php), in principle it works, but there is no array with goods there, but I need it first of all.

OcStore version: 2.3.0.2.3

Please push me in the right direction.

  • one
    Specify the version of the store in question, the structure is different in different branches. - Kirill Korushkin

1 answer 1

success.php is the controller of the page to which it redirects after success.php order. The order itself is formed in model/checkout/order.php . There are several methods, see updateOrder and addOrderHistory . They are quite large, it will be necessary to understand.

However, this is not the surest way to implement this functionality. Opencart has an Событий(events) system Событий(events) that implements триггеры — connecting additional controllers when various system events occur. Ordering is one of these events.

event system

list of triggers

  • I found the catalog / model / checkout / order.php file, tried to insert the code inside the "public function addOrder ($ data) {...}" method that will send $ data to the desired endpoint, but when placing the order, the compiler does not enter this Method ... - ProstoJohn
  • one
    "... and addOrderHistory ..." - Kirill Korushkin