Jump to content

Getting Order fields to send out via Curl


Recommended Posts

Dear experienced developers, 

Overview:
I am consuming an API to send an order out to carrier vendor upon order creation in Prestashop 1.6.1.14. When a customer purchase an item, chose a specific carrier and successfully make necessary payment, it will send out the order to carrier vendor.

What I have created:
1) A custom module with hookdisplayAdminOrder - I am using this to display a button so I can print Shipping and Return labels to attach to item physically.
2) Custom module has been created with an option to set configuration fields via backoffice. I will be using the fields to set my Curl options.
3) Curl token has been generated and cached in proper, for usage to send out orders

Issues:
1) I have read online that there is a hook called actionValidateOrder, it is currently triggering upon creation of an order. Am I using the right hook for as I should also check on validated payment?
2) I would like to understand how to pull/retrieve the data for new orders? I will use these data to send out the order to shipping vendor via API such as Customer name, Address etc.

Thank you for time and guidance.

Edited by Enthu86
Progress (see edit history)
Link to comment
Share on other sites

I have managed to get an answer for my question above.

1) Reference: http://doc.prestashop.com/display/PS15/Hooks+in+PrestaShop+1.5
- This hook does check on payment. 
- "After an order has been validated. Doesn't necessarily have to be paid."

2) Below is the code that actually executes on actionValidateOrder
 

// Hook validate order
Hook::exec('actionValidateOrder', array(
    'cart' => $this->context->cart,
    'order' => $order,
    'customer' => $this->context->customer,
    'currency' => $this->context->currency,
    'orderStatus' => $order_status
));

Reference: 

 

Thank you.

 

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