Skip to content

Commit bdca33a

Browse files
committed
Merge branch 'release/4.3.1'
2 parents 65a6166 + 382f13f commit bdca33a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1425
-457
lines changed

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# Release Notes for Craft Commerce
22

3+
## 4.3.1 - 2023-10-18
4+
5+
- Added the `commerce/gateways/list` command.
6+
- Added the `commerce/gateways/webhook-url` command.
7+
- Improved the performance of the `commerce/upgrade` command. ([#3286](https://github.com/craftcms/commerce/issues/3286))
8+
- Auto-generated variant titles and SKUs are now generated before products are saved. ([#3297](https://github.com/craftcms/commerce/pull/3297))
9+
- Added `craft\commerce\models\ShippingMethodOption::$shippingMethod`. ([#3274](https://github.com/craftcms/commerce/pull/3274), [#3271](https://github.com/craftcms/commerce/issues/3271))
10+
- `craft\commerce\services\Purchasables::EVENT_PURCHASABLE_SHIPPABLE` event handlers can now access the order. ([#3279](https://github.com/craftcms/commerce/pull/3279))
11+
- Fixed a bug where Edit Product pages showed a Delete button for users that didn’t have permission to delete the product. ([#3285](https://github.com/craftcms/commerce/issues/3285))
12+
- Fixed a bug where it was possible to select soft-deleted shipping categories. ([#3272](https://github.com/craftcms/commerce/issues/3272))
13+
- Fixed a bug where the Customer condition rule wasn’t loading correctly. ([#3291](https://github.com/craftcms/commerce/issues/3291))
14+
- Fixed an error that could occur when rendering a PDF. ([#2633](https://github.com/craftcms/commerce/issues/2633))
15+
- Fixed a bug where sales’ and discounts’ timestamps weren’t getting populated. ([#3298](https://github.com/craftcms/commerce/issues/3298))
16+
- Fixed a bug where the `commerce/upgrade` command could create duplicate inactive users. ([#3286](https://github.com/craftcms/commerce/issues/3286))
17+
- Fixed a bug where `commerce/payments/pay` JSON responses were missing the `redirect` key. ([#3265](https://github.com/craftcms/commerce/issues/3265))
18+
319
## 4.3.0 - 2023-09-13
420

521
- 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))

composer.lock

Lines changed: 613 additions & 368 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example-templates/dist/shop/_private/address/fields.twig

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -198,30 +198,17 @@ Outputs address form fields for editing an address.
198198
{% if showPrimaryCheckboxes %}
199199
<hr class="my-2">
200200
<div class="my-2">
201-
{{ input('text', 'isPrimaryBilling', address.isPrimarybilling ? 1 : 0) }}
202-
<label>{{ input('checkbox', 'isPrimaryBillingBox', 1, { checked: address.isPrimaryBilling, 'data-primary-input': 'isPrimaryBilling' }) }} {{ 'Use as the primary billing address'|t('commerce') }}</label>
201+
{{ hiddenInput('isPrimaryBilling', 0) }}
202+
<label>{{ input('checkbox', 'isPrimaryBilling', 1, { checked: address.isPrimaryBilling }) }} {{ 'Use as the primary billing address'|t('commerce') }}</label>
203203
</div>
204204
<div class="my-2">
205-
{{ input('text', 'isPrimaryShipping', address.isPrimaryShipping ? 1 : 0) }}
206-
<label>{{ input('checkbox', 'isPrimaryShippingBox', 1, { checked: address.isPrimaryShipping, 'data-primary-input': 'isPrimaryShipping' }) }} {{ 'Use as the primary shipping address'|t('commerce') }}</label>
205+
{{ hiddenInput('isPrimaryShipping', 0) }}
206+
<label>{{ input('checkbox', 'isPrimaryShipping', 1, { checked: address.isPrimaryShipping }) }} {{ 'Use as the primary shipping address'|t('commerce') }}</label>
207207
</div>
208208
{% endif %}
209209
</div>
210210

211211
{% js %}
212-
{% if showPrimaryCheckboxes %}
213-
document.querySelectorAll('input[type=checkbox][data-primary-input]').forEach(el => {
214-
el.addEventListener('change', ev => {
215-
let primaryInput = document.querySelector(`input[name="${ev.target.dataset.primaryInput}"]`);
216-
if (ev.target.checked) {
217-
primaryInput.value = 1;
218-
} else {
219-
primaryInput.value = 0;
220-
}
221-
});
222-
});
223-
{% endif %}
224-
225212
document.querySelector('select#{{ 'countryCode'|namespaceInputId(addressName) }}').addEventListener('change', ev => {
226213
const countryCode = ev.target.value;
227214
const stateSelect = document.querySelector('select#{{ 'administrativeArea'|namespaceInputId(addressName) }}');

example-templates/dist/shop/_private/address/list.twig

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@
77
{% set addUrl = '/shop/customer/addresses/edit?redirect=' ~ craft.app.request.fullPath %}
88

99
{% if currentUser %}
10-
{% if addresses|length %}
1110
<div class="my-6 grid grid-cols-1 sm:grid-cols-2 md:grid-cols-2 xl:grid-cols-3 gap-4">
1211
{% for address in addresses %}
1312
{% set editUrl = '/shop/customer/addresses/edit?addressId=' ~ address.id ~ '&redirect=' ~ craft.app.request.fullPath %}
14-
<div class="block border border-gray-200 bg-white rounded-lg shadow-sm hover:shadow-md p-4 w-full">
13+
<div class="block border border-gray-200 bg-white rounded-lg shadow-sm hover:shadow-md p-4 w-full relative">
1514
{% tag selectable ? 'label' : 'div' with {
1615
class: 'block relative address-select js-address-select',
1716
data: {
@@ -50,18 +49,29 @@
5049
{% endif %}
5150
</span>
5251
{% endtag %}
52+
{% if primaryBillingAddressId == address.id or primaryShippingAddressId == address.id %}
53+
<div class="absolute top-0 right-0 pr-4 pt-4">
54+
{% if primaryBillingAddressId == address.id %}
55+
<span title="{{ 'Primary billing address'|t }}">💳</span>
56+
{% endif %}
57+
{% if primaryShippingAddressId == address.id %}
58+
<span title="{{ 'Primary shipping address'|t }}">📦</span>
59+
{% endif %}
60+
</div>
61+
{% endif %}
5362
</div>
5463
{% endfor %}
5564
{% if showAdd %}
56-
<a href="{{ addUrl }}" class="block rounded-lg hover:shadow-md w-full">
57-
<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">
58-
<span class="group-hover:underline">Add Address</span>
65+
<a href="{{ addUrl }}" class="block rounded-lg border border-gray-200 bg-white hover:shadow-md w-full relative">
66+
<div class="absolute top-0 left-0 right-0 bottom-0 flex items-center">
67+
<div class="flex items-center justify-center h-full p-4 w-full group">
68+
<span class="group-hover:underline">Add Address</span>
69+
</div>
5970
</div>
6071
</a>
6172
{% endif %}
6273
</div>
6374
{% endif %}
64-
{% endif %}
6575

6676
{% js %}
6777
const addressDeletes = document.querySelectorAll('.js-address-delete');

example-templates/dist/shop/checkout/options.twig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@
8383

8484
{% if saveAddressCheckboxesShown %}
8585
<div>
86-
{{ _self.docs('Saving addresses on order complete.', '#') }}
86+
{# Wait until there is a docs page #}
87+
{# {{ _self.docs('Saving addresses on order complete.', '#') }}#}
8788
</div>
8889
{% endif %}
8990

example-templates/src/shop/_private/address/fields.twig

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -198,30 +198,17 @@ Outputs address form fields for editing an address.
198198
{% if showPrimaryCheckboxes %}
199199
<hr class="my-2">
200200
<div class="my-2">
201-
{{ input('text', 'isPrimaryBilling', address.isPrimarybilling ? 1 : 0) }}
202-
<label>{{ input('checkbox', 'isPrimaryBillingBox', 1, { checked: address.isPrimaryBilling, 'data-primary-input': 'isPrimaryBilling' }) }} {{ 'Use as the primary billing address'|t('commerce') }}</label>
201+
{{ hiddenInput('isPrimaryBilling', 0) }}
202+
<label>{{ input('checkbox', 'isPrimaryBilling', 1, { checked: address.isPrimaryBilling }) }} {{ 'Use as the primary billing address'|t('commerce') }}</label>
203203
</div>
204204
<div class="my-2">
205-
{{ input('text', 'isPrimaryShipping', address.isPrimaryShipping ? 1 : 0) }}
206-
<label>{{ input('checkbox', 'isPrimaryShippingBox', 1, { checked: address.isPrimaryShipping, 'data-primary-input': 'isPrimaryShipping' }) }} {{ 'Use as the primary shipping address'|t('commerce') }}</label>
205+
{{ hiddenInput('isPrimaryShipping', 0) }}
206+
<label>{{ input('checkbox', 'isPrimaryShipping', 1, { checked: address.isPrimaryShipping }) }} {{ 'Use as the primary shipping address'|t('commerce') }}</label>
207207
</div>
208208
{% endif %}
209209
</div>
210210

211211
{% js %}
212-
{% if showPrimaryCheckboxes %}
213-
document.querySelectorAll('input[type=checkbox][data-primary-input]').forEach(el => {
214-
el.addEventListener('change', ev => {
215-
let primaryInput = document.querySelector(`input[name="${ev.target.dataset.primaryInput}"]`);
216-
if (ev.target.checked) {
217-
primaryInput.value = 1;
218-
} else {
219-
primaryInput.value = 0;
220-
}
221-
});
222-
});
223-
{% endif %}
224-
225212
document.querySelector('select#{{ 'countryCode'|namespaceInputId(addressName) }}').addEventListener('change', ev => {
226213
const countryCode = ev.target.value;
227214
const stateSelect = document.querySelector('select#{{ 'administrativeArea'|namespaceInputId(addressName) }}');

example-templates/src/shop/_private/address/list.twig

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@
77
{% set addUrl = '/[[folderName]]/customer/addresses/edit?redirect=' ~ craft.app.request.fullPath %}
88

99
{% if currentUser %}
10-
{% if addresses|length %}
1110
<div class="my-6 grid grid-cols-1 sm:grid-cols-2 md:grid-cols-2 xl:grid-cols-3 gap-4">
1211
{% for address in addresses %}
1312
{% set editUrl = '/[[folderName]]/customer/addresses/edit?addressId=' ~ address.id ~ '&redirect=' ~ craft.app.request.fullPath %}
14-
<div class="block border border-gray-200 bg-white rounded-lg shadow-sm hover:shadow-md p-4 w-full">
13+
<div class="block border border-gray-200 bg-white rounded-lg shadow-sm hover:shadow-md p-4 w-full relative">
1514
{% tag selectable ? 'label' : 'div' with {
1615
class: 'block relative address-select js-address-select',
1716
data: {
@@ -50,18 +49,29 @@
5049
{% endif %}
5150
</span>
5251
{% endtag %}
52+
{% if primaryBillingAddressId == address.id or primaryShippingAddressId == address.id %}
53+
<div class="absolute top-0 right-0 pr-4 pt-4">
54+
{% if primaryBillingAddressId == address.id %}
55+
<span title="{{ 'Primary billing address'|t }}">💳</span>
56+
{% endif %}
57+
{% if primaryShippingAddressId == address.id %}
58+
<span title="{{ 'Primary shipping address'|t }}">📦</span>
59+
{% endif %}
60+
</div>
61+
{% endif %}
5362
</div>
5463
{% endfor %}
5564
{% if showAdd %}
56-
<a href="{{ addUrl }}" class="block rounded-lg hover:shadow-md w-full">
57-
<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">
58-
<span class="group-hover:underline">Add Address</span>
65+
<a href="{{ addUrl }}" class="block rounded-lg border border-gray-200 bg-white hover:shadow-md w-full relative">
66+
<div class="absolute top-0 left-0 right-0 bottom-0 flex items-center">
67+
<div class="flex items-center justify-center h-full p-4 w-full group">
68+
<span class="group-hover:underline">Add Address</span>
69+
</div>
5970
</div>
6071
</a>
6172
{% endif %}
6273
</div>
6374
{% endif %}
64-
{% endif %}
6575

6676
{% js %}
6777
const addressDeletes = document.querySelectorAll('.js-address-delete');

example-templates/src/shop/checkout/options.twig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@
8383

8484
{% if saveAddressCheckboxesShown %}
8585
<div>
86-
{{ _self.docs('Saving addresses on order complete.', '#') }}
86+
{# Wait until there is a docs page #}
87+
{# {{ _self.docs('Saving addresses on order complete.', '#') }}#}
8788
</div>
8889
{% endif %}
8990

src/Plugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ public static function editions(): array
209209
/**
210210
* @inheritDoc
211211
*/
212-
public string $schemaVersion = '4.2.6';
212+
public string $schemaVersion = '4.2.7';
213213

214214
/**
215215
* @inheritdoc

src/base/Gateway.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,12 @@ public function getWebhookUrl(array $params = []): string
6262

6363
$url = UrlHelper::actionUrl('commerce/webhooks/process-webhook', $params);
6464

65-
return StringHelper::replace($url, Craft::$app->getConfig()->getGeneral()->cpTrigger . '/', '');
65+
// Remove the cpTrigger from the url if it's there.
66+
if (Craft::$app->getConfig()->getGeneral()->cpTrigger) {
67+
$url = StringHelper::replace($url, Craft::$app->getConfig()->getGeneral()->cpTrigger . '/', '');
68+
}
69+
70+
return $url;
6671
}
6772

6873
/**

0 commit comments

Comments
 (0)