0

In feed generation I try get full category path.

Our category tree. Example:

Women

-Shoes

== Sneakers

We assign products directly to a child category == Sneakers

During feed generation in category section we see only child category <cat>Sneakers</cat>

How to get full category? <cat>Women/Shoes/Sneakers</cat>

I try use dynamic variable but still I get only child category.

$categoryPath = [];
$collection = $product->getCategoryCollection();
foreach ($collection as $category) {
    $cat = $objectManager->create('Magento\Catalog\Model\Category')->load($category->getEntityId());
    $categoryPath[] = $cat->getName();
}

if (is_array($categoryPath)) {
    return implode(' > ', $categoryPath);
}

https://prnt.sc/rtg72d

| improve this question | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.