Skip to content

Commit

Permalink
Merge branch '5.x' into 5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
nfourtythree committed Dec 10, 2024
2 parents 483fdb4 + cdb0426 commit 71b377a
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Release Notes for Craft Commerce

## Unreleased

- Fixed a bug where a product’s default price was showing incorrectly on the Products index page. ([#3807](https://github.com/craftcms/commerce/issues/3807))
- Fixed a bug where inline-editable Matrix fields weren’t saving content on product variants. ([#3805](https://github.com/craftcms/commerce/issues/3805))
- Fixed a bug where order errors weren't showing on the Edit Order page.

## 5.2.8 - 2024-12-04

- Fixed a bug where line items weren’t getting hyperlinked within Edit Order pages. ([#3792](https://github.com/craftcms/commerce/issues/3792))
Expand Down
2 changes: 2 additions & 0 deletions src/base/Purchasable.php
Original file line number Diff line number Diff line change
Expand Up @@ -1119,6 +1119,8 @@ public function afterSave(bool $isNew): void
*/
public function afterPropagate(bool $isNew): void
{
parent::afterPropagate($isNew);

Plugin::getInstance()->getCatalogPricing()->createCatalogPricingJob([
'purchasableIds' => [$this->getCanonicalId()],
'storeId' => $this->getStoreId(),
Expand Down
1 change: 1 addition & 0 deletions src/controllers/OrdersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1447,6 +1447,7 @@ private function _registerJavascript(array $variables): void

if ($order->hasErrors()) {
$response['order']['errors'] = $order->getErrors();
$response['errors'] = $order->getErrors();
$response['error'] = Craft::t('commerce', 'The order is not valid.');
}

Expand Down
1 change: 1 addition & 0 deletions src/elements/Variant.php
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,7 @@ public function afterSave(bool $isNew): void
parent::afterSave($isNew);

if (!$this->propagating && $this->isDefault && $ownerId && $this->duplicateOf === null) {
// @TODO - this data is now joined in on the product query so can be removed at the next breaking change
$defaultData = [
'defaultVariantId' => $this->id,
'defaultSku' => $this->getSkuAsText(),
Expand Down
14 changes: 8 additions & 6 deletions src/elements/db/ProductQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -768,18 +768,20 @@ protected function beforePrepare(): bool
'commerce_products.postDate',
'commerce_products.expiryDate',
'subquery.price as defaultPrice',
'commerce_products.defaultPrice as defaultBasePrice',
'purchasablesstores.basePrice as defaultBasePrice',
'commerce_products.defaultVariantId',
'commerce_products.defaultSku',
'commerce_products.defaultWeight',
'commerce_products.defaultLength',
'commerce_products.defaultWidth',
'commerce_products.defaultHeight',
'purchasables.sku as defaultSku',
'purchasables.weight as defaultWeight',
'purchasables.length as defaultLength',
'purchasables.width as defaultWidth',
'purchasables.height as defaultHeight',
'sitestores.storeId',
]);

// Join in sites stores to get product's store for current request
$this->query->leftJoin(['sitestores' => Table::SITESTORES], '[[elements_sites.siteId]] = [[sitestores.siteId]]');
$this->query->leftJoin(['purchasables' => Table::PURCHASABLES], '[[purchasables.id]] = [[commerce_products.defaultVariantId]]');
$this->query->leftJoin(['purchasablesstores' => Table::PURCHASABLES_STORES], '[[purchasablesstores.purchasableId]] = [[commerce_products.defaultVariantId]] and [[sitestores.storeId]] = [[purchasablesstores.storeId]]');

$this->subQuery->addSelect(['catalogprices.price']);

Expand Down

0 comments on commit 71b377a

Please sign in to comment.