Get Category Product relation table name dynamically Magento 2.

You can get the category product table name dynamically using Magento 2 Catalog module.

catalog_category_product table used for category-product relation.

The table contains entity_id, category_id, product_id and position field to manage relationships with products. Continue reading “Get Category Product relation table name dynamically Magento 2.”

Get Category ids from the product Magento 2.

You can get the product category ids from the product id using Magento 2.

You can retrieve all the category ids assigned for products at any place, using the below code snippet.
Continue reading “Get Category ids from the product Magento 2.”

How to create category attribute dropdown with Cms Block list programmatically in magento 2?

Magento 2, You can create a custom category attribute with a list of CMS Block in the dropdown field.

The module is simply residing in the app/code folder of Magento instance.

For example, We kept Package name as Rbj and Module name as CategoryAttribute.
You can keep any name for Packagename/Module name. In our demo, we have kept Packagename_Modulename as Rbj_CategoryAttribute. Continue reading “How to create category attribute dropdown with Cms Block list programmatically in magento 2?”