From caf73c0683cd71e9e5c70b74879d216d39ade055 Mon Sep 17 00:00:00 2001 From: Pete Eveleigh Date: Tue, 20 Aug 2024 10:02:35 +0100 Subject: [PATCH] change to address format --- .DS_Store | Bin 0 -> 6148 bytes src/formatters/CheckoutAddressFormatter.php | 2 +- src/templates/.DS_Store | Bin 0 -> 6148 bytes src/templates/_components/.DS_Store | Bin 0 -> 6148 bytes .../_components/app/address-fields.twig | 2 +- .../_components/app/formatted-address.twig | 7 +- .../_components/app/steps-completed.twig | 4 +- src/templates/checkout/shipping.twig | 128 ++++++++---------- 8 files changed, 62 insertions(+), 81 deletions(-) create mode 100644 .DS_Store create mode 100644 src/templates/.DS_Store create mode 100644 src/templates/_components/.DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..bb029a1449f2aa7da936b4c57780fd77360ed781 GIT binary patch literal 6148 zcmeHK%}T>S5Z-O8Nhm@NiXIod7Hmr?ikDF93mDOZN=;1BV9b^zHHT8jRbR+A@p+ut z-GIfOMeGdhe)GGV{UH0p7~`XP)MLzLjM>l-IVx)e-D^V)lZ?o5jC>X*G6d@*oSE2P z2mJOX%UQ-A!t(p~CvjeMyPv$#Y;A2@mSeT8JO4?Rei0P&d=z9iXkAK~gtZ=oSMju* zxVvXEErK|mW~v~LrjT-b9jB2jM{=G#hseIFHav)pDj=>t^h5(7$63S0b*do888Qf z-QI8>X!*ndG4PWC+#duqM9*NQQEeU2;q@8gEkqR1@hyQU40;ADjSvChx)e~Ca`VLC zx*Yt%O06UaPOaK4? literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..0346cdac04968a0c4c94d3ff14c2c135ed926426 GIT binary patch literal 6148 zcmeHK%Sr=55Ukc57QE!>aeg6xFogI8`GJ6n0VM%3p7-Q;`Dv+sAcjpY0WVSw-8IwG zHOtmvdmDf)4^InV4q%`=;>*L-{M>zFH$dcRtiV~DIf);fE2h&0q?!E;Vw~83P=Gd@S}i#9~#}U7mkVX>0pQvfH-41 zjO&;sh|LqkUN|N)L$jn3lWH|$SkjqqRo4s0#H7P&_^^7i)r4a4bl%^h9M%&RrGOMT zRp2(abMOBT^b7OpiAO-%F0ybN%S4+N9_14MDd9Q8s4c%+L>26#Hg(2E8G1@UV f-j461DC?T9dEN`h#Go@DbfSI+To;)X_-h4@8zU96 literal 0 HcmV?d00001 diff --git a/src/templates/_components/.DS_Store b/src/templates/_components/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..f19d43778667eac9ce0e9bfa5efb370ef00a2f4b GIT binary patch literal 6148 zcmeHK%}T>S5Z<-bBorYBMUM+!3$~>c#7l_v1&ruHr6#0kFlIxOnnNk%sxRc5_&m<+ zZotx>MeGdhe)GGV{UH0p7~}pt?la~x#%ySa9F+}%?v0@xlZ?o5j3SRx8G-c~iU(U0*P_=;$IF9X1+@r-}Fzkx{V6^Ot#o3_O6~obR zxpeHqlhgC7$xHg0$#=~r2eOsy8*JbM6tkGOV3wsadje0B-DD9G1H=F^Kn!d-1Lk0` zJ6p~JEuR=52G$wC{XsxO^bFP-)z$$WUY{}EMnnM}-x7$zpl7hw2oVsjO96E$H%|<% z%fT;9o@cPusLL5wGs8G$=H~Ij)$HIGDxGmpBlW}pF|f)&OPem9|CjK~Y<%RemXJjZ z5Ci{=0p1=5V;>e}&epZ%;aMx7Jwijlyc!h{&{r-2VBkJ-tb#f&P=`FvV672HLBA>o Pq>F$eggRp27Z~^krL9Ri literal 0 HcmV?d00001 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 %}