Jump to content

Call api on new order hook parameter in PrestaShop


Muhammad Hamza

Recommended Posts

I am developing a module in PrestaShop, I have to call an API, I have achieved call on new/update/delete product, but now I want to have new order call.

I am using 1.6 so I just need to fields. Fields

This is my module code

public function hookNewOrder($order){
        $data=[
            'shipping_data'=>'',
            'shipping_time'=>'',
            'greetings'=>'',
            'recipient_name'=>'',
            'phone'=>''
        ];
        $response = Requests::post('https://izer.co.il/crm/product_api.php',[],json_encode($data));
        file_put_contents(_PS_MODULE_DIR_ . $this->name .'/log.json',json_encode($response,JSON_PRETTY_PRINT));
    }

I just want to correctly filled order details in data array. Everything else is working fine, I do not exactly know what will be the nature of $order object passed to this method.

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