From aa55b2f9cafc42429611c6cbb90f23f3db15b476 Mon Sep 17 00:00:00 2001 From: Pete Eveleigh Date: Fri, 16 Aug 2024 16:57:30 +0100 Subject: [PATCH 1/3] hook up buttons and paths etc for email step --- src/controllers/CheckoutController.php | 4 +++- src/templates/_components/app/steps-completed.twig | 6 +++--- src/templates/checkout/email.twig | 7 ++++--- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/controllers/CheckoutController.php b/src/controllers/CheckoutController.php index 3768cd4..c700f54 100644 --- a/src/controllers/CheckoutController.php +++ b/src/controllers/CheckoutController.php @@ -5,13 +5,14 @@ use craft\web\Controller; use fostercommerce\craftfostercheckout\FosterCheckout; use yii\web\Response; +use yii\web\Request; /** * Checkout controller */ class CheckoutController extends Controller { - protected array|int|bool $allowAnonymous = ['get-critical-data', 'get-payment-form', 'get-discounts']; + protected array|int|bool $allowAnonymous = ['get-critical-data', 'get-payment-form', 'get-discounts', 'check-email']; public function actionGetCriticalData(): Response { @@ -36,4 +37,5 @@ public function actionGetDiscounts(): Response 'discounts' => FosterCheckout::getInstance()->checkout->getDiscounts(), ]); } + } diff --git a/src/templates/_components/app/steps-completed.twig b/src/templates/_components/app/steps-completed.twig index 459e08c..c2f44fb 100644 --- a/src/templates/_components/app/steps-completed.twig +++ b/src/templates/_components/app/steps-completed.twig @@ -13,8 +13,8 @@
- email@gmail.com -
@@ -65,4 +65,4 @@ -{% endif %} \ No newline at end of file +{% endif %} diff --git a/src/templates/checkout/email.twig b/src/templates/checkout/email.twig index 6d8b391..91c07eb 100644 --- a/src/templates/checkout/email.twig +++ b/src/templates/checkout/email.twig @@ -13,7 +13,8 @@
{{ csrfInput() }} - {{ actionInput('cart/update-cart') }} + {{ actionInput('commerce/cart/update-cart') }} + {{ redirectInput(craft.fostercheckout.getPath('checkout') ~ '/address') }}
@@ -43,7 +44,7 @@ -{% endblock %} \ No newline at end of file +{% endblock %} From 062dbf6d769aa0f770c84be4b08b1d7b16abd57b Mon Sep 17 00:00:00 2001 From: Pete Eveleigh Date: Fri, 16 Aug 2024 16:59:51 +0100 Subject: [PATCH 2/3] remove reference to check email method --- src/controllers/CheckoutController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controllers/CheckoutController.php b/src/controllers/CheckoutController.php index c700f54..7ee85c6 100644 --- a/src/controllers/CheckoutController.php +++ b/src/controllers/CheckoutController.php @@ -12,7 +12,7 @@ */ class CheckoutController extends Controller { - protected array|int|bool $allowAnonymous = ['get-critical-data', 'get-payment-form', 'get-discounts', 'check-email']; + protected array|int|bool $allowAnonymous = ['get-critical-data', 'get-payment-form', 'get-discounts']; public function actionGetCriticalData(): Response { From fd74ac983d6dd15d4093bd99fde362ea97b994ea Mon Sep 17 00:00:00 2001 From: Pete Eveleigh Date: Fri, 16 Aug 2024 17:00:45 +0100 Subject: [PATCH 3/3] ecs fixes --- src/FosterCheckout.php | 3 --- src/controllers/CheckoutController.php | 2 -- src/translations/en/foster-checkout.php | 2 +- src/variables/Variables.php | 8 -------- 4 files changed, 1 insertion(+), 14 deletions(-) diff --git a/src/FosterCheckout.php b/src/FosterCheckout.php index ae7ee63..6e94655 100644 --- a/src/FosterCheckout.php +++ b/src/FosterCheckout.php @@ -15,7 +15,6 @@ use fostercommerce\craftfostercheckout\variables\Variables; use yii\base\Event; - /** * Foster Checkout plugin * @@ -44,8 +43,6 @@ public function init() $this->attachEventHandlers(); $this->registerCustomVariables(); }); - - } protected function createSettingsModel(): ?Model diff --git a/src/controllers/CheckoutController.php b/src/controllers/CheckoutController.php index 7ee85c6..3768cd4 100644 --- a/src/controllers/CheckoutController.php +++ b/src/controllers/CheckoutController.php @@ -5,7 +5,6 @@ use craft\web\Controller; use fostercommerce\craftfostercheckout\FosterCheckout; use yii\web\Response; -use yii\web\Request; /** * Checkout controller @@ -37,5 +36,4 @@ public function actionGetDiscounts(): Response 'discounts' => FosterCheckout::getInstance()->checkout->getDiscounts(), ]); } - } diff --git a/src/translations/en/foster-checkout.php b/src/translations/en/foster-checkout.php index f130073..176795e 100644 --- a/src/translations/en/foster-checkout.php +++ b/src/translations/en/foster-checkout.php @@ -1,7 +1,7 @@ 'Cart', + 'Cart' => 'Cart', 'Checkout' => 'Checkout', 'Email' => 'Email', 'Address' => 'Address', diff --git a/src/variables/Variables.php b/src/variables/Variables.php index a14ea42..23aa0fe 100644 --- a/src/variables/Variables.php +++ b/src/variables/Variables.php @@ -2,24 +2,16 @@ namespace fostercommerce\craftfostercheckout\variables; - -use Craft; -use craft\helpers\App; use fostercommerce\craftfostercheckout\FosterCheckout; - class Variables { - /** * getPath - * */ public function getPath(string $path): ?string { $paths = FosterCheckout::getInstance()->checkout->paths(); return array_key_exists($path, $paths) ? '/' . $paths[$path] : null; } - - }