Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setBasketId example
$discountBaseName
=
$discountContext
->
getDiscountName
(
)
;
/** @var Price $discount */
foreach
(
$discounts
as
$discount
)
{
$discountContext
->
setPrice
(
$discount
)
;
$discountContext
->
setDiscountName
(
$discountBaseName
.
(
$hasMultipleTaxes
? ' (' .
$discount
->
getTaxRate
(
)
. '%)' : ''
)
)
;
$query
=
$this
->basketQueryHelper->
getInsertDiscountQuery
(
$discountContext
)
;
$query
->
execute
(
)
;
$discountContext
->
setBasketId
(
$this
->basketQueryHelper->
getLastInsertId
(
)
)
;
$query
=
$this
->basketQueryHelper->
getInsertDiscountAttributeQuery
(
$discountContext
)
;
$query
->
execute
(
)
;
}
}
/** * {@inheritdoc} */
public
function
getPositionPrices
(
DiscountContext
$discountContext
)
{