Skip to content

Commit

Permalink
Merge pull request #11 from FosterCommerce/email-step-functionality
Browse files Browse the repository at this point in the history
hook up buttons and paths etc for email step
  • Loading branch information
peteeveleigh authored Aug 16, 2024
2 parents 6c942a0 + fd74ac9 commit e33f366
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 18 deletions.
3 changes: 0 additions & 3 deletions src/FosterCheckout.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use fostercommerce\craftfostercheckout\variables\Variables;
use yii\base\Event;


/**
* Foster Checkout plugin
*
Expand Down Expand Up @@ -44,8 +43,6 @@ public function init()
$this->attachEventHandlers();
$this->registerCustomVariables();
});


}

protected function createSettingsModel(): ?Model
Expand Down
6 changes: 3 additions & 3 deletions src/templates/_components/app/steps-completed.twig
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
</a>
</dt>
<dd class="mt-1 sm:flex sm:justify-between sm:items-start sm:gap-4 sm:mt-0">
<span class="text-black">[email protected]</span>
<a class="hidden sm:inline-block sm:underline sm:text-[var(--brandColor)]" href="#">
<span class="text-black">{{ cart.email }}</span>
<a class="hidden sm:inline-block sm:underline sm:text-[var(--brandColor)]" href="{{ craft.fostercheckout.getPath('checkout') ~ '/email' }}">
{{ 'Edit'|t('foster-checkout') }}
</a>
</dd>
Expand Down Expand Up @@ -65,4 +65,4 @@

</dl>

{% endif %}
{% endif %}
7 changes: 4 additions & 3 deletions src/templates/checkout/email.twig
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
<form class="mt-6" method="post" accept-charset="UTF-8">

{{ csrfInput() }}
{{ actionInput('cart/update-cart') }}
{{ actionInput('commerce/cart/update-cart') }}
{{ redirectInput(craft.fostercheckout.getPath('checkout') ~ '/address') }}

<fieldset class="grid grid-cols-1 gap-6">

Expand Down Expand Up @@ -43,7 +44,7 @@

<div class="mt-12 grid grid-cols-1 gap-4 md:flex md:justify-end md:items-center md:gap-6 md:mt-16">
<a
href="#"
href="{{ craft.fostercheckout.getPath('cancel') }}"
class="block min-w-[200px] px-4 py-3 font-medium text-[var(--brandColor)] text-center bg-white border border-[var(--brandColor)] rounded-xl"
>
{{ 'Continue Shopping'|t('foster-checkout') }}
Expand All @@ -61,4 +62,4 @@

</div>

{% endblock %}
{% endblock %}
2 changes: 1 addition & 1 deletion src/translations/en/foster-checkout.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

return [
'Cart' => 'Cart',
'Cart' => 'Cart',
'Checkout' => 'Checkout',
'Email' => 'Email',
'Address' => 'Address',
Expand Down
8 changes: 0 additions & 8 deletions src/variables/Variables.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}


}

0 comments on commit e33f366

Please sign in to comment.