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
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions classes/PaymentModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,14 @@ public function validateOrder($id_cart, $id_order_state, $amount_paid, $payment_
PrestaShopLogger::addLog('PaymentModule::validateOrder - End of validateOrder', 1, null, 'Cart', (int)$id_cart, true);
}

Hook::exec('actionValidateOrderAfter', [
'cart' => $this->context->cart,
'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.

]);

return true;
} else {
$error = Tools::displayError('Cart cannot be loaded or an order has already been placed using this cart');
Expand Down
3 changes: 3 additions & 0 deletions install-dev/data/xml/hook.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
<hook id="actionValidateOrder" live_edit="0">
<name>actionValidateOrder</name><title>New orders</title><description/>
</hook>
<hook id="actionValidateOrderAfter">
<name>actionValidateOrderAfter</name><title>After validating an order</title><description>This hook is called after validating an order by core</description>
</hook>
<hook id="displayMaintenance" live_edit="0">
<name>displayMaintenance</name><title>Maintenance Page</title><description>This hook displays new elements on the maintenance page</description>
</hook>
Expand Down
4 changes: 4 additions & 0 deletions install-dev/upgrade/sql/1.6.1.25.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
SET NAMES 'utf8';

INSERT IGNORE INTO `PREFIX_hook` (`id_hook`, `name`, `title`, `description`, `position`) VALUES
(NULL, 'actionValidateOrderAfter', 'New Order', 'This hook is called after validating an order by core', '1');