Skip to content

Commit

Permalink
Merge branch 'release/4.5.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeholder committed Feb 29, 2024
2 parents c2630f1 + a5cd3c2 commit e34e36a
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 8 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
12 changes: 6 additions & 6 deletions src/console/controllers/UpgradeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/helpers/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
}

Expand Down
13 changes: 12 additions & 1 deletion src/services/Carts.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down

0 comments on commit e34e36a

Please sign in to comment.