Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getReferencePriceDefinition example
$config
)
;
$tax
->
setTax
(
$total
)
;
$tax
->
setPrice
(
$tax
->
getPrice
(
)
*
$definition
->
getQuantity
(
)
)
;
}
$price
=
$this
->
round
(
$unitPrice
*
$definition
->
getQuantity
(
)
,
$config
)
;
$reference
=
$this
->
calculateReferencePrice
(
$unitPrice
,
$definition
->
getReferencePriceDefinition
(
)
,
$config
)
;
return
new
CalculatedPrice
(
$unitPrice
,
$price
,
$calculatedTaxes
,
$taxRules
,
$definition
->
getQuantity
(
)
,
$reference
,
$this
->
calculateListPrice
(
$unitPrice
,
$definition
,
$config
)
,
$this
->
calculateRegulationPrice
(
$definition
,
$config
)
)
;
}
$tax
->
setTax
(
$total
)
;
$tax
->
setPrice
(
$tax
->
getPrice
(
)
*
$definition
->
getQuantity
(
)
)
;
}
$price
=
$this
->priceRounding->
cashRound
(
$unitPrice
*
$definition
->
getQuantity
(
)
,
$config
)
;
$reference
=
$this
->
calculateReferencePrice
(
$unitPrice
,
$definition
->
getReferencePriceDefinition
(
)
,
$config
)
;
return
new
CalculatedPrice
(
$unitPrice
,
$price
,
$unitTaxes
,
$definition
->
getTaxRules
(
)
,
$definition
->
getQuantity
(
)
,
$reference
,
$this
->
calculateListPrice
(
$unitPrice
,
$definition
,
$config
)
,
$this
->
calculateRegulationPrice
(
$definition
,
$config
)
)
;
}
]
)
;
$cart
=
$this
->
getProductCart
(
)
;
$lineItem
=
$cart
->
get
(
$this
->ids->
get
(
'product'
)
)
;
static
::
assertInstanceOf
(
LineItem::
class
,
$lineItem
)
;
static
::
assertInstanceOf
(
QuantityPriceDefinition::
class
,
$lineItem
->
getPriceDefinition
(
)
)
;
/** @var QuantityPriceDefinition $priceDefinition */
$priceDefinition
=
$lineItem
->
getPriceDefinition
(
)
;
static
::
assertNull
(
$priceDefinition
->
getReferencePriceDefinition
(
)
)
;
static
::
assertInstanceOf
(
CalculatedPrice::
class
,
$lineItem
->
getPrice
(
)
)
;
static
::
assertNull
(
$lineItem
->
getPrice
(
)
->
getReferencePrice
(
)
)
;
}
/** * @dataProvider advancedPricingProvider */
public
function
testAdvancedPricing
(
bool
$valid
, float
$price
)
: void
{
$ids
=
new
IdsCollection
(
)
;