Skip to content

Commit

Permalink
Merge pull request #32 from FosterCommerce/fix-for-address-editing
Browse files Browse the repository at this point in the history
Attempt to set different controller action and fields for editing an …
  • Loading branch information
peteeveleigh authored Sep 18, 2024
2 parents 14f6b01 + 27ab66e commit 14556cb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
3 changes: 1 addition & 2 deletions src/templates/_components/app/address-fields.twig
Original file line number Diff line number Diff line change
Expand Up @@ -220,15 +220,14 @@
</div>

{% else %}

{% include 'foster-checkout/_components/base/input-text-clearable' with {
context: context,
label: customField.name,
id: 'custom-field-' ~ customField.handle,
name: 'fields[' ~ customField.handle ~ ']',
type: 'text',
placeholder: customField.placeholder,
value: address ? address[customField.handle] : '',
value: address ? address[customField.handle]|escape : '',
required: customField.layoutElement.required,
errors: errors[customField.handle] ?? []
} %}
Expand Down
17 changes: 12 additions & 5 deletions src/templates/checkout/address.twig
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,20 @@
{% include 'foster-checkout/_components/app/steps-completed' with {
step: 'address'
} %}

<form method="post">
<form method="post" >
{{ csrfInput() }}
{{ actionInput('commerce/cart/update-cart') }}
{{ redirectInput(craft.fostercheckout.getPath('checkout') ~ '/shipping') }}
<div v-if="editAddress <= 1">
{{ actionInput('commerce/cart/update-cart') }}
{{ redirectInput(craft.fostercheckout.getPath('checkout') ~ '/shipping') }}
</div>
<div v-else>
{{ actionInput('users/save-address') }}
</div>

<div v-if="editAddress <= 1">
{{ hiddenInput('billingAddressSameAsShipping', 1) }}
</div>


<div class="border border-gray-250 rounded-lg overflow-hidden">

Expand All @@ -53,7 +60,7 @@
<input
v-model="shippingAddressId"
id="address_{{ address.id }}"
name="shippingAddressId"
:name="editAddress > 1 ? 'addressId' : 'shippingAddressId'"
type="radio"
class="sr-only"
value="{{ address.id }}"
Expand Down

0 comments on commit 14556cb

Please sign in to comment.