Skip to content

Commit a48d79c

Browse files
committed
Merge branch '5.x' into 5.6
2 parents e952d01 + 01b02fd commit a48d79c

6 files changed

Lines changed: 41 additions & 20 deletions

File tree

CHANGELOG.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
# Release Notes for Craft Commerce
22

3-
## Unreleased
3+
## 5.5.1 - 2025-12-04
44

5-
- Fixed a bug where tax and shipping categories weren't getting saved on the Edit variant screen. ([#4180](https://github.com/craftcms/commerce/issues/4180))
6-
- Fixed a bug where newly created variants weren’t visible on Edit product screens.
5+
- Added `craft\commerce\models\CatalogPricingRule::afterPreparePurchasableQuery()`.
6+
- Fixed a bug where tax and shipping categories weren’t getting saved from the Edit variant screen. ([#4180](https://github.com/craftcms/commerce/issues/4180))
7+
- Fixed a bug where newly-created variants weren’t visible on product edit screens.
78
- Fixed a SQL error that could occur when viewing product indexes.
8-
- Fixed a PHP error that occurred when applying project config changes after updating. ([#4185](https://github.com/craftcms/commerce/issues/4185))
9-
- Fixed a bug where an Order’s origin was set incorrectly when creating an order in the control panel.
10-
- Added the missing Preview Targets UI to product type settings. ([#4127](https://github.com/craftcms/commerce/issues/4127))
9+
- Fixed a PHP error that could occur when applying project config changes after updating. ([#4185](https://github.com/craftcms/commerce/issues/4185))
10+
- Fixed a bug where an order’s origin could be set incorrectly if it was created in the control panel.
11+
- Fixed a bug where order edit screens weren’t formatting prices using the user’s preferred formatting locale.
12+
- Fixed a SQL error that could occur when generating the pricing catalog. ([#4175](https://github.com/craftcms/commerce/issues/4175))
1113

1214
## 5.5.0.1 - 2025-11-24
1315

src/models/CatalogPricingRule.php

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -322,23 +322,16 @@ public function getPurchasableIds(): ?array
322322
}
323323

324324
// We are unable to use `siteId()` on the purchasable query as it is only the subquery part that is used.
325-
Event::once(ElementQuery::class, ElementQuery::EVENT_AFTER_PREPARE, function(CancelableEvent $event) use ($siteIds) {
326-
foreach ($event->sender->subQuery->where as &$value) {
327-
if (is_array($value) && isset($value['elements_sites.siteId'])) {
328-
$value['elements_sites.siteId'] = $siteIds;
329-
}
330-
}
331-
332-
$event->sender->subQuery->join[] = ['LEFT JOIN', ['sitestores' => Table::SITESTORES], '[[elements_sites.siteId]] = [[sitestores.siteId]]'];
333-
$event->sender->subQuery->join[] = ['LEFT JOIN', ['purchasables_stores' => Table::PURCHASABLES_STORES], '[[purchasables_stores.storeId]] = [[sitestores.storeId]] AND [[purchasables_stores.purchasableId]] = [[elements.id]]'];
334-
});
335325

336326
// If the rule is generating a promotional price, we need to make sure the purchasable is promotable
337327
if ($this->isPromotionalPrice) {
338328
$purchasableQuery->andWhere(Db::parseBooleanParam('purchasables_stores.promotable', true));
339329
}
340330

331+
// Do this adjustment to the query once (was previously using `Event::once` but this caused issues in some edge cases)
332+
$purchasableQuery->on(ElementQuery::EVENT_AFTER_PREPARE, [$this, 'afterPreparePurchasableQuery'], ['siteIds' => $siteIds]);
341333
$this->_purchasableIds = $purchasableQuery->ids();
334+
$purchasableQuery->off(ElementQuery::EVENT_AFTER_PREPARE, [$this, 'afterPreparePurchasableQuery']);
342335
}
343336

344337
$this->_purchasableIds = $this->_purchasableIds !== null ? array_unique($this->_purchasableIds) : null;
@@ -347,6 +340,23 @@ public function getPurchasableIds(): ?array
347340
return $this->_purchasableIds;
348341
}
349342

343+
/**
344+
* @param CancelableEvent $event
345+
* @return void
346+
* @since 5.5.1
347+
*/
348+
public function afterPreparePurchasableQuery(CancelableEvent $event): void
349+
{
350+
foreach ($event->sender->subQuery->where as &$value) {
351+
if (is_array($value) && isset($value['elements_sites.siteId'])) {
352+
$value['elements_sites.siteId'] = $event->data['siteIds'];
353+
}
354+
}
355+
356+
$event->sender->subQuery->join[] = ['LEFT JOIN', ['sitestores' => Table::SITESTORES], '[[elements_sites.siteId]] = [[sitestores.siteId]]'];
357+
$event->sender->subQuery->join[] = ['LEFT JOIN', ['purchasables_stores' => Table::PURCHASABLES_STORES], '[[purchasables_stores.storeId]] = [[sitestores.storeId]] AND [[purchasables_stores.purchasableId]] = [[elements.id]]'];
358+
}
359+
350360
/**
351361
* @return ElementConditionInterface
352362
*/

src/templates/_components/gateways/_modalWrapper.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
autocomplete="off"
2929
placeholder="{{ order.outstandingBalance }}"
3030
step="any" min="1" max="{{ order.outstandingBalance }}"
31-
value="{{ order.getPaymentAmount() }}" style="margin: 0 0 0 5px; width:{{ 65 + (10*order.outstandingBalance|length) }}px;">
31+
value="{{ order.getPaymentAmount()|number }}" style="margin: 0 0 0 5px; width:{{ 65 + (10*order.outstandingBalance|length) }}px;">
3232

3333
{% set currencies = craft.commerce.paymentCurrencies.getAllPaymentCurrencies(order.store.id) %}
3434
{% set primaryCurrency = craft.commerce.paymentCurrencies.getPrimaryPaymentCurrency(order.store.id) %}

src/web/assets/inventory/dist/css/inventory.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/web/assets/inventory/dist/css/inventory.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/web/assets/inventory/src/css/inventory.scss

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1-
.inventory-headers,
1+
.inventory-headers {
2+
.ltr & {
3+
justify-content: flex-end;
4+
}
5+
6+
.rtl & {
7+
justify-content: flex-start;
8+
}
9+
}
10+
211
.inventory-cell {
312
.ltr & {
413
text-align: right;

0 commit comments

Comments
 (0)