Skip to content

Commit e34e36a

Browse files
committed
Merge branch 'release/4.5.1'
2 parents c2630f1 + a5cd3c2 commit e34e36a

File tree

4 files changed

+25
-8
lines changed

4 files changed

+25
-8
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Release Notes for Craft Commerce
22

3+
## 4.5.1 - 2024-02-29
4+
5+
- Fixed a SQL error that could occur when updating to Commerce 4 on MySQL. ([#3388](https://github.com/craftcms/commerce/pull/3388))
6+
- Fixed a bug where `craft\commerce\services\Carts::getHasSessionCartNumber()` wasn’t checking the cart cookie. ([#3353](https://github.com/craftcms/commerce/issues/3353))
7+
- 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))
8+
39
## 4.5.0 - 2024-02-26
410

511
- Removed the Lite edition.

src/console/controllers/UpgradeController.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -888,32 +888,32 @@ private function _migrateAddresses()
888888
WHERE NOT EXISTS (
889889
SELECT 1
890890
FROM $ordersTable AS o1
891-
WHERE o1."v3billingAddressId" = a.id
891+
WHERE [[o1.v3billingAddressId]] = a.id
892892
)
893893
AND NOT EXISTS (
894894
SELECT 1
895895
FROM $ordersTable AS o2
896-
WHERE o2."v3shippingAddressId" = a.id
896+
WHERE [[o2.v3shippingAddressId]] = a.id
897897
)
898898
AND NOT EXISTS (
899899
SELECT 1
900900
FROM $ordersTable AS o2
901-
WHERE o2."v3estimatedBillingAddressId" = a.id
901+
WHERE [[o2.v3estimatedBillingAddressId]] = a.id
902902
)
903903
AND NOT EXISTS (
904904
SELECT 1
905905
FROM $ordersTable AS o2
906-
WHERE o2."v3shippingAddressId" = a.id
906+
WHERE [[o2.v3shippingAddressId]] = a.id
907907
)
908908
AND NOT EXISTS (
909909
SELECT 1
910910
FROM $ordersTable AS o2
911-
WHERE o2."v3estimatedShippingAddressId" = a.id
911+
WHERE [[o2.v3estimatedShippingAddressId]] = a.id
912912
)
913913
AND NOT EXISTS (
914914
SELECT 1
915915
FROM $customersAddressesTable AS ca
916-
WHERE ca."addressId" = a.id
916+
WHERE [[ca.addressId]] = a.id
917917
);
918918
SQL;
919919

src/helpers/Product.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public static function populateProductVariantModel(ProductModel $product, $varia
6565
$variantModel->setFieldValues($variant['fields']);
6666
}
6767

68-
if (!empty($variant['title'])) {
68+
if (isset($variant['title'])) {
6969
$variantModel->title = $variant['title'];
7070
}
7171

src/services/Carts.php

+12-1
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,18 @@ public function getCartName(): string
253253
*/
254254
public function getHasSessionCartNumber(): bool
255255
{
256-
return $this->_cartNumber !== null && $this->_cartNumber !== false;
256+
if ($this->_cartNumber === false) {
257+
return false;
258+
}
259+
260+
if ($this->_cartNumber === null) {
261+
$request = Craft::$app->getRequest();
262+
$requestCookies = $request->getCookies();
263+
264+
return $requestCookies->getValue($this->cartCookie['name'], false) !== false;
265+
}
266+
267+
return true;
257268
}
258269

259270
/**

0 commit comments

Comments
 (0)