Jump to content

Set Conditions on hookDisplayPDFInvoice


PrestashopEnthu

Recommended Posts

I am trying to set conditions on the above stated hook - hookDisplayPDFInvoice. Based on the order ID, I would like to set a condition based on carrier name. 

With great reference from below, I have managed to retrieve the order ID. 

I am trying to retrieve id_carrier based on the ID above. After-which, I would like to set a condition as follow (I was using this on hookActionValidateOrder, not working on hookDisplayPDFInvoice):

$carrier = new Carrier($params['order']->id_carrier);
if ($carrier->name=='XXX') {

Thank you for any assistance rendered.

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

carrier name is a language field, meaning the carrier name can be different depending on the language being used.

so you must create a new carrier object, using both the id_carrier and the id_lang

$carrier = new Carrier($params['order']->id_carrier, $params['order']->id_lang);

what you must consider is what language you want to use in your module hook.  Should it be the language recorded with the order, or should it be the language of the person creating the invoice?

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