Ecommerce framework - Unpublished products listed

I’m running the Pimcore 6.1.2 platform with advanced demo, and working on a simple project to learn pimcore structure.

I created new products and unpublished all demo products in admin and but I still get them listed in the frontend in main products category (however trying to open them returns an error). Am I missing something? I’m searching on web and found this should be the key:

AbstractObject::setHideUnpublished(true);

I set this in: vendor/pimcore/pimcore/bundles/EcommerceFrameworkBundle/IndexService/ProductList/DefaultMysql.php

but nothing seems to happen.

Can anyone help me please?

Unpublished objects are not listed by default
If you want to list them:
$list = \Pimcore\Model\DataObject\MyClass::getList([“unpublished” => true]);
Make sure you use your class instead of \Pimcore\Model\DataObject\Product class if you dont want them listed

1 Like

Hi,
AbstractObject::setHideUnpublished(true); has no influence to what elements are in index and what not.

Please have a look at our new demo. There everything should work as expected.
Here is the place that decides what elements are in index and which not.

BR
Christian

1 Like