Skip to content

Commit

Permalink
Merge pull request #34 from FosterCommerce/fix-address-editing
Browse files Browse the repository at this point in the history
Fix address editing etc
  • Loading branch information
peteeveleigh authored Sep 19, 2024
2 parents e4722db + bb5cb0b commit d54f6ce
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 93 deletions.
18 changes: 10 additions & 8 deletions src/templates/_components/app/steps-completed.twig
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@
{{ 'Shipping address'|t('foster-checkout') }}
</span>
<a href="{{ craft.fostercheckout.getPath('checkout') ~ '/address' }}" class="inline-block underline text-[var(--brandColor)] sm:hidden">
{{ 'Edit'|t('foster-checkout') }}
{{ 'Change'|t('foster-checkout') }}
</a>
</dt>
<dd class="mt-1 sm:flex sm:justify-between sm:items-start sm:gap-4 sm:mt-0">
{% include'foster-checkout/_components/app/formatted-address' with { 'address': cart.shippingAddress} %}
<a class="hidden sm:inline-block sm:underline sm:text-[var(--brandColor)]"
href="{{ craft.fostercheckout.getPath('checkout') ~ '/address' }}">
{{ 'Edit'|t('foster-checkout') }}
{{ 'Change'|t('foster-checkout') }}
</a>
</dd>
</div>
Expand All @@ -54,17 +54,19 @@
</span>
<a href="{{ craft.fostercheckout.getPath('checkout') ~ '/shipping' }}"
class="inline-block underline text-[var(--brandColor)] sm:hidden">
{{ 'Edit'|t('foster-checkout') }}
{{ 'Change'|t('foster-checkout') }}
</a>
</dt>
<dd class="mt-1 sm:flex sm:justify-between sm:items-start sm:gap-4 sm:mt-0">
<p class="text-black">
{{ cart.shippingMethodName }}
{{ cart.shippingMethodName ?? '' }}
</p>
<a class="hidden sm:inline-block sm:underline sm:text-[var(--brandColor)]"
href="{{ craft.fostercheckout.getPath('checkout') ~ '/shipping' }}">
{{ 'Edit'|t('foster-checkout') }}
</a>
{% if cart.availableShippingMethodOptions|length > 1 %}
<a class="hidden sm:inline-block sm:underline sm:text-[var(--brandColor)]"
href="{{ craft.fostercheckout.getPath('checkout') ~ '/shipping' }}">
{{ 'Change'|t('foster-checkout') }}
</a>
{% endif %}
</dd>
</div>
{% endif %}
Expand Down
9 changes: 7 additions & 2 deletions src/templates/checkout/address.twig
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<div class="grid grid-cols-1 gap-16 lg:grid-cols-[1fr_380px] lg:gap-6 xl:grid-cols-[1fr_32.03125%] xl:gap-8">

<main
v-scope="{ shippingAddressId: {{ primaryShippingAddressId }}, editAddress: {{ primaryShippingAddressId == -1 ? 1 : 0 }} }"
v-scope="{ shippingAddressId: {{ cart.sourceShippingAddressId }}, editAddress: {{ primaryShippingAddressId == -1 ? 1 : 0 }} }"
class="pb-8 border-b border-gray-300 lg:pb-0 lg:border-b-0">

<div class="grid grid-cols-1 gap-6 lg:gap-8">
Expand All @@ -34,11 +34,15 @@
</div>
<div v-else>
{{ actionInput('users/save-address') }}
{{ redirectInput(craft.fostercheckout.getPath('checkout') ~ '/address') }}
</div>

<div v-if="editAddress <= 1">
{{ hiddenInput('billingAddressSameAsShipping', 1) }}
</div>
<div v-else>
<input type="hidden" name="addressId" :value="editAddress" />
</div>


<div class="border border-gray-250 rounded-lg overflow-hidden">
Expand All @@ -60,10 +64,11 @@
<input
v-model="shippingAddressId"
id="address_{{ address.id }}"
:name="editAddress > 1 ? 'addressId' : 'shippingAddressId'"
name="shippingAddressId"
type="radio"
class="sr-only"
value="{{ address.id }}"
:checked = "{{ cart.sourceShippingAddressId }} == {{ address.id }}"
@change="editAddress = 0"
/>
<label
Expand Down
167 changes: 84 additions & 83 deletions src/translations/en/foster-checkout.php
Original file line number Diff line number Diff line change
@@ -1,104 +1,105 @@
<?php

