Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
allowBuyInListing example
$product
->
addAttribute
(
'marketing',
$this
->marketingService->
getProductAttribute
(
$product
)
)
;
$this
->priceCalculationService->
calculateProduct
(
$product
,
$context
)
;
if
(
!
$this
->
isProductValid
(
$product
,
$context
)
)
{
continue
;
}
$product
->
setListingPrice
(
$product
->
getCheapestUnitPrice
(
)
)
;
$product
->
setDisplayFromPrice
(
\
count
(
$product
->
getPrices
(
)
)
> 1 ||
$product
->
hasDifferentPrices
(
)
)
;
$product
->
setAllowBuyInListing
(
$this
->
allowBuyInListing
(
$product
)
)
;
if
(
$this
->config->
get
(
'calculateCheapestPriceWithMinPurchase'
)
&&
$product
->
getCheapestPrice
(
)
instanceof Price
)
{
$product
->
setListingPrice
(
$product
->
getCheapestPrice
(
)
)
;
}
$result
[
$number
]
=
$product
;
}
return
$result
;
}
/** * Checks if the provided product is allowed to display in the store front for * the provided context. */
'sVariantArticle' => null,
'sConfigurator' =>
$product
->
hasConfigurator
(
)
,
// Only used for full products 'metaTitle' =>
$product
->
getMetaTitle
(
)
,
'shippingfree' =>
$product
->
isShippingFree
(
)
,
'suppliernumber' =>
$product
->
getManufacturerNumber
(
)
,
'notification' =>
$product
->
allowsNotification
(
)
,
'ean' =>
trim
(
(string)
$product
->
getEan
(
)
)
,
'keywords' =>
$product
->
getKeywords
(
)
,
'template' =>
$product
->
getTemplate
(
)
,
'attributes' =>
$product
->
getAttributes
(
)
,
'allowBuyInListing' =>
$product
->
allowBuyInListing
(
)
,
]
;
if
(
$product
->
hasAttribute
(
'core'
)
)
{
$attributes
=
$product
->
getAttribute
(
'core'
)
->
toArray
(
)
;
unset
(
$attributes
[
'id'
]
,
$attributes
[
'articleID'
]
,
$attributes
[
'articledetailsID'
]
)
;
$data
=
array_merge
(
$data
,
$attributes
)
;
}
if
(
$product
->
getManufacturer
(
)
)
{
$manufacturer
=
[