I have one query regarding category id.I need to include category id, in category list page. Currently it should be like this :
http://magento2.shelltag.com/women/bags/backpacks
I want to show like this :
http://magento2.shelltag.com/women/bags/backpacks-6
How can it be achieved?
is this is the possible solution?
<?php $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $product = $objectManager->get('Magento\Framework\Registry')->registry('current_product'); $categories = $product->getCategoryIds(); /*will return category ids array*/ foreach($categories as $category){ $cat = $objectManager->create('Magento\Catalog\Model\Category')->load($category); echo $cat->getId(); } ?>
or in which file i need to make changes?