return [
'1. Shipping address' => '1. Shipping address',
'2. Shipping method' => '2. Shipping method',
'3. Payment' => '3. Payment',
'Add' => 'Add',
'Address' => 'Address',
'Already have an account?' => 'Already have an account?',
'Apt. number, suite' => 'Apt. number, suite',
'Back to checkout' => 'Back to checkout',
'Billing address' => 'Billing address',
'Cancel' => 'Cancel',
'Cart' => 'Cart',
'Change' => 'Change',
'Checkout' => 'Checkout',
'Email' => 'Email',
'Address' => 'Address',
'Shipping' => 'Shipping',
'Payment' => 'Payment',
'Order' => 'Order',
'Continue Shopping' => 'Continue Shopping',
'Next Step' => 'Next Step',
'Image of' => 'image of',
'SKU' => 'SKU',
'Qty' => 'Qty',
'Quantity' => 'Quantity',
'Remove' => 'Remove',
'Remove from cart' => 'Remove from cart',
'Increment quantity' => 'Increment quantity',
'Only {qty} in stock' => 'Only {qty} in stock',
'Decrement quantity' => 'Decrement quantity',
'Item updated' => 'Item updated',
'Item removed' => 'Item removed',
'You may only purchase {qty} of this item' => 'You may only purchase {qty} of this item',
'You must purchase at least {qty} of this item' => 'You must purchase at least {qty} of this item',
'Save for later' => 'Save for later',
'Choose another' => 'Choose another',
'City' => 'City',
'Clear the cart' => 'Clear the cart',
'Clear this field' => 'Clear this field',
'Coupon Code' => 'Coupon Code',
'Close' => 'Close',
'Confirm Password' => 'Confirm Password',
'Continue Shopping' => 'Continue Shopping',
'Country' => 'Country',
'Coupon added' => 'Coupon added',
'Submit a coupon code to get a discount on your order.' => 'Submit a coupon code to get a discount on your order.',
'Enter Coupon Code' => 'Enter Coupon Code',
'Submit' => 'Submit',
'Estimated shipping to' => 'Estimated shipping to',
'Get estimated shipping' => 'Get estimated shipping',
'Postal Code' => 'Postal Code',
'Coupon Code' => 'Coupon Code',
'Date' => 'Date',
'dateFormat' => 'n/j/y',
'Decrement quantity' => 'Decrement quantity',
'Delivery Postal Code' => 'Delivery Postal Code',
'Update' => 'Update',
'Updating' => 'Updating',
'Removing' => 'Removing',
'Close' => 'Close',
'Your postal code helps us provide the most accurate delivery information.' => 'Your postal code helps us provide the most accurate delivery information.',
'Order Summary' => 'Order Summary',
'Subtotal' => 'Subtotal',
'Discount' => 'Discount',
'Subtotal After Discount' => 'Subtotal After Discount',
'Add' => 'Add',
'for FREE shipping, or choose FREE Ship to Store.' => 'for FREE shipping, or choose FREE Ship to Store.',
'Edit' => 'Edit',
'Email' => 'Email',
'Enter Coupon Code' => 'Enter Coupon Code',
'Enter your email' => 'Enter your email',
'Enter your name' => 'Enter your name',
'Enter your username' => 'Enter your username',
'Estimated shipping to' => 'Estimated shipping to',
'Estimated Tax' => 'Estimated Tax',
'Estimated Total' => 'Estimated Total',
'Select' => 'Select',
'Optional' => 'Optional',
'Country' => 'Country',
'for FREE shipping, or choose FREE Ship to Store.' => 'for FREE shipping, or choose FREE Ship to Store.',
'Full name' => 'Full name',
'Enter your name' => 'Enter your name',
'Street address' => 'Street address',
'Apt. number, suite' => 'Apt. number, suite',
'City' => 'City',
'Your city' => 'Your city',
'State / Province' => 'State / Province',
'Your state or province' => 'Your state or province',
'postalCodeFormat' => '00000',
'Sign In' => 'Sign In',
'Enter your username' => 'Enter your username',
'Enter your email' => 'Enter your email',
'Username' => 'Username',
'Password' => 'Password',
'Get estimated shipping' => 'Get estimated shipping',
'Hide password' => 'Hide password',
'Show password' => 'Show password',
'Back to checkout' => 'Back to checkout',
'Sign Up' => ' Sign Up',
'Confirm Password' => 'Confirm Password',
'Please address the errors noted above.' => 'Please address the errors noted above.',
'I already have an account' => 'I already have an account',
'There are {qty} items in your cart' => 'There are {qty} items in your cart',
'Clear the cart' => 'Clear the cart',
'Your cart is currently empty' => 'Your cart is currently empty',
'to see items you might have added previously.' => 'to see items you might have added previously.',
'Where should we send your receipt?' => 'Where should we send your receipt?',
'Already have an account?' => 'Already have an account?',
'User' => 'User',
'Edit' => 'Edit',
'Cancel' => 'Cancel',
'Image of' => 'image of',
'Increment quantity' => 'Increment quantity',
'Item removed' => 'Item removed',
'Item updated' => 'Item updated',
'Item(s)' => 'Item(s)',
'Method' => 'Method',
'Next Step' => 'Next Step',
'No Image' => 'No Image',
'Only {qty} in stock' => 'Only {qty} in stock',
'Optional' => 'Optional',
'Order' => 'Order',
'Order Details' => 'Order Details',
'Order Summary' => 'Order Summary',
'Password' => 'Password',
'Place Order' => 'Place Order',
'Please address the errors noted above.' => 'Please address the errors noted above.',
'Postal Code' => 'Postal Code',
'Quantity' => 'Quantity',
'Qty' => 'Qty',
'Remove' => 'Remove',
'Remove from cart' => 'Remove from cart',
'Removing' => 'Removing',
'Same as shipping address' => 'Same as shipping address',
'Save' => 'Save',
'Save for later' => 'Save for later',
'Save to address book' => 'Save to your address book',
'Select' => 'Select',
'Shipping' => 'Shipping',
'Ship to' => 'Ship to',
'Method' => 'Method',
'Item(s)' => 'Item(s)',
'Billing address' => 'Billing address',
'Use a different shipping address' => 'Use a different shipping address',
'Use a different billing address' => 'Use a different billing address',
'1. Shipping address' => '1. Shipping address',
'2. Shipping method' => '2. Shipping method',
'3. Payment' => '3. Payment',
'Place Order' => 'Place Order',
'Show password' => 'Show password',
'Sign In' => 'Sign In',
'Sign Up' => 'Sign Up',
'SKU' => 'SKU',
'State / Province' => 'State / Province',
'Street address' => 'Street address',
'Submit' => 'Submit',
'Submit a coupon code to get a discount on your order.' => 'Submit a coupon code to get a discount on your order.',
'Subtotal' => 'Subtotal',
'Subtotal After Discount' => 'Subtotal After Discount',
'Thank you for your order!' => 'Thank you for your order!',
'There are {qty} items in your cart' => 'There are {qty} items in your cart',
'to see items you might have added previously.' => 'to see items you might have added previously.',
'Update' => 'Update',
'Updating' => 'Updating',
'Use a different billing address' => 'Use a different billing address',
'Use a different shipping address' => 'Use a different shipping address',
'Use an address from your address book' => 'Use an address from your address book',
'User' => 'User',
'Username' => 'Username',
'Where should we send your receipt?' => 'Where should we send your receipt?',
'You may only purchase {qty} of this item' => 'You may only purchase {qty} of this item',
'You must purchase at least {qty} of this item' => 'You must purchase at least {qty} of this item',
'Your cart is currently empty' => 'Your cart is currently empty',
'Your city' => 'Your city',
'Your Order Number is' => 'Your Order Number is',
'Your postal code helps us provide the most accurate delivery information.' => 'Your postal code helps us provide the most accurate delivery information.',
'Your state or province' => 'Your state or province',
'You will receive an order confirmation email shortly.' => 'You will receive an order confirmation email shortly.',
'Order Details' => 'Order Details',
'Date' => 'Date',
'dateFormat' => 'n/j/y',
'Same as shipping address' => 'Same as shipping address',
'Use an address from your address book' => 'Use an address from your address book',
'No Image' => 'No Image',
'postalCodeFormat' => '00000',
];

0 comments on commit d54f6ce

Please sign in to comment.