Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getTechnicalNameOfOrderNumber example
private
function
loadBasketPlugins
(
BasketStruct
$basket
, array
$positions
)
: void
{
$context
=
new
PluginsByTechnicalNameRequest
(
$this
->
getLocale
(
)
,
$this
->
getVersion
(
)
,
array_column
(
$positions
, 'technicalName'
)
)
;
$plugins
=
$this
->
get
(
PluginStoreService::
class
)
->
getPlugins
(
$context
)
;
foreach
(
$basket
->
getPositions
(
)
as
$position
)
{
$name
=
$this
->
getTechnicalNameOfOrderNumber
(
$position
->
getOrderNumber
(
)
,
$positions
)
;
if
(
$name
=== null
)
{
continue
;
}
$key
=
strtolower
(
$name
)
;
$position
->
setPlugin
(
$plugins
[
$key
]
)
;
}
}
/** * @param array<array> $positions */