From 01c5b4a713e30bcec98ff4e59e6dbad54106db91 Mon Sep 17 00:00:00 2001 From: Nathaniel Hammond Date: Fri, 12 Jan 2024 08:51:38 +0000 Subject: [PATCH] Fixed #3364 saving a sale error --- CHANGELOG.md | 4 ++++ src/controllers/SalesController.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d45a62d69d..a6bb0b83ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Release Notes for Craft Commerce +## Unreleased + +- Fixed a PHP error that occurred when saving a sale. ([#3364](https://github.com/craftcms/commerce/issues/3364)) + ## 4.4.1 - 2024-01-12 - Fixed a SQL error that could occur when updating to Commerce 4.4.0 on MySQL. ([#3367](https://github.com/craftcms/commerce/issues/3367)) diff --git a/src/controllers/SalesController.php b/src/controllers/SalesController.php index e75b04036a..64ab1b4fc1 100644 --- a/src/controllers/SalesController.php +++ b/src/controllers/SalesController.php @@ -142,7 +142,7 @@ public function actionSave(): ?Response $sale->sortOrder = (int)$this->request->getBodyParam('sortOrder'); $sale->ignorePrevious = (bool)$this->request->getBodyParam('ignorePrevious'); $sale->stopProcessing = (bool)$this->request->getBodyParam('stopProcessing'); - $sale->categoryRelationshipType = $this->request->getBodyParam('categoryRelationshipType'); + $sale->categoryRelationshipType = $this->request->getBodyParam('categoryRelationshipType', $sale->categoryRelationshipType); $applyAmount = Localization::normalizeNumber($applyAmount); if ($sale->apply == SaleRecord::APPLY_BY_PERCENT || $sale->apply == SaleRecord::APPLY_TO_PERCENT) {