The selector field type only accepts a string (e.g. 'Product', 'Category').
AdminThemeManagerController::getCollectionAction() then creates a raw PrestaShopCollection:
$psCollection = new PrestaShopCollection($collection, $id_lang);
No extra filter is applied, so inactive / offline products appear in the dropdown.
On production sites this often leads to blocks displaying unavailable products.
Current behaviour
'product' => [
'type' => 'selector',
'collection' => 'Product',
'selector' => '{id} - {name}',
],
Typing any query shows both active and inactive products.
Expected / requested behaviour
- Either: built-in filter so only active products are returned (
active = 1).
- Or: accept custom conditions, e.g.
'options' => [
'where' => 'active = 1 AND visibility IN ("both","catalog")'
]
Thanks for considering!
The
selectorfield type only accepts a string (e.g.'Product','Category').AdminThemeManagerController::getCollectionAction()then creates a rawPrestaShopCollection:No extra filter is applied, so inactive / offline products appear in the dropdown.
On production sites this often leads to blocks displaying unavailable products.
Current behaviour
Typing any query shows both active and inactive products.
Expected / requested behaviour
active = 1).Thanks for considering!