- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2016
05:32 PM
02-18-2016
05:32 PM
$_product->getUrlKey() returns empty
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
Labels:
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2016
08:25 PM
02-19-2016
08:25 PM
Re: $_product->getUrlKey() returns empty
Why do not you just use $_product->getUrlKey() instead of your 2 lines of code?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2016
01:35 AM
12-08-2016
01:35 AM
Re: $_product->getUrlKey() returns empty
getUrlKey does not seem to work. Any other ideas?