Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setConfiguratorSettings example
$product
=
$this
->
resolveEntityValue
(
$resolverContext
->
getEntity
(
)
,
$productConfig
->
getStringValue
(
)
)
;
}
if
(
$productConfig
->
isStatic
(
)
)
{
$product
=
$this
->
getSlotProduct
(
$slot
,
$result
,
$productConfig
->
getStringValue
(
)
)
;
}
/** @var SalesChannelProductEntity|null $product */
if
(
$product
!== null
)
{
$buyBox
->
setProduct
(
$product
)
;
$buyBox
->
setProductId
(
$product
->
getId
(
)
)
;
$buyBox
->
setConfiguratorSettings
(
$this
->configuratorLoader->
load
(
$product
,
$resolverContext
->
getSalesChannelContext
(
)
)
)
;
$buyBox
->
setTotalReviews
(
$this
->
getReviewsCount
(
$product
,
$resolverContext
->
getSalesChannelContext
(
)
)
)
;
}
}
private
function
getReviewsCount
(
SalesChannelProductEntity
$product
, SalesChannelContext
$context
)
: int
{
$reviewCriteria
=
$this
->
createReviewCriteria
(
$context
,
$product
->
getParentId
(
)
??
$product
->
getId
(
)
)
;
$aggregation
=
$this
->repository->
aggregate
(
$reviewCriteria
,
$context
->
getContext
(
)
)
->
get
(
'review-count'
)
;
return
$aggregation
instanceof CountResult ?
$aggregation
->
getCount
(
)
: 0;
}
}
if
(
$category
=
$product
->
getSeoCategory
(
)
)
{
$request
->request->
set
(
'navigationId',
$category
->
getId
(
)
)
;
}
$page
=
$this
->genericLoader->
load
(
$request
,
$context
)
;
$page
= ProductPage::
createFrom
(
$page
)
;
$page
->
setProduct
(
$product
)
;
$page
->
setConfiguratorSettings
(
$result
->
getConfigurator
(
)
??
new
PropertyGroupCollection
(
)
)
;
$page
->
setNavigationId
(
$product
->
getId
(
)
)
;
if
(
!Feature::
isActive
(
'v6.6.0.0'
)
)
{
$this
->
loadDefaultAdditions
(
$product
,
$page
,
$request
,
$context
)
;
}
elseif
(
$cmsPage
=
$product
->
getCmsPage
(
)
)
{
$page
->
setCmsPage
(
$cmsPage
)
;
}
$this
->
loadOptions
(
$page
)
;
$this
->
loadMetaData
(
$page
)
;