Skip to content

Commit 891cbba

Browse files
committed
Added hook for checkout payment, shipping and complete steps
1 parent 8dcedb5 commit 891cbba

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

system/modules/isotope/library/Isotope/CheckoutStep/PaymentMethod.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,16 @@ public function generate()
116116
$objWidget->validate();
117117

118118
if (!$objWidget->hasErrors()) {
119-
Isotope::getCart()->setPaymentMethod($this->modules[$objWidget->value]);
119+
$objPayment = $this->modules[$objWidget->value];
120+
121+
// !HOOK: checkout payment
122+
if (isset($GLOBALS['ISO_HOOKS']['checkoutPayment']) && \is_array($GLOBALS['ISO_HOOKS']['checkoutPayment'])) {
123+
foreach ($GLOBALS['ISO_HOOKS']['checkoutPayment'] as $callback) {
124+
$objPayment = System::importStatic($callback[0])->{$callback[1]}($objPayment, Isotope::getCart());
125+
}
126+
}
127+
128+
Isotope::getCart()->setPaymentMethod($objPayment);
120129
}
121130
}
122131

system/modules/isotope/library/Isotope/CheckoutStep/ShippingMethod.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,16 @@ public function generate()
118118
$objWidget->validate();
119119

120120
if (!$objWidget->hasErrors()) {
121-
Isotope::getCart()->setShippingMethod($this->modules[$objWidget->value]);
121+
$objShipping = $this->modules[$objWidget->value];
122+
123+
// !HOOK: checkout shipping
124+
if (isset($GLOBALS['ISO_HOOKS']['checkoutShipping']) && \is_array($GLOBALS['ISO_HOOKS']['checkoutShipping'])) {
125+
foreach ($GLOBALS['ISO_HOOKS']['checkoutShipping'] as $callback) {
126+
$objShipping = System::importStatic($callback[0])->{$callback[1]}($objShipping, Isotope::getCart());
127+
}
128+
}
129+
130+
Isotope::getCart()->setShippingMethod($objShipping);
122131
}
123132
}
124133

system/modules/isotope/library/Isotope/Model/ProductCollection/Order.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,13 @@ public function complete()
260260
$objCart->config_id = $this->config_id;
261261
}
262262

263+
// !HOOK: complete checkout
264+
if (isset($GLOBALS['ISO_HOOKS']['checkoutComplete']) && \is_array($GLOBALS['ISO_HOOKS']['checkoutComplete'])) {
265+
foreach ($GLOBALS['ISO_HOOKS']['checkoutComplete'] as $callback) {
266+
System::importStatic($callback[0])->{$callback[1]}($this);
267+
}
268+
}
269+
263270
return true;
264271
}
265272

0 commit comments

Comments
 (0)