Hello everyone, I am working on Magento Cloud v2.3.2-p2 and we are needing to add a background filter to our category listing pages. I have done this before or feel like I have but everything I have tried is giving me grief besides using ObjectManager which I don’t want to use.
I am working on this locally and have made it work with the code below but essential the goal is to get the category_id for the current page that I am on.. when that page is a Category Listing page.
public function getCurrentCategory() { $objectManager = MagentoFrameworkAppObjectManager::getInstance(); $category = $objectManager->get('MagentoFrameworkRegistry')->registry('current_category'); $catID = $category->getId(); return $catID; }
Any suggestions are welcomed and appreciated.
submitted by /u/bradclampitt
[link] [comments]