Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
missingDefaultPriceCollectionForSurcharge example
$value
= FloatComparator::
cast
(
(float)
$value
)
;
return
new
PercentagePriceDefinition
(
abs
(
$value
)
)
;
}
if
(
$type
!== AbsolutePriceDefinition::TYPE
)
{
throw
CartException::
surchargeTypeNotSupported
(
$key
,
$type
)
;
}
if
(
!
$value
instanceof PriceCollection
)
{
throw
CartException::
absoluteSurchargeMissingPriceCollection
(
$key
)
;
}
if
(
!
$value
->
has
(
Defaults::CURRENCY
)
)
{
throw
CartException::
missingDefaultPriceCollectionForSurcharge
(
$key
)
;
}
foreach
(
$value
as
$price
)
{
$price
->
setGross
(
\
abs
(
$price
->
getGross
(
)
)
)
;
$price
->
setNet
(
\
abs
(
$price
->
getNet
(
)
)
)
;
if
(
!
$price
->
getListPrice
(
)
)
{
continue
;
}
$price
->
getListPrice
(
)
->
setGross
(
\
abs
(
$price
->
getListPrice
(
)
->
getGross
(
)
)
)
;
$price
->
getListPrice
(
)
->
setNet
(
\
abs
(
$price
->
getListPrice
(
)
->
getNet
(
)
)
)
;
}