Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getUnitName example
return
null;
}
$price
=
$price
/
$definition
->
getPurchaseUnit
(
)
*
$definition
->
getReferenceUnit
(
)
;
$price
=
$this
->priceRounding->
mathRound
(
$price
,
$config
)
;
return
new
ReferencePrice
(
$price
,
$definition
->
getPurchaseUnit
(
)
,
$definition
->
getReferenceUnit
(
)
,
$definition
->
getUnitName
(
)
)
;
}
private
function
round
(
float
$price
, CashRoundingConfig
$config
)
: float
{
if
(
$config
->
roundForNet
(
)
)
{
return
$this
->priceRounding->
cashRound
(
$price
,
$config
)
;
}
return
$this
->priceRounding->
mathRound
(
$price
,
$config
)
;
}
}
$definition
=
new
QuantityPriceDefinition
(
$price
->
getUnitPrice
(
)
,
$price
->
getTaxRules
(
)
,
$quantity
)
;
if
(
$price
->
getListPrice
(
)
!== null
)
{
$definition
->
setListPrice
(
$price
->
getListPrice
(
)
->
getPrice
(
)
)
;
}
if
(
$price
->
getReferencePrice
(
)
!== null
)
{
$definition
->
setReferencePriceDefinition
(
new
ReferencePriceDefinition
(
$price
->
getReferencePrice
(
)
->
getPurchaseUnit
(
)
,
$price
->
getReferencePrice
(
)
->
getReferenceUnit
(
)
,
$price
->
getReferencePrice
(
)
->
getUnitName
(
)
)
)
;
}
return
$definition
;
}
/** * @param LineItem[] $lineItems * * @return mixed[] */
return
null;
}
$price
=
$price
/
$definition
->
getPurchaseUnit
(
)
*
$definition
->
getReferenceUnit
(
)
;
$price
=
$this
->priceRounding->
mathRound
(
$price
,
$config
)
;
return
new
ReferencePrice
(
$price
,
$definition
->
getPurchaseUnit
(
)
,
$definition
->
getReferenceUnit
(
)
,
$definition
->
getUnitName
(
)
)
;
}
}