Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
fixQuantity example
if
(
$available
<
$minPurchase
)
{
$scope
->
remove
(
$item
->
getId
(
)
)
;
$cart
->
addErrors
(
new
ProductOutOfStockError
(
(string)
$item
->
getReferencedId
(
)
,
(string)
$item
->
getLabel
(
)
)
)
;
return
;
}
if
(
$available
<
$item
->
getQuantity
(
)
)
{
$maxAvailable
=
$this
->
fixQuantity
(
$minPurchase
,
$available
,
$steps
)
;
$item
->
setQuantity
(
$maxAvailable
)
;
$cart
->
addErrors
(
new
ProductStockReachedError
(
(string)
$item
->
getReferencedId
(
)
,
(string)
$item
->
getLabel
(
)
,
$maxAvailable
)
)
;
return
;
}
if
(
$item
->
getQuantity
(
)
<
$minPurchase
)
{