Help Modification: Call An Api When Order Is Posted Succesfully

Hello,

I have been playing around and trying different codes like {php} in tpls and other pre/post.[functions/controllers]. for modifications but this one i am trying is a bit over my experience.

If anyone can help me i would be grateful.

Logic:

When the order is placed successfully, Call an External Rest API with order_id as a body payload.

can any one tell me what files i do need to change and what would be modification code? I want to use the following PHP code when the order is placed successfully.

<?php

$request = new HttpRequest();
$request->setUrl(‘https://Pxxx-xx.Sxxxxxxxxxx.Lxxx.Axxxx.com:443/api’);
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
‘content-type’ => ‘application/json’
));

$request->setContentType(‘application/json’);
$request->setPostFields(array(
‘order_id’ => $order_id
));

try {
$response = $request->send();

echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}

I suggest you to use the change_order_status hook (app/functions/fn.cart.php)

If the order status is changed from Incompleted to Processed, make you call

Or the order_placed hook for all orders regardless of status.

I am looking urgently for someone who has already played with the filter apis "filer by product feature" like by size, color, brand , material type etc. every product and category in our shop has product features and they are dynamic for example clothes have size, color, designer etc. perfume category, has size, fragnance type, alcohol percentage, brand etc.

I am looking urgently for someone who has already played with the filter apis "filer by product feature" like by size, color, brand , material type etc. every product and category in our shop has product features and they are dynamic for example clothes have size, color, designer etc. perfume category, has size, fragnance type, alcohol percentage, brand etc.

Please contact us at sales@simtechdev.com