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