diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..bb029a1 Binary files /dev/null and b/.DS_Store differ diff --git a/src/formatters/CheckoutAddressFormatter.php b/src/formatters/CheckoutAddressFormatter.php index 39baf99..9e27668 100644 --- a/src/formatters/CheckoutAddressFormatter.php +++ b/src/formatters/CheckoutAddressFormatter.php @@ -30,6 +30,6 @@ public function format(AddressInterface $address, array $options = []): string $addressLines[] = $address->postalCode; $addressLines[] = $address->getCountry()->getName(); - return ($address->fullName ? $address->fullName . '
' : '') . implode(' / ', array_filter($addressLines)); + return implode(' / ', array_filter($addressLines)); } } diff --git a/src/templates/.DS_Store b/src/templates/.DS_Store new file mode 100644 index 0000000..0346cda Binary files /dev/null and b/src/templates/.DS_Store differ diff --git a/src/templates/_components/.DS_Store b/src/templates/_components/.DS_Store new file mode 100644 index 0000000..f19d437 Binary files /dev/null and b/src/templates/_components/.DS_Store differ diff --git a/src/templates/_components/app/address-fields.twig b/src/templates/_components/app/address-fields.twig index 43c351d..1029346 100644 --- a/src/templates/_components/app/address-fields.twig +++ b/src/templates/_components/app/address-fields.twig @@ -140,7 +140,7 @@ required > - diff --git a/src/templates/_components/app/formatted-address.twig b/src/templates/_components/app/formatted-address.twig index 1e0f33e..45399ab 100644 --- a/src/templates/_components/app/formatted-address.twig +++ b/src/templates/_components/app/formatted-address.twig @@ -9,7 +9,10 @@ addressService.getSubdivisionRepository(), ] ) %} - {{ address|address({ }, customFormatter) }} +

+ {{ address.fullName }} + {{ address|address({ }, customFormatter) }} +

{% else %} -No address to display +

No address to display

{% endif %} diff --git a/src/templates/_components/app/steps-completed.twig b/src/templates/_components/app/steps-completed.twig index a51d63a..18fc5a3 100644 --- a/src/templates/_components/app/steps-completed.twig +++ b/src/templates/_components/app/steps-completed.twig @@ -36,9 +36,7 @@
-

- {% include'foster-checkout/_components/app/formatted-address' with { 'address': cart.shippingAddress} %} -

+ {% include'foster-checkout/_components/app/formatted-address' with { 'address': cart.shippingAddress} %} diff --git a/src/templates/checkout/shipping.twig b/src/templates/checkout/shipping.twig index 2bf19c2..3d35ef3 100644 --- a/src/templates/checkout/shipping.twig +++ b/src/templates/checkout/shipping.twig @@ -1,21 +1,42 @@ {% extends 'foster-checkout/_layouts/default' %} {% block body %} +{% set availableShippingMethodOptions = cart.availableShippingMethodOptions ?? null %} +{% set onlyMethod = null %} +{% if cart is defined %} + {# If there's only 1 shipping method available then set it on the cart #} + {% if cart.availableShippingMethodOptions|length == 1 %} + {% for handle, option in cart.availableShippingMethodOptions %} + {% if option.price == 0 %} + {% redirect(craft.fostercheckout.getPath('checkout') ~ '/payment') %} + {% else %} + {% set onlyMethod = handle %} + {% endif %} + {% endfor %} + {% elseif cart.availableShippingMethodOptions|length == 1 %} + {# If there are no available shipping methods, then just redirect to the payment page #} + {% redirect(craft.fostercheckout.getPath('checkout') ~ '/payment') %} + {% endif %} +{% endif %} + +

{{ 'Checkout'|t('foster-checkout') }}

- -
- +
{% include 'foster-checkout/_components/app/steps-completed' with { step: 'shipping' } %} -
+ + + {{ csrfInput() }} + {{ actionInput('commerce/cart/update-cart') }} + {{ redirectInput(craft.fostercheckout.getPath('checkout') ~ '/payment') }}
@@ -25,76 +46,35 @@
-
- -
-
- - - $0.00 -
-
- -
-
- - - $15.00 -
-
- -
-
- - - $19.00 -
-
+
+ {% if availableShippingMethodOptions|length %} + {% for handle, method in availableShippingMethodOptions %} +
+ +
+ + + + {{ method.getPrice()|commerceCurrency(cart.currency) }} +
+
+ {% endfor %} + {% endif %}