Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setStock example
$product
->
setMetaTitle
(
$data
[
'__product_metaTitle'
]
)
;
$product
->
setHasProperties
(
$data
[
'__product_filtergroupID'
]
> 0
)
;
$product
->
setHighlight
(
(bool)
$data
[
'__product_topseller'
]
)
;
$product
->
setAllowsNotification
(
(bool)
$data
[
'__product_notification'
]
)
;
$product
->
setKeywords
(
$data
[
'__product_keywords'
]
)
;
$product
->
setTemplate
(
$data
[
'__product_template'
]
)
;
$product
->
setHasConfigurator
(
$data
[
'__product_configurator_set_id'
]
> 0
)
;
$product
->
setHasEsd
(
(bool)
$data
[
'__product_has_esd'
]
)
;
$product
->
setIsPriceGroupActive
(
(bool)
$data
[
'__product_pricegroupActive'
]
)
;
$product
->
setSales
(
(int)
$data
[
'__topSeller_sales'
]
)
;
$product
->
setShippingFree
(
(bool)
$data
[
'__variant_shippingfree'
]
)
;
$product
->
setStock
(
(int)
$data
[
'__variant_instock'
]
)
;
$product
->
setManufacturerNumber
(
$data
[
'__variant_suppliernumber'
]
)
;
$product
->
setMainVariantId
(
(int)
$data
[
'__product_main_detail_id'
]
)
;
if
(
$data
[
'__variant_shippingtime'
]
)
{
$product
->
setShippingTime
(
$data
[
'__variant_shippingtime'
]
)
;
}
elseif
(
$data
[
'__product_shippingtime'
]
)
{
$product
->
setShippingTime
(
$data
[
'__product_shippingtime'
]
)
;
}
if
(
$data
[
'__variant_releasedate'
]
)
{
$product
->
setReleaseDate
(
$product
->
setAdditional
(
$listProduct
->
getAdditional
(
)
)
;
$product
->
setCloseouts
(
$listProduct
->
isCloseouts
(
)
)
;
$product
->
setEan
(
$listProduct
->
getEan
(
)
)
;
$product
->
setHeight
(
$listProduct
->
getHeight
(
)
)
;
$product
->
setKeywords
(
$listProduct
->
getKeywords
(
)
)
;
$product
->
setLength
(
$listProduct
->
getLength
(
)
)
;
$product
->
setLongDescription
(
$listProduct
->
getLongDescription
(
)
)
;
$product
->
setMinStock
(
$listProduct
->
getMinStock
(
)
)
;
$product
->
setReleaseDate
(
$listProduct
->
getReleaseDate
(
)
)
;
$product
->
setShippingTime
(
$listProduct
->
getShippingTime
(
)
)
;
$product
->
setShortDescription
(
$listProduct
->
getShortDescription
(
)
)
;
$product
->
setStock
(
$listProduct
->
getStock
(
)
)
;
$product
->
setWeight
(
$listProduct
->
getWeight
(
)
)
;
$product
->
setWidth
(
$listProduct
->
getWidth
(
)
)
;
$product
->
setPriceGroup
(
$listProduct
->
getPriceGroup
(
)
)
;
$product
->
setCreatedAt
(
$listProduct
->
getCreatedAt
(
)
)
;
$product
->
setUpdatedAt
(
$listProduct
->
getUpdatedAt
(
)
)
;
$product
->
setPriceRules
(
$listProduct
->
getPriceRules
(
)
)
;
$product
->
setCheapestPriceRule
(
$listProduct
->
getCheapestPriceRule
(
)
)
;
$product
->
setManufacturerNumber
(
$listProduct
->
getManufacturerNumber
(
)
)
;
$product
->
setMetaTitle
(
$listProduct
->
getMetaTitle
(
)
)
;
$product
->
setTemplate
(
$listProduct
->
getTemplate
(
)
)
;
$product
->
setHasConfigurator
(
$listProduct
->
hasConfigurator
(
)
)
;
class
ProductProxyTest
extends
TestCase
{
public
function
testProxyPropertyAccess
(
)
: void
{
$product
=
new
SalesChannelProductEntity
(
)
;
$product
->
setName
(
'foo'
)
;
$product
->
setStock
(
10
)
;
$product
->
setCalculatedPrice
(
new
CalculatedPrice
(
10, 10,
new
CalculatedTaxCollection
(
)
,
new
TaxRuleCollection
(
)
)
)
;
$product
->
setCalculatedCheapestPrice
(
new
CalculatedCheapestPrice
(
8, 8,
new
CalculatedTaxCollection
(
)
,
new
TaxRuleCollection
(
)
)
)
;
$product
->
setCalculatedPrices
(
new
PriceCollection
(
[
new
CalculatedPrice
(
9, 9,
new
CalculatedTaxCollection
(
)
,
new
TaxRuleCollection
(
)
)
,
]
)
)
;