-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '2.4-develop' into ISSUE-30286-widget-remove-layout-update
- Loading branch information
Showing
42 changed files
with
1,709 additions
and
353 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
app/code/Magento/Bundle/Model/Sales/Order/Shipment/BundleShipmentTypeValidator.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\Bundle\Model\Sales\Order\Shipment; | ||
|
||
use Magento\Catalog\Model\Product\Type; | ||
use Magento\Sales\Model\ValidatorInterface; | ||
|
||
/** | ||
* Validate if requested order items can be shipped according to bundle product shipment type | ||
*/ | ||
class BundleShipmentTypeValidator implements ValidatorInterface | ||
{ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
public function validate($item) | ||
{ | ||
$result = []; | ||
if (!$item->isDummy(true)) { | ||
return $result; | ||
} | ||
|
||
$message = 'Cannot create shipment as bundle product "%1" has shipment type "%2". ' . | ||
'%3 should be shipped instead.'; | ||
|
||
if ($item->getHasChildren() && $item->getProductType() === Type::TYPE_BUNDLE) { | ||
$result[] = __( | ||
$message, | ||
$item->getSku(), | ||
__('Separately'), | ||
__('Bundle product options'), | ||
); | ||
} | ||
|
||
if ($item->getParentItem() && $item->getParentItem()->getProductType() === Type::TYPE_BUNDLE) { | ||
$result[] = __( | ||
$message, | ||
$item->getParentItem()->getSku(), | ||
__('Together'), | ||
__('Bundle product itself'), | ||
); | ||
} | ||
|
||
return $result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.