Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setCalculatedRegulationPrice example
// Calculates the normal price of the struct.
$price
->
setCalculatedPrice
(
$this
->priceCalculatorService->
calculatePrice
(
$rule
->
getPrice
(
)
,
$tax
,
$context
)
)
;
// Check if a pseudo price is defined and calculates it too.
$price
->
setCalculatedPseudoPrice
(
$this
->priceCalculatorService->
calculatePrice
(
$rule
->
getPseudoPrice
(
)
,
$tax
,
$context
)
)
;
if
(
$rule
->
getRegulationPrice
(
)
)
{
$price
->
setCalculatedRegulationPrice
(
$this
->priceCalculatorService->
calculatePrice
(
$rule
->
getRegulationPrice
(
)
,
$tax
,
$context
)
)
;
}
// Check if the product has unit definitions and calculate the reference price for the unit.
if
(
$price
->
getUnit
(
)
instanceof Unit &&
$price
->
getUnit
(
)
->
getPurchaseUnit
(
)
)
{
$price
->
setCalculatedReferencePrice
(
$this
->
calculateReferencePrice
(
$price
)
)
;
}
return
$price
;
}