Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.3 #3195

Merged
merged 186 commits into from
Sep 13, 2023
Merged

4.3 #3195

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
186 commits
Select commit Hold shift + click to select a range
03383f4
Add 4.3 to workflow
nfourtythree Jun 15, 2023
7a87fba
Merge branch 'develop' into 4.3
nfourtythree Jun 15, 2023
c5cd66b
Added “Completed Email” translation and show data on the order edit s…
nfourtythree Jun 15, 2023
6bea358
Add `ModiftPurchasablesQueryEvent` for modifying what is return when …
nfourtythree Jun 16, 2023
fe201af
Start the CHANGELOG
nfourtythree Jun 16, 2023
47931a4
Merge branch '4.3' into feature/purchasables-order-edit-event
nfourtythree Jun 16, 2023
c99b87f
Add issue reference to CHANGELOG
nfourtythree Jun 16, 2023
aaf924e
Fix cs and add since to event constant
nfourtythree Jun 16, 2023
6fd05ee
Merge branch 'develop' into 4.3
nfourtythree Jun 20, 2023
9d6c376
Deprecated `setEmail` and `$email` as an attribute on the `Order` ele…
nfourtythree Jun 22, 2023
7ba4ff3
Copy addresses to user when registering during checkout
nfourtythree Jun 23, 2023
a6ac347
Fix cs
nfourtythree Jun 23, 2023
5d85a34
Merge branch 'develop' into feature/copy-addresses-when-registering-d…
nfourtythree Jun 23, 2023
48844d1
add test for registering on checkout
nfourtythree Jun 23, 2023
d2e817a
Add tests
nfourtythree Jun 23, 2023
6ff1c11
Merge pull request #3203 from craftcms/feature/copy-addresses-when-re…
lukeholder Jun 27, 2023
acc8e5f
Upgrade spedup
lukeholder Jul 3, 2023
415f206
Merge branch 'develop' into 4.3
lukeholder Jul 3, 2023
a2e4754
Merge branch 'develop' into 4.3
nfourtythree Jul 5, 2023
5742340
Add columns migration
nfourtythree Jul 6, 2023
223d55c
Add setting an retrieval of new data columns
nfourtythree Jul 6, 2023
9be845a
Ability to set new props from update cart action
nfourtythree Jul 6, 2023
c20346e
Order complete handler for saving addresses to user
nfourtythree Jul 6, 2023
961aee7
Add controller test
nfourtythree Jul 6, 2023
13190f1
Add service logic test
nfourtythree Jul 6, 2023
332ea29
fix cs
nfourtythree Jul 7, 2023
aaf2bfa
Add save addresses params to payments pay action
nfourtythree Jul 11, 2023
9f772de
Tidy register on complete in update cart action
nfourtythree Jul 11, 2023
48ff778
WIP update example templates
nfourtythree Jul 11, 2023
dce9be6
Tidy save addresses JS
nfourtythree Jul 11, 2023
0a64258
Remove register checkbox from payment example template
nfourtythree Jul 13, 2023
5eb1f0a
Tidy comment
nfourtythree Jul 13, 2023
174c17c
Merge branch '4.3' into feature/purchasables-order-edit-event
lukeholder Jul 13, 2023
dac76c6
Tidy example templating
nfourtythree Jul 13, 2023
bc4cf9a
Rename event
nfourtythree Jul 13, 2023
1f3d659
Merge branch '4.3' into bugfix/email-property-on-order
nfourtythree Jul 13, 2023
dc82990
Merge branch 'develop' into 4.3
nfourtythree Jul 13, 2023
0d0cb40
Update fixtures
nfourtythree Jul 13, 2023
a56e17a
fix namespace
nfourtythree Jul 13, 2023
66f087f
Add product type condition rule test
nfourtythree Jul 13, 2023
c207e24
Add variant sku and stock rules to product condition
nfourtythree Jul 13, 2023
23d9308
Merge branch 'develop' into 4.3
nfourtythree Jul 13, 2023
3a54147
Merge branch '4.3' into feature/extra-product-condition-rules
nfourtythree Jul 13, 2023
9d71098
Fix coding standard issues
nfourtythree Jul 13, 2023
b923c77
Added product variant sku condtion rule test
nfourtythree Jul 17, 2023
d386c0f
Merge pull request #3214 from craftcms/feature/save-user-addressess-o…
lukeholder Jul 17, 2023
8468b5d
Merge pull request #3201 from craftcms/bugfix/email-property-on-order
lukeholder Jul 17, 2023
1df2b9c
Added product variant stock condition rule test
nfourtythree Jul 17, 2023
b451c5b
Add modify query tests
nfourtythree Jul 17, 2023
93158b9
fix cs
nfourtythree Jul 17, 2023
aa0fd0c
Added product variant has unlimited stock condition rule
nfourtythree Jul 17, 2023
326eb8a
Added product variant has unlimited stock condition rule test
nfourtythree Jul 17, 2023
9bc65a5
Update CHANGELOG
nfourtythree Jul 17, 2023
19025dd
Update PHPDoc
nfourtythree Jul 17, 2023
9ca9cec
Added product variant price condition rule
nfourtythree Jul 17, 2023
0c459be
Update CHANGELOG
nfourtythree Jul 17, 2023
a189f18
Merge pull request #3198 from craftcms/feature/purchasables-order-edi…
lukeholder Jul 17, 2023
683bfdc
Merge branch 'develop' into 4.3
lukeholder Jul 17, 2023
15357aa
Remove unused
lukeholder Jul 17, 2023
6a7e01a
Merge branch 'develop' into 4.3
lukeholder Jul 17, 2023
2d2ffd9
WIP performance improvements
lukeholder Jul 17, 2023
e448894
WIP address update perf
lukeholder Jul 17, 2023
dce0fa8
WIP discount processing optimisation
nfourtythree Jul 19, 2023
b979371
Add `hasOrderCondtion` test
nfourtythree Jul 19, 2023
6b883cb
Fix logical bugs with `hasXCondtion` in discount model
nfourtythree Jul 19, 2023
55d9a7b
Fix accidental removal of param types
nfourtythree Jul 19, 2023
4a74817
Add more has condition tests
nfourtythree Jul 19, 2023
e38aacb
Fix bugs for tests
nfourtythree Jul 20, 2023
274f166
WIP new active discounts tests
nfourtythree Jul 20, 2023
76e85b8
Keep estimated addresses
lukeholder Jul 21, 2023
d6a04b3
Cleanup
lukeholder Jul 21, 2023
6801b28
Oops
lukeholder Jul 21, 2023
8695ed8
`purchaseTotal` tests
nfourtythree Jul 21, 2023
44425c8
Capture and display the total time to upgrade.
angrybrad Jul 21, 2023
9cd9563
ecs
angrybrad Jul 21, 2023
1a904ca
Active discounts tests qty limits and purchasable limitations
nfourtythree Jul 24, 2023
d6c0f33
fix cs
nfourtythree Jul 24, 2023
2fb2402
Merge branch '4.3' into feature/discount-optimisations
nfourtythree Jul 24, 2023
60d9a30
Merge branch '4.3' into feature/extra-product-condition-rules
nfourtythree Jul 26, 2023
683c408
fix cs
nfourtythree Jul 26, 2023
72fbc68
Create product query tests
nfourtythree Jul 26, 2023
fcd91dd
Add `shippingCategory()` and `shippingCategoryId()` to the product query
nfourtythree Jul 27, 2023
811eb78
Fix doc block
nfourtythree Jul 27, 2023
d61ca35
update uid
nfourtythree Jul 27, 2023
fe0f852
Add `taxCategory()` and `taxCategoryId()` to the product query
nfourtythree Jul 27, 2023
143ca38
Update readme
nfourtythree Jul 27, 2023
bab1b7c
fix cs
nfourtythree Jul 27, 2023
e4dc64b
Action path in changelog
AugustMiller Aug 1, 2023
2dac4c1
Fix load card input value attribute
AugustMiller Aug 1, 2023
a0b3b5d
Merge pull request #3237 from craftcms/bugfix/example-templates-input
nfourtythree Aug 1, 2023
bbca89e
Allow entries in discount and sales relation conditions
lukeholder Aug 1, 2023
7578d10
Build example templates
lukeholder Aug 1, 2023
cbe8fe7
Merge branch '4.3' into feature/entryfication-compatibility
lukeholder Aug 1, 2023
1eae509
Update changelog
lukeholder Aug 1, 2023
2dc93d6
Cleanup
lukeholder Aug 1, 2023
a53ddaa
Merge pull request #3233 from craftcms/feature/product-query-shipping…
lukeholder Aug 1, 2023
de1905c
Merge pull request #3220 from craftcms/feature/extra-product-conditio…
lukeholder Aug 1, 2023
105bebb
Merge branch '4.3' into feature/entryfication-compatibility
lukeholder Aug 1, 2023
9004ec5
Fix shortcut saving and redirecting
lukeholder Aug 2, 2023
3900a20
Cleanup
lukeholder Aug 2, 2023
259d3f9
Merge pull request #3208 from craftcms/feature/upgrade-speedup
lukeholder Aug 2, 2023
993b3c1
Merge pull request #3240 from craftcms/feature/entryfication-compatib…
lukeholder Aug 2, 2023
264500d
Merge branch '4.3' into feature/discount-optimisations
lukeholder Aug 2, 2023
fc47c96
Merge branch 'develop' into 4.3
lukeholder Aug 2, 2023
21ae8fd
Merge branch 'develop' into 4.3
lukeholder Aug 2, 2023
693c0dc
Update changelog
lukeholder Aug 2, 2023
0d8433d
Update source translations
brandonkelly Aug 11, 2023
bd36866
New translations commerce.php (French)
shinybrad Aug 11, 2023
5cb33b2
New translations commerce.php (German)
shinybrad Aug 11, 2023
72b87a3
New translations commerce.php (Italian)
shinybrad Aug 11, 2023
222488c
New translations commerce.php (Japanese)
shinybrad Aug 11, 2023
c82727b
New translations commerce.php (Dutch)
shinybrad Aug 11, 2023
b450fb3
New translations commerce.php (Portuguese)
shinybrad Aug 11, 2023
72a946c
New translations commerce.php (Slovak)
shinybrad Aug 11, 2023
49a78ed
New translations commerce.php (English, United Kingdom)
shinybrad Aug 11, 2023
9577c60
New translations commerce.php (French, Canada)
shinybrad Aug 11, 2023
bf5eb7d
New translations commerce.php (Norwegian Bokmal)
shinybrad Aug 11, 2023
eaf3080
Borrow a couple Craft translations
brandonkelly Aug 11, 2023
bb0fc90
New translations commerce.php (French)
shinybrad Aug 11, 2023
0e52948
New translations commerce.php (German)
shinybrad Aug 11, 2023
1e561db
New translations commerce.php (Italian)
shinybrad Aug 11, 2023
931a07c
New translations commerce.php (Japanese)
shinybrad Aug 11, 2023
c276f42
New translations commerce.php (Dutch)
shinybrad Aug 11, 2023
aba0ec3
New translations commerce.php (Portuguese)
shinybrad Aug 11, 2023
02c9c22
New translations commerce.php (Slovak)
shinybrad Aug 11, 2023
c22d6fc
New translations commerce.php (English, United Kingdom)
shinybrad Aug 11, 2023
f88ce20
New translations commerce.php (French, Canada)
shinybrad Aug 11, 2023
7fa5002
New translations commerce.php (Norwegian Bokmal)
shinybrad Aug 11, 2023
981f11f
Update source file commerce.php
shinybrad Aug 11, 2023
e0c4da0
New translations commerce.php (French)
shinybrad Aug 11, 2023
d65e1c2
New translations commerce.php (French)
shinybrad Aug 11, 2023
8bf5f92
New translations commerce.php (Japanese)
shinybrad Aug 12, 2023
06efe8c
New translations commerce.php (Japanese)
shinybrad Aug 12, 2023
c1a6950
New translations commerce.php (Portuguese)
shinybrad Aug 12, 2023
24c165a
New translations commerce.php (Portuguese)
shinybrad Aug 13, 2023
64febfc
New translations commerce.php (English, United Kingdom)
shinybrad Aug 13, 2023
d293775
New translations commerce.php (Italian)
shinybrad Aug 14, 2023
abe0f3a
New translations commerce.php (Norwegian Bokmal)
shinybrad Aug 14, 2023
ee0039d
Fixed saving of `orderCompletedEmail`
nfourtythree Aug 14, 2023
232face
New translations commerce.php (German)
shinybrad Aug 14, 2023
df654bf
New translations commerce.php (Slovak)
shinybrad Aug 14, 2023
7d22e41
New translations commerce.php (Dutch)
shinybrad Aug 14, 2023
0014fb1
New translations commerce.php (Dutch)
shinybrad Aug 14, 2023
e0a3e05
New translations commerce.php (French, Canada)
shinybrad Aug 14, 2023
8c5314b
Not needed anymore
lukeholder Aug 2, 2023
4bf9b4b
Not used anymore
lukeholder Aug 10, 2023
c23c094
New translations commerce.php (Italian)
shinybrad Aug 15, 2023
35822b5
New translations commerce.php (Dutch)
shinybrad Aug 15, 2023
4eb0bf8
New translations commerce.php (Portuguese)
shinybrad Aug 15, 2023
54dcbbf
New translations commerce.php (Slovak)
shinybrad Aug 15, 2023
34436fa
Fix customer select alignment on order edit
nfourtythree Aug 15, 2023
b357efa
New translations commerce.php (German)
shinybrad Aug 15, 2023
14101eb
New translations commerce.php (Japanese)
shinybrad Aug 15, 2023
7cf5e4b
New translations commerce.php (French, Canada)
shinybrad Aug 15, 2023
7c7e412
New translations commerce.php (Norwegian Bokmal)
shinybrad Aug 16, 2023
ca5060e
Merge branch '4.3' into feature/discount-optimisations
nfourtythree Aug 17, 2023
5c1f2a0
Merge pull request #3221 from craftcms/feature/discount-optimisations
nfourtythree Aug 17, 2023
8d42054
Payment Source created
lukeholder Sep 6, 2023
30a77cb
Merge branch '4.3' of github.com:craftcms/commerce into 4.3
lukeholder Sep 6, 2023
84d64a7
Not needed
lukeholder Sep 12, 2023
6f9a4e6
Cleanup
lukeholder Sep 12, 2023
17dd7ed
Relocate billing portal URL
AugustMiller Sep 12, 2023
35de250
Rearrange links, improve messaging
AugustMiller Sep 12, 2023
d4ed6e6
Merge pull request #3273 from craftcms/bugfix/stripe-payment-sources
lukeholder Sep 12, 2023
3ec8c74
generate for dist
lukeholder Sep 12, 2023
5d2dece
Various example template fixes
lukeholder Sep 12, 2023
37a50d0
Cleanup
lukeholder Sep 12, 2023
4463dd0
Cleanup
lukeholder Sep 12, 2023
49ad7d3
Fix input size in cart affecting layout
AugustMiller Sep 12, 2023
9d3a873
Use PHP_EOL, check for to/from difference, improve messaging
AugustMiller Sep 13, 2023
9f55edb
One more PHP_EOL!
AugustMiller Sep 13, 2023
a86952f
Merge branch '4.3' of github.com:craftcms/commerce into 4.3
lukeholder Sep 13, 2023
e08e474
Merge pull request #3276 from craftcms/feature/data-transfer-cli-eols
lukeholder Sep 13, 2023
e427677
Merge branch 'develop' into 4.3
brandonkelly Sep 13, 2023
5587ea5
Merge pull request #3247 from craftcms/t9n/4.3
brandonkelly Sep 13, 2023
ba8c51f
Changelog cleanup
brandonkelly Sep 13, 2023
27919af
Only return plans for active gateways
lukeholder Sep 13, 2023
48b7b2e
Merge branch '4.3' of github.com:craftcms/commerce into 4.3
lukeholder Sep 13, 2023
8f48fe5
Backwards compatible with Stripe 3 subscriptions
lukeholder Sep 13, 2023
d310aa5
Tweak
brandonkelly Sep 13, 2023
249886e
Merge branch 'develop' into 4.3
brandonkelly Sep 13, 2023
51bc158
Merge branch '4.3' of github.com:craftcms/commerce into 4.3
lukeholder Sep 13, 2023
fec0cbe
Deprecated
lukeholder Sep 13, 2023
8d33a0a
update example templates when no card exists
lukeholder Sep 13, 2023
15c760f
Deprecated release note
brandonkelly Sep 13, 2023
11cc3f1
Merge branch '4.3' of https://github.com/craftcms/commerce into 4.3
brandonkelly Sep 13, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- develop
- v3
- '4.3'
pull_request:
permissions:
contents: read
Expand Down
46 changes: 32 additions & 14 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,39 @@
# Release Notes for Craft Commerce

