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
lukeholder committed Nov 13, 2024
2 parents 643d287 + 83b9a4c commit 842b6d4
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 8 deletions.
13 changes: 11 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
# Release Notes for Craft Commerce

## Unreleased

- Fixed a bug where purchasables were showing incorrectly on the Edit Order screen. ([#3756](https://github.com/craftcms/commerce/issues/3756))

## 5.2.2.1 - 2024-11-08

- Fixed a PHP error that could occur when retrieving a variant. ([#3754](https://github.com/craftcms/commerce/issues/3754))

## 5.2.2 - 2024-11-06

- Fixed a bug where product revisions weren’t storing variant relations.
- Fixed a PHP error that occurred when calling a product or variant's render method. ([#3742](https://github.com/craftcms/commerce/issues/3742))
- Fixed a bug where inventory would not save when creating a new variant. ([#3661](https://github.com/craftcms/commerce/issues/3661))
- Fixed a PHP error that occurred when calling a product or variant’s `render()` method. ([#3742](https://github.com/craftcms/commerce/issues/3742))
- Fixed a bug where inventory data wasn’t getting saved when creating a new variant. ([#3661](https://github.com/craftcms/commerce/issues/3661))

## 5.2.1 - 2024-10-23

Expand Down
8 changes: 8 additions & 0 deletions src/controllers/OrdersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,14 @@ public function actionPurchasablesTable(): Response
'and',
'[[elements.id]] = [[purchasables.id]]',
])
// Make sure this purchasable is enabled for the site
->innerJoin(['es' => CraftTable::ELEMENTS_SITES], [
'and',
'[[es.elementId]] = [[purchasables.id]]',
'[[es.siteId]] = :siteId',
], [
':siteId' => $siteId,
])
->innerJoin(Table::PURCHASABLES_STORES . ' pstores', '[[purchasables.id]] = [[pstores.purchasableId]]')
->where(['elements.enabled' => true])
->andWhere(['pstores.storeId' => $store->id])
Expand Down
10 changes: 4 additions & 6 deletions src/elements/Variant.php
Original file line number Diff line number Diff line change
Expand Up @@ -422,18 +422,16 @@ public function attributes(): array
return $names;
}

/**
* @inheritdoc
* @throws InvalidConfigException
* @throws InvalidConfigException
* @throws InvalidConfigException
*/
/**
* @inheritdoc
*/
public function getFieldLayout(): ?FieldLayout
{
try {
if ($this->getOwner() === null) {
return parent::getFieldLayout();
}

return $this->getOwner()->getType()->getVariantFieldLayout();
} catch (InvalidConfigException) {
// The product type was probably deleted
Expand Down
3 changes: 3 additions & 0 deletions src/models/ProductType.php
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,9 @@ public function setTaxCategories(array $taxCategories): void
$this->_taxCategories = $categories;
}

/**
* @inheritdoc
*/
public function getFieldLayout(): FieldLayout
{
return $this->getProductFieldLayout();
Expand Down

0 comments on commit 842b6d4

Please sign in to comment.