Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getDiscountType example
$this
->calculator =
$calculator
;
}
/** * {@inheritdoc} */
public
function
addProportionalDiscount
(
DiscountContext
$discountContext
)
{
$prices
=
$this
->
getPositionPrices
(
$discountContext
)
;
$hasMultipleTaxes
=
$this
->calculator->
hasDifferentTaxes
(
$prices
)
;
if
(
$discountContext
->
getDiscountType
(
)
=== self::DISCOUNT_ABSOLUTE
)
{
$discounts
=
$this
->calculator->
calculate
(
$discountContext
->
getDiscountValue
(
)
,
$prices
,
$discountContext
->
isNetPrice
(
)
)
;
}
else
{
$discounts
=
$this
->calculator->
recalculatePercentageDiscount
(
$discountContext
->
getDiscountValue
(
)
,
$prices
,
$discountContext
->
isNetPrice
(
)
)
;
}