## Unreleased

- Variant min and max quantity fields now validate together logically. ([#3234](https://github.com/craftcms/commerce/issues/3234))
- Added the “Product Type” product condition rule. ([#3209](https://github.com/craftcms/commerce/issues/3209))
- Fixed a bug where `hasMatchingAddresses()` was incorrectly returning `false`. ([#3183](https://github.com/craftcms/commerce/issues/3183))
- Fixed a bug where changing a user’s email would cause extra user elements to be created. ([#3138](https://github.com/craftcms/commerce/issues/3138))
- Fixed a bug where related sales were showing when creating a new product.
## 4.3.0 - Unreleased

- Sales and discounts now support using related entries in their matching item conditions. ([#3134](https://github.com/craftcms/commerce/issues/3134), [#2717](https://github.com/craftcms/commerce/issues/2717))
- It’s now possible to query products by shipping category and tax category. ([#3219](https://github.com/craftcms/commerce/issues/3219))
- Guest customers registering during checkout now have their addresses saved to their account. ([#3203](https://github.com/craftcms/commerce/pull/3203))
- Product conditions can now have “Product Type”, “Variant SKU”, “Variant Has Unlimited Stock”, “Variant Price”, and “Variant Stock” rules. ([#3209](https://github.com/craftcms/commerce/issues/3209))
- Improved the performance of discount recalculation.
- Improved the performance of the `commerce/upgrade` command. ([#3208](https://github.com/craftcms/commerce/pull/3208))
- Added the `commerce/cart/forget-cart` action. ([#3206](https://github.com/craftcms/commerce/issues/3206))
- The `commerce/cart/update-cart` action now accepts `firstName` and `lastName` address parameters. ([#3015](https://github.com/craftcms/commerce/issues/3015))
- Added `craft\commerce\controllers\OrdersController::EVENT_MODIFY_PURCHASABLES_TABLE_QUERY`. ([#3198](https://github.com/craftcms/commerce/pull/3198))
- Added `craft\commerce\elements\Order::$orderCompletedEmail`. ([#3138](https://github.com/craftcms/commerce/issues/3138))
- Added `craft\commerce\elements\db\ProductQuery::$shippingCategoryId`.
- Added `craft\commerce\elements\db\ProductQuery::$taxCategoryId`.
- Added `craft\commerce\elements\db\ProductQuery::shippingCategory()`.
- Added `craft\commerce\elements\db\ProductQuery::shippingCategoryId()`.
- Added `craft\commerce\elements\db\ProductQuery::taxCategory()`.
- Added `craft\commerce\elements\db\ProductQuery::taxCategoryId()`.
- Added `craft\commerce\models\Discount::hasBillingAddressCondition()`.
- Added `craft\commerce\models\Discount::hasCustomerCondition()`.
- Added `craft\commerce\models\Discount::hasOrderCondition()`.
- Added `craft\commerce\models\Discount::hasShippingAddressCondition()`.
- Deprecated payment source creation via the `commerce/subscriptions/subscribe` action.
- Deprecated `craft\commerce\elements\Order::setEmail()`. `Order::setCustomer()` should be used instead.
- Removed the `htmx` option from the`commerce/example-templates` command.
- Removed the `color` option from the`commerce/example-templates` command.
- Added `craft\commerce\events\ModifyPurchasablesTableQueryEvent`. ([#3198](https://github.com/craftcms/commerce/pull/3198))
- Fixed a bug where products/variants could be saved with a minimum quantity that was set higher than the maximum quantity. ([#3234](https://github.com/craftcms/commerce/issues/3234))
- Fixed a bug where `craft\commerce\elements\Order::hasMatchingAddresses()` could incorrectly return `false`. ([#3183](https://github.com/craftcms/commerce/issues/3183))
- Fixed a bug where changing a user’s email could cause additional user elements to be created. ([#3138](https://github.com/craftcms/commerce/issues/3138))
- Fixed a bug where related sales were displaying when creating a new product.
- Fixed a bug where Commerce wasn’t invoking `craft\services\Elements::EVENT_AUTHORIZE_*` event handlers.
- Fixed a bug where discounts’ per user usage counters weren’t getting migrated properly when upgrading to Commerce 4.
- Fixed a bug where address changes weren’t being synced to carts using them as a source. ([#3178](https://github.com/craftcms/commerce/issues/3178))
- Added `craft\commerce\services\Orders::afterSaveAddressHandler()`.
- Added `craft\commerce\elements\Order::$orderCompletedEmail`. ([#3138](https://github.com/craftcms/commerce/issues/3138))
- Added the `commerce/cart/forget-cart` action. ([#3206](https://github.com/craftcms/commerce/issues/3206))
- The `commerce/cart/update` action now accepts `firstName` and `lastName` in address params. ([#3015](https://github.com/craftcms/commerce/issues/3015))
- Removed the htmx option from the`commerce/example-templates` command.
- Removed the color option from the`commerce/example-templates` command.
- Fixed a bug where address changes weren’t being synced to carts that were using them. ([#3178](https://github.com/craftcms/commerce/issues/3178))
- Fixed an XSS vulnerability.

## 4.2.11 - 2023-06-05
Expand Down
104 changes: 47 additions & 57 deletions example-templates/dist/shop/_private/address/list.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,84 +2,74 @@
{% set selectable = selectable ?? false %}
{% set primaryBillingAddressId = primaryBillingAddressId ?? null %}
{% set primaryShippingAddressId = primaryShippingAddressId ?? null %}
{% set cardWidth = cardWidth ?? 'md:w-1/2' %}
{% set showDelete = showDelete ?? false %}
{% set showAdd = showAdd ?? false %}
{% set addUrl = '/shop/customer/addresses/edit?redirect=' ~ craft.app.request.fullPath %}

{% if currentUser %}
{% if addresses|length %}
<div class="md:flex md:flex-wrap md:-mx-2 pb-4">
{% for address in addresses %}
{% set editUrl = '/shop/customer/addresses/edit?addressId=' ~ address.id ~ '&redirect=' ~ craft.app.request.fullPath %}
<div class="pb-2 my-4 md:px-2 {{ cardWidth }} md:my-0">
{% tag selectable ? 'label' : 'div' with {
class: 'block relative address-select js-address-select border-blue-300 border-b-2 px-6 py-4 rounded-md shadow-md hover:shadow-lg',
data: {
'address-id': address.id,
},
} %}
<span class="js-radio flex py-2">
{% if addresses|length %}
<div class="my-6 grid grid-cols-1 sm:grid-cols-2 md:grid-cols-2 xl:grid-cols-3 gap-4">
{% for address in addresses %}
{% set editUrl = '/shop/customer/addresses/edit?addressId=' ~ address.id ~ '&redirect=' ~ craft.app.request.fullPath %}
<div class="block border border-gray-200 bg-white rounded-lg shadow-sm hover:shadow-md p-4 w-full">
{% tag selectable ? 'label' : 'div' with {
class: 'block relative address-select js-address-select',
data: {
'address-id': address.id,
},
} %}
<span class="js-radio flex py-2">
{% if selectable %}
{{ input('radio', name ~ 'Id', address.id, {
data: {
'model-name': name,
},
checked: (attribute(cart, sourceIdName) == address.id) or (not attribute(cart, sourceIdName) and address.id == attribute(_context, primaryIdName)),
}) }}
{{ input('radio', name ~ 'Id', address.id, {
data: {
'model-name': name,
},
checked: (attribute(cart, sourceIdName) == address.id) or (not attribute(cart, sourceIdName) and address.id == attribute(_context, primaryIdName)),
}) }}
{% endif %}
<span class="-mt-2 ml-3 mb-2">
<span class="-mt-2 mb-2 {% if selectable %}ml-4{% endif %}">
{{ address|address }}
</span>
</span>
<span class="block mb-1">
<span class="block mb-1">
<a href="{{ url(editUrl) }}" class="cursor-pointer rounded px-2 py-1 text-sm inline-block bg-gray-500 hover:bg-gray-600 text-white hover:text-white">
{{- 'Edit'|t -}}
</a>
{% if showDelete and not selectable %}
<form method="post" action="" class="js-address-delete inline-block">
<form method="post" action="" class="js-address-delete inline-block">
{{ csrfInput() }}
{{ actionInput('users/delete-address') }}
{{ redirectInput('shop/customer/addresses') }}
{{ hiddenInput('addressId', address.id) }}
{{ tag('button', {
type: 'submit',
class: 'cursor-pointer rounded px-2 py-1 text-sm inline-block bg-gray-500 hover:bg-gray-600 text-white hover:text-white',
text: 'Delete'|t
}) }}
{{ actionInput('users/delete-address') }}
{{ redirectInput('shop/customer/addresses') }}
{{ hiddenInput('addressId', address.id) }}
{{ tag('button', {
type: 'submit',
class: 'cursor-pointer rounded px-2 py-1 text-sm inline-block bg-gray-500 hover:bg-gray-600 text-white hover:text-white',
text: 'Delete'|t
}) }}
</form>
{% endif %}
</span>

{% if primaryBillingAddressId == address.id or primaryShippingAddressId == address.id %}
<span class="absolute top-4 right-4">
{% if primaryBillingAddressId == address.id %}
<span title="{{ 'Primary billing address'|t }}">💳</span>
{% endif %}
{% if primaryShippingAddressId == address.id %}
<span title="{{ 'Primary shipping address'|t }}">📦</span>
{% endif %}
</span>
{% endtag %}
</div>
{% endfor %}
{% if showAdd %}
<a href="{{ addUrl }}" class="block rounded-lg hover:shadow-md w-full">
<div class="flex items-center justify-center h-full border border-gray-200 bg-white rounded-lg shadow-sm p-4 w-full group hover:shadow-md">
<span class="group-hover:underline">Add Address</span>
</div>
</a>
{% endif %}
{% endtag %}
</div>
{% endfor %}
</div>
{% endif %}
{% if showAdd %}
<div class="pt-2">
<a href="{{ url(addUrl) }}" class="cursor-pointer rounded px-2 py-1 text-sm inline-block bg-blue-500 hover:bg-blue-600 text-white hover:text-white">{{ 'Add address'|t }}</a>
</div>
{% endif %}
{% endif %}
{% endif %}

{% js %}
const addressDeletes = document.querySelectorAll('.js-address-delete');
for (let i = 0; i < addressDeletes.length; i++) {
addressDeletes[i].addEventListener('submit', ev => {
if (!confirm('{{ 'Are you sure you want to delete this address?'|t }}')) {
ev.preventDefault();
const addressDeletes = document.querySelectorAll('.js-address-delete');
for (let i = 0; i < addressDeletes.length; i++) {
addressDeletes[i].addEventListener('submit', ev => {
if (!confirm('{{ 'Are you sure you want to delete this address?'|t }}')) {
ev.preventDefault();
}
});
}
});
}
{% endjs %}
{% endjs %}
18 changes: 18 additions & 0 deletions example-templates/dist/shop/_private/layouts/includes/header.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<div class="bg-gray-900">
<div class="container mx-auto p-6 md:flex justify-content-between align-content-center">
<h1 class="text-3xl">
<a href="{{ siteUrl('/shop') }}" class="text-white">
{{- siteName ~ ' Shop' -}}
</a>
</h1>
{% if craft.app.sites.getAllSites()|length > 1 %}
<div class="ml-auto">
<select name="site" id="js-site-selector" class="mt-1 block w-full rounded-md border-gray-300 py-2 pl-3 pr-10 text-base focus:border-indigo-500 focus:outline-none focus:ring-indigo-500 sm:text-sm">
{% for site in craft.app.sites.getAllSites() %}
<option value="{{ siteUrl(craft.app.request.absoluteUrl|replace(currentSite.getBaseUrl(), ''), null, null, site.id) }}" {% if site.handle == currentSite.handle %}selected{% endif %}>{{ site.name }}</option>
{% endfor %}
</select>
</div>
{% endif %}
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ Outputs the checkout progress navigation using the request path and included `ch
label: 'Payment Method',
url: 'shop/checkout/payment-method'
},
{
label: 'Options',
url: 'shop/checkout/options'
},
{
label: 'Payment',
url: 'shop/checkout/payment'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!-- Template: {{ _self }}.twig -->
{#
Outputs the site’s global main navigation based on path and included `pages` array.

@var cart \craft\commerce\elements\Order
@var currentUser \craft\elements\User
#}
{% set pages = [
{
label: 'My Orders',
url: 'shop/customer/orders'
},
{
label: 'My Addresses',
url: 'shop/customer/addresses'
},
{
label: 'My Stored Cards',
url: 'shop/customer/cards'
}
] %}
{% set currentPath = craft.app.request.pathInfo %}
{# Show the nav if we in a customers page #}
{% if currentPath in pages|column('url') %}
{% set activeClasses = 'bg-gray-200' %}
<div class="bg-gray-50">
<div class="container mx-auto justify-between items-center p-6 relative">
<nav class="-ml-4"
role="navigation"
aria-label="Customer">
{% for page in pages %}
<a href="{{ url(page.url) }}"
class="mx-2 px-2 py-1 rounded{% if page.url in currentPath %} {{ activeClasses }}{% endif %}">
{{- page.label|t -}}
</a>
{% endfor %}
</nav>
</div>
</div>
{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Outputs the site’s global main navigation based on path and included `pages` a
] %}
{% set currentPath = craft.app.request.pathInfo %}
{% set activeClasses = 'bg-white' %}
{# Show the nav if we are not in a checkout page #}
{% if 'checkout' not in currentPath %}
<div class="bg-gray-100">
<div class="container mx-auto justify-between items-center p-6 relative">
Expand Down
32 changes: 13 additions & 19 deletions example-templates/dist/shop/_private/layouts/index.twig
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,22 @@ Common, top-level layout template.
{% set flashNotice = craft.app.session.getFlash('notice') %}
{% set flashError = craft.app.session.getFlash('error') %}

<header>
<div class="bg-gray-900">
<div class="container mx-auto p-6 md:flex justify-content-between align-content-center">
<h1 class="text-3xl">
<a href="{{ siteUrl('/shop') }}" class="text-white">
{{- siteName ~ ' Shop' -}}
</a>
</h1>
{% if craft.app.sites.getAllSites()|length > 1 %}
<div class="ml-auto">
<select name="site" id="js-site-selector" class="mt-1 block w-full rounded-md border-gray-300 py-2 pl-3 pr-10 text-base focus:border-indigo-500 focus:outline-none focus:ring-indigo-500 sm:text-sm">
{% for site in craft.app.sites.getAllSites() %}
<option value="{{ siteUrl(craft.app.request.absoluteUrl|replace(currentSite.getBaseUrl(), ''), null, null, site.id) }}" {% if site.handle == currentSite.handle %}selected{% endif %}>{{ site.name }}</option>
{% endfor %}
</select>
</div>
{% endif %}
</div>
</div>
{% macro docs(text, link) %}
<small class="">
{{ tag('a', {
text: 'ℹ︎ ' ~ text,
href: link,
class: 'text-gray-400 hover:text-gray-600 hover:underline',
target: '_blank',
}) }}
</small>
{% endmacro %}

<header>
{{ include('shop/_private/layouts/includes/header') }}
{{ include('shop/_private/layouts/includes/nav-main') }}
{{ include('shop/_private/layouts/includes/nav-checkout') }}
{{ include('shop/_private/layouts/includes/nav-customer') }}
</header>

<div id="main">
Expand Down
2 changes: 1 addition & 1 deletion example-templates/dist/shop/cart/index.twig
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Outputs cart.
</label>
{{ input('text', 'lineItems[' ~ item.id ~ '][note]', item.note, {
id: 'lineitem-note-' ~ item.id,
class: 'border border-gray-300 hover:border-gray-500 px-4 py-2 leading-tight rounded',
class: 'border border-gray-300 hover:border-gray-500 px-4 py-2 leading-tight rounded w-full',
size: 20,
placeholder: 'My Note'|t
}) }}
Expand Down
4 changes: 2 additions & 2 deletions example-templates/dist/shop/cart/load.twig
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ Outputs form for collecting a cart number to be loaded.
{{- 'Cart Number'|t -}}
</label>
<div>
{{ input('text', 'number', 'border border-gray-300 hover:border-gray-500 px-4 py-2 leading-tight rounded', {
{{ input('text', 'number', null, {
id: 'number',
class: ['w-full', ''],
class: ['w-full', 'border border-gray-300 hover:border-gray-500 px-4 py-2 leading-tight rounded'],
placeholder: '7e89fh0ew8034…'
}) }}
</div>
Expand Down

This file was deleted.

Loading
Loading