Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getGroupDefinition example
$resultGroups
=
$this
->groupBuilder->
findGroupPackages
(
$groupDefinitions
,
$cart
,
$context
)
;
$maximumSetCount
=
$resultGroups
->
getLowestCommonGroupCountDenominator
(
$groupDefinitions
)
;
if
(
$maximumSetCount
<= 0
)
{
return
new
DiscountPackageCollection
(
)
;
}
/** @var string $groupId */
$groupId
=
$discount
->
getPayloadValue
(
'groupId'
)
;
$definition
=
$this
->
getGroupDefinition
(
$groupId
,
$groups
)
;
$result
=
$this
->groupBuilder->
findGroupPackages
(
[
$definition
]
,
$cart
,
$context
)
;
$units
=
[
]
;
$addedGroupCount
= 0;
foreach
(
$result
->
getGroupResult
(
$definition
)
as
$group
)
{
$singleItems
=
$this
->
splitQuantities
(
$group
->
getItems
(
)
)
;
$units
[
]
=
new
DiscountPackage
(
new
LineItemQuantityCollection
(
$singleItems
)
)
;