Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a hook 'actionValidateOrderAfter', This hook is called after the … #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

olecorre
Copy link

Questions Answers
Branch? develop
Description? Add a new hook 'actionValidateOrderAfter', This hook is called after the complete creation of an order
Type? new feature
Category? FO
BC breaks? no
Deprecations? no
Possible impacts? No impact
Fixes #23787

When an order is created, several modules can be called by the validateOrder hook or other hooks.
There are very often problems and an order is not completely created, no status, no confirmation email sent etc... the reasons can be multiple, poorly developed module, unexpected error, call to an api that does not respond.
Linking PrestaShop to an ERP is more and more common and the exchanges must be reliable.
Also sending to an ERP can generate a change of status for the order but since it is not completely created, there can be conflicts.
This hook allows to create the order completely and then the hook is executed, sending the order to an ERP for example, allows to have the whole order with a status etc. and if the link with the ERP does not work, the order is not "corrupted".
I took the example of liaison with an ERP because I added this hook on several sites and it is very useful.

'order' => $order,
'customer' => $this->context->customer,
'currency' => $this->context->currency,
'orderStatus' => new OrderState($order->current_state),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Si nous avons déjà injecté la commande, je pense que orderStatus devrait être géré au niveau de l'implementation dans le module.

@SebSept SebSept requested review from SebSept and removed request for SebSept June 15, 2021 15:34
Copy link

@SebSept SebSept left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have just read the code, not tested.
Everything is ok.
I can't see any armful stuff happening with theses changes.
The only thing I notice it that the new hook will be declared after an upgrade but not after a fresh install.
This is not a problem for me since installing a new shop using 1.6 is not recommended (I guess).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants