Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getCalculatedRegulationPrice example
$data
=
$this
->
convertPriceStruct
(
$price
)
;
$data
[
'pseudopricePercent'
]
= null;
$data
[
'price'
]
=
$this
->
formatPrice
(
$price
->
getCalculatedPrice
(
)
)
;
$data
[
'pseudoprice'
]
=
$this
->
formatPrice
(
$price
->
getCalculatedPseudoPrice
(
)
)
;
$data
[
'referenceprice'
]
=
$this
->
formatPrice
(
$price
->
getCalculatedReferencePrice
(
)
)
;
$data
[
'has_pseudoprice'
]
=
$price
->
getCalculatedPseudoPrice
(
)
>
$price
->
getCalculatedPrice
(
)
;
$data
[
'price_numeric'
]
=
$price
->
getCalculatedPrice
(
)
;
$data
[
'pseudoprice_numeric'
]
=
$price
->
getCalculatedPseudoPrice
(
)
;
$data
[
'price_attributes'
]
=
$price
->
getAttributes
(
)
;
$data
[
'pricegroup'
]
=
$price
->
getCustomerGroup
(
)
->
getKey
(
)
;
$data
[
'regulationPrice'
]
=
$price
->
getCalculatedRegulationPrice
(
)
;
if
(
$price
->
getCalculatedPseudoPrice
(
)
)
{
$discount
= 0;
if
(
$price
->
getCalculatedPseudoPrice
(
)
!= 0
)
{
$discount
=
round
(
(
$price
->
getCalculatedPrice
(
)
/
$price
->
getCalculatedPseudoPrice
(
)
* 100
)
- 100, 2
)
* -1;
}
$data
[
'pseudopricePercent'
]
=
[
'int' =>
round
(
$discount
)
,
'float' =>
$discount
,
]
;
}