Skip to content

Commit 3ec20da

Browse files
committed
Fixed product type project config rebuild
1 parent b28c7b7 commit 3ec20da

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
## Unreleased
44

55
- Fixed a bug where the pricing catalog wasn’t getting updated when saving a product. ([#4054](https://github.com/craftcms/commerce/issues/4054))
6-
- Fixed a bug where unavailable gateways were being automatically set on orders.
6+
- Fixed a bug where unavailable gateways were being automatically set on orders.
7+
- Fixed a bug where product type configs were missing their structure properties after rebuilding the project config.
78

89
## 5.4.1 - 2025-07-09
910

src/helpers/ProjectConfigData.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ private static function _getSiteStoresData(): array
148148
*/
149149
private static function _getProductTypeData(): array
150150
{
151+
// @TODO refactor to us `getAllProductTypes()` and call `getConfig()` on each type.
151152
$productTypeRows = (new Query())
152153
->select([
153154
'descriptionFormat',
@@ -169,6 +170,10 @@ private static function _getProductTypeData(): array
169170
'variantTitleTranslationMethod',
170171
'variantTitleTranslationKeyFormat',
171172
'propagationMethod',
173+
'isStructure',
174+
'structureId',
175+
'defaultPlacement',
176+
'maxLevels',
172177
])
173178
->from([Table::PRODUCTTYPES . ' productTypes'])
174179
->all();

src/models/ProductType.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class ProductType extends Model implements FieldLayoutProviderInterface
5353
public const DEFAULT_PLACEMENT_BEGINNING = 'beginning';
5454
/** @since 5.2.0 */
5555
public const DEFAULT_PLACEMENT_END = 'end';
56-
56+
5757
/**
5858
* @var int|null ID
5959
*/
@@ -261,6 +261,7 @@ protected function defineRules(): array
261261
['fieldLayout', 'validateFieldLayout'],
262262
['variantFieldLayout', 'validateVariantFieldLayout'],
263263
['siteSettings', 'required', 'message' => Craft::t('commerce','At least one site must be enabled for the product type.')],
264+
[['isStructure', 'defaultPlacement', 'maxLevels', 'structureId'], 'safe'],
264265
];
265266
}
266267

0 commit comments

Comments
 (0)