pixelopen / magento-product-main-category

此包的最新版本(100.1.1)没有可用的许可信息。

该模块为产品添加了主分类属性

100.1.1 2024-04-19 08:15 UTC

This package is auto-updated.

Last update: 2024-09-19 09:15:01 UTC


README

Minimum PHP Version Minimum Magento Version GitHub release

演示

该模块为产品添加了主分类属性。

Product Main Category

要求

  • Magento >= 2.4.4
  • PHP >= 8.0.0

安装

composer require pixelopen/magento-product-main-category

检索产品主分类值

$mainCategory = $product->getMainCategory();

// OR

$mainCategory = $product->getData('main_category');

// OR

$mainCategory = $product->getCustomAttribute('main_category')?->getValue();