Frontend
Is Enabled Determiner
Category Navigation
3min
when category navigation ordering & rendering is set the klevu theme is enabled for all categories this behaviour can be amended by injecting custom isenabledconditions into the isenableddeterminer the default behaviour of the determiner for category navigation checks if the store is integrated with klevu if category navigation is enabled if the route is a category if the category is displaying products module m2 frontend categorynavigation/etc/di xml \<type name="klevu\frontendcategorynavigation\service\action\updatecategorypagelayoutaction"> \<arguments> \<argument name="isenabledconditions" xsi\ type="array"> \<item name="klevu integrated" xsi\ type="object">klevu\frontend\service\isenabledcondition\isstoreintegratedcondition\</item> \<item name="klevu catnav enabled" xsi\ type="object">klevu\frontendcategorynavigation\service\isenabledcondition\iscatnavenabledcondition\</item> \<item name="klevu category route" xsi\ type="object">klevu\frontendcategorynavigation\service\isenabledcondition\iscategoryroutecondition\</item> \<item name="klevu category display products" xsi\ type="object">klevu\frontendcategorynavigation\service\isenabledcondition\iscategorydisplayingproductscondition\</item> \</argument> \</arguments> \</type> if all these return true, the category navigation layout handle will be added to the page enable for a subset of categories say we only wanted to enable klevu's category navigation if the category id was odd inject your own isenablecondition module m2 frontend categorynavigation/etc/di xml \<type name="klevu\frontendcategorynavigation\service\action\updatecategorypagelayoutaction"> \<arguments> \<argument name="isenabledconditions" xsi\ type="array"> \<item name="is odd category" xsi\ type="object">vendor\model\service\isenabledcondition\iscategoryoddcondition\</item> \</argument> \</arguments> \</type> create the condition vendor/model/service/isenabledcondition/iscategoryoddcondition php \<?php declare(strict types=1); namespace vendor\module\service\isenabledcondition; use klevu\frontendcategorynavigation\service\isenabledcondition; use klevu\registry\api\categoryregistryinterface; class iscategoryoddcondition implements isenabledconditioninterface { public function construct(categoryregistryinterface $categoryregistry) { $this >categoryregistry = $categoryregistry; } public function execute() bool { $category = $this >categoryregistry >getcurrentcategory(); return $category >getid() & 1; } } see module m2 frontend categorynavigation/service/isenabledcondition for more examples of isenableddeterminer classes