Hello,
I need to get url_key attribute of a product, but I cannot.
I am calling this:
<?php $_helper = $this->helper('Magento\Catalog\Helper\Output'); $key = $_helper->productAttribute($_product, $_product->getUrlKey(), 'url_key') ?>
$product is an element of $_productCollection = $block->getLoadedProductCollection();
However, $key get empty. Of course, url key was entered in backend and I do see it in database also.
Any help will be appreciated.
Thanks
Jaime
Why do not you just use $_product->getUrlKey() instead of your 2 lines of code?
getUrlKey does not seem to work. Any other ideas?