質問

How can I get the product category's URL Key?

I can get the category name by $category->getName() but it does not work if I use this $category->getURLKey(),

$categories = $_product->getCategoryCollection()
    ->addAttributeToSelect('name');

foreach($categories as $category) {
    $productCategoryName = $category->getName();
    var_dump($category->getURLKey());
}

Return null

Any ideas?

正しい解決策はありません

ライセンス: CC-BY-SA帰属
所属していません magento.stackexchange
scroll top