Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
sortByQuantity example
return
;
}
if
(
!
$prices
instanceof ProductPriceCollection
)
{
return
;
}
$prices
=
$this
->
filterRulePrices
(
$prices
,
$context
)
;
if
(
$prices
=== null
)
{
return
;
}
$prices
->
sortByQuantity
(
)
;
$reference
= ReferencePriceDto::
createFromEntity
(
$product
)
;
$calculated
=
new
CalculatedPriceCollection
(
)
;
foreach
(
$prices
as
$price
)
{
$quantity
=
$price
->
getQuantityEnd
(
)
??
$price
->
getQuantityStart
(
)
;
$definition
=
$this
->
buildDefinition
(
$product
,
$price
->
getPrice
(
)
,
$context
,
$units
,
$reference
,
$quantity
)
;
$calculated
->
add
(
$this
->calculator->
calculate
(
$definition
,
$context
)
)
;
}