diff --git a/CHANGELOG.md b/CHANGELOG.md index e75acf4110..b9ccad3de7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Release Notes for Craft Commerce +## 4.5.1 - 2024-02-29 + +- Fixed a SQL error that could occur when updating to Commerce 4 on MySQL. ([#3388](https://github.com/craftcms/commerce/pull/3388)) +- Fixed a bug where `craft\commerce\services\Carts::getHasSessionCartNumber()` wasn’t checking the cart cookie. ([#3353](https://github.com/craftcms/commerce/issues/3353)) +- Fixed a bug where it wasn’t possible to submit a blank variant title on the Edit Product page. ([#3384](https://github.com/craftcms/commerce/issues/3384)) + ## 4.5.0 - 2024-02-26 - Removed the Lite edition. diff --git a/src/console/controllers/UpgradeController.php b/src/console/controllers/UpgradeController.php index 0870cc7bed..d615de1418 100644 --- a/src/console/controllers/UpgradeController.php +++ b/src/console/controllers/UpgradeController.php @@ -888,32 +888,32 @@ private function _migrateAddresses() WHERE NOT EXISTS ( SELECT 1 FROM $ordersTable AS o1 - WHERE o1."v3billingAddressId" = a.id + WHERE [[o1.v3billingAddressId]] = a.id ) AND NOT EXISTS ( SELECT 1 FROM $ordersTable AS o2 - WHERE o2."v3shippingAddressId" = a.id + WHERE [[o2.v3shippingAddressId]] = a.id ) AND NOT EXISTS ( SELECT 1 FROM $ordersTable AS o2 - WHERE o2."v3estimatedBillingAddressId" = a.id + WHERE [[o2.v3estimatedBillingAddressId]] = a.id ) AND NOT EXISTS ( SELECT 1 FROM $ordersTable AS o2 - WHERE o2."v3shippingAddressId" = a.id + WHERE [[o2.v3shippingAddressId]] = a.id ) AND NOT EXISTS ( SELECT 1 FROM $ordersTable AS o2 - WHERE o2."v3estimatedShippingAddressId" = a.id + WHERE [[o2.v3estimatedShippingAddressId]] = a.id ) AND NOT EXISTS ( SELECT 1 FROM $customersAddressesTable AS ca - WHERE ca."addressId" = a.id + WHERE [[ca.addressId]] = a.id ); SQL; diff --git a/src/helpers/Product.php b/src/helpers/Product.php index 30037520e9..d33733063f 100644 --- a/src/helpers/Product.php +++ b/src/helpers/Product.php @@ -65,7 +65,7 @@ public static function populateProductVariantModel(ProductModel $product, $varia $variantModel->setFieldValues($variant['fields']); } - if (!empty($variant['title'])) { + if (isset($variant['title'])) { $variantModel->title = $variant['title']; } diff --git a/src/services/Carts.php b/src/services/Carts.php index 28e0662d48..ca5e149cf1 100644 --- a/src/services/Carts.php +++ b/src/services/Carts.php @@ -253,7 +253,18 @@ public function getCartName(): string */ public function getHasSessionCartNumber(): bool { - return $this->_cartNumber !== null && $this->_cartNumber !== false; + if ($this->_cartNumber === false) { + return false; + } + + if ($this->_cartNumber === null) { + $request = Craft::$app->getRequest(); + $requestCookies = $request->getCookies(); + + return $requestCookies->getValue($this->cartCookie['name'], false) !== false; + } + + return true; } /**