Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:craftcms/commerce into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
nfourtythree committed Nov 13, 2023
2 parents 5917cd7 + 997cc85 commit 5a191c0
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 14 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

## Unreleased

- Improved the performance of the `craft\commerce\elements\db\VariantQuery::hasProduct()` and `craft\commerce\elements\db\ProductQuery::hasVariant()` query params. ([#3325](https://github.com/craftcms/commerce/pull/3325))
- Order statuses with long names no longer line wrap on the Orders index page. ([#3335](https://github.com/craftcms/commerce/issues/3335))
- Fixed duplicate validate errors that occurred when submitting a zero quantity to the cart. ([3334](https://github.com/craftcms/commerce/issues/3334))

## 4.3.2 - 2023-10-31

- Product GraphQL queries now support `promotable`, `freeShipping`, `defaultSku`, `defaultHeight`, `defaultLength`, `defaultWidth`, and `defaultWeight` arguments. ([#3307](https://github.com/craftcms/commerce/pull/3307))
Expand Down
10 changes: 5 additions & 5 deletions src/elements/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -2457,7 +2457,7 @@ public function getCustomerLinkHtml(): string
public function getOrderStatusHtml(): string
{
if ($status = $this->getOrderStatus()) {
return '<span class="commerceStatusLabel"><span class="status ' . $status->color . '"></span> ' . $status->name . '</span>';
return '<span class="commerceStatusLabel nowrap"><span class="status ' . $status->color . '"></span>' . $status->name . '</span>';
}

return '';
Expand All @@ -2469,10 +2469,10 @@ public function getOrderStatusHtml(): string
public function getPaidStatusHtml(): string
{
return match ($this->getPaidStatus()) {
self::PAID_STATUS_OVERPAID => '<span class="commerceStatusLabel"><span class="status blue"></span> ' . Craft::t('commerce', 'Overpaid') . '</span>',
self::PAID_STATUS_PAID => '<span class="commerceStatusLabel"><span class="status green"></span> ' . Craft::t('commerce', 'Paid') . '</span>',
self::PAID_STATUS_PARTIAL => '<span class="commerceStatusLabel"><span class="status orange"></span> ' . Craft::t('commerce', 'Partial') . '</span>',
self::PAID_STATUS_UNPAID => '<span class="commerceStatusLabel"><span class="status red"></span> ' . Craft::t('commerce', 'Unpaid') . '</span>',
self::PAID_STATUS_OVERPAID => '<span class="commerceStatusLabel nowrap"><span class="status blue"></span>' . Craft::t('commerce', 'Overpaid') . '</span>',
self::PAID_STATUS_PAID => '<span class="commerceStatusLabel nowrap"><span class="status green"></span>' . Craft::t('commerce', 'Paid') . '</span>',
self::PAID_STATUS_PARTIAL => '<span class="commerceStatusLabel nowrap"><span class="status orange"></span>' . Craft::t('commerce', 'Partial') . '</span>',
self::PAID_STATUS_UNPAID => '<span class="commerceStatusLabel nowrap"><span class="status red"></span>' . Craft::t('commerce', 'Unpaid') . '</span>',
default => '',
};
}
Expand Down
1 change: 0 additions & 1 deletion src/elements/Variant.php
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,6 @@ function($attribute, $params, Validator $validator) use ($lineItem, $getQty) {
}
},
],
[['qty'], 'integer', 'min' => 1, 'skipOnError' => false],
];
}

Expand Down
5 changes: 2 additions & 3 deletions src/elements/db/ProductQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -1126,12 +1126,11 @@ private function _applyHasVariantParam(): void

$variantQuery->limit = null;
$variantQuery->select('commerce_variants.productId');
$productIds = $variantQuery->asArray()->column();

// Remove any blank product IDs (if any)
$productIds = array_filter($productIds);
$variantQuery->andWhere(['not', ['commerce_variants.productId' => null]]);

$this->subQuery->andWhere(['commerce_products.id' => array_values($productIds)]);
$this->subQuery->andWhere(['commerce_products.id' => $variantQuery]);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/elements/db/VariantQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -927,11 +927,11 @@ private function _applyHasProductParam(): void

$productQuery->limit = null;
$productQuery->select('commerce_products.id');
$productIds = $productQuery->column();

// Remove any blank product IDs (if any)
$productIds = array_filter($productIds);
$this->subQuery->andWhere(['commerce_variants.productId' => $productIds]);
$productQuery->andWhere(['not', ['commerce_products.id' => null]]);

$this->subQuery->andWhere(['commerce_variants.productId' => $productQuery]);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/models/LineItemStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public function getCpEditUrl(): string

public function getLabelHtml(): string
{
return sprintf('<span class="commerceStatusLabel"><span class="status %s"></span>%s</span>', $this->color, Html::encode($this->name));
return sprintf('<span class="commerceStatusLabel nowrap"><span class="status %s"></span>%s</span>', $this->color, Html::encode($this->name));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/models/OrderStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public function getEmails(): array

public function getLabelHtml(): string
{
return sprintf('<span class="commerceStatusLabel"><span class="status %s"></span>%s</span>', $this->color, Html::encode($this->getDisplayName()));
return sprintf('<span class="commerceStatusLabel nowrap"><span class="status %s"></span>%s</span>', $this->color, Html::encode($this->getDisplayName()));
}

/**
Expand Down

0 comments on commit 5a191c0

Please sign in to comment.