Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
isRulesFilterValid example
$priceDefinition
=
$discount
->
getPriceDefinition
(
)
;
$newPackages
=
[
]
;
foreach
(
$packages
as
$package
)
{
$foundItems
=
[
]
;
foreach
(
$package
->
getMetaData
(
)
as
$item
)
{
$lineItem
=
$package
->
getCartItem
(
$item
->
getLineItemId
(
)
)
;
if
(
$this
->
isRulesFilterValid
(
$lineItem
,
$priceDefinition
,
$context
)
)
{
$item
=
new
LineItemQuantity
(
$lineItem
->
getId
(
)
,
$lineItem
->
getQuantity
(
)
)
;
$foundItems
[
]
=
$item
;
}
}
if
(
\
count
(
$foundItems
)
> 0
)
{
$newPackages
[
]
=
new
DiscountPackage
(
new
LineItemQuantityCollection
(
$foundItems
)
)
;
}