Skip to content

Module Integrations

How Magento_Catalog integrates with EAV, Inventory, Search, Quote, Sales, CMS, and exposes data via GraphQL and REST APIs.

EAV Framework Integration

Magento_Catalog is tightly coupled with Magento_Eav. Products and Categories are EAV entities, meaning their attributes are stored dynamically in separate tables based on data type.

Integration Points

  • Entity Types: catalog_product, catalog_category
  • Attribute Backend: Custom backends for images, prices, tier prices
  • Attribute Frontend: Custom frontends for display formatting
  • Attribute Source: Custom sources for dropdowns (status, visibility)
// EAV Entity Type Registration
eav_entity_type
├── entity_type_code: catalog_product
├── entity_model: Magento\Catalog\Model\ResourceModel\Product
├── attribute_model: Magento\Catalog\Model\ResourceModel\Eav\Attribute
└── entity_table: catalog_product_entity

// Attribute Tables
catalog_product_entity_varchar (name, url_key, meta_title)
catalog_product_entity_int (status, visibility)
catalog_product_entity_decimal (price, weight)
catalog_product_entity_datetime (special_from_date)
catalog_product_entity_text (description)

Key Classes

  • Magento\Catalog\Model\ResourceModel\Product - EAV resource model
  • Magento\Catalog\Model\ResourceModel\Eav\Attribute - Catalog attribute model
  • Magento\Catalog\Setup\Patch\Data\* - Attribute creation patches

Inventory (MSI) Integration

Catalog integrates with both legacy CatalogInventory and modern Multi-Source Inventory (MSI) for stock management.

Legacy CatalogInventory

  • Stock Item: qty, is_in_stock, min_qty, backorders
  • Stock Status: Real-time salability check
  • Extension Attributes: stock_item on ProductInterface
// Load stock via extension
$product->getExtensionAttributes()
    ->getStockItem()
    ->getQty();

Multi-Source Inventory (MSI)

  • Sources: Multiple stock locations
  • Stocks: Aggregated view per sales channel
  • Reservations: Pending quantity deductions
// Check salability via MSI
$isSalable = $productSalability
    ->isSalable($sku, $stockId);

Critical: Product Save Stock Race Condition

When saving products via API, stock data may not be properly processed if not included in extension attributes. Always explicitly set stock_item extension attribute when saving via ProductRepository.

Search Integration

Magento_Catalog provides the foundation for product search, which is extended by CatalogSearch and search engine adapters (Elasticsearch, OpenSearch).

Search Indexer Flow

  1. Product save triggers catalogsearch_fulltext indexer
  2. Indexer reads searchable attributes from EAV
  3. Data pushed to Elasticsearch/OpenSearch index
  4. Frontend queries search engine, gets product IDs
  5. Product collection loads matching products

Searchable Attributes

Attributes with is_searchable = 1:

  • - name, sku, description, short_description
  • - Custom attributes marked searchable

Filterable Attributes

For layered navigation:

  • - is_filterable = 1 (category page)
  • - is_filterable_in_search = 1 (search)

Quote & Sales Integration

Catalog products are added to quotes (carts) and converted to order items during checkout.

Quote Integration

  • Add to Cart: ProductInterface → QuoteItem
  • Price Calculation: Uses Catalog pricing rules
  • Options: Custom options attached to quote item
  • Stock Reservation: MSI creates reservation

Sales Integration

  • Order Item: QuoteItem → OrderItem
  • Product Snapshot: Name, SKU, price frozen at order time
  • Inventory Deduction: Stock deducted on shipment
// Add product to cart
$quoteRepository->getActiveForCustomer($customerId);
$quote->addProduct($product, $request);
$quoteRepository->save($quote);

// Quote item stores product reference
$item->getProductId();      // catalog_product_entity.entity_id
$item->getSku();            // Frozen at add-to-cart time
$item->getProduct();        // Loads current product data

CMS Integration

Catalog depends on CMS for widgets and category landing pages.

Category CMS Block

Categories can display CMS blocks:

  • - landing_page attribute
  • - Static block rendered above/below products
  • - Design settings from category attributes

Product Widgets

Catalog provides CMS widgets:

  • - Catalog Product Link
  • - Catalog Product List
  • - Catalog New Products List
  • - Recently Viewed Products

REST & GraphQL APIs

Magento_Catalog exposes comprehensive REST and GraphQL endpoints for headless commerce.

REST API Endpoints

Method Endpoint Description
GET /V1/products/{sku} Get product by SKU
POST /V1/products Create product
PUT /V1/products/{sku} Update product
GET /V1/categories/{id} Get category
GET /V1/products/attributes List attributes

GraphQL Queries

query GetProduct($sku: String!) {
  products(filter: { sku: { eq: $sku } }) {
    items {
      id
      sku
      name
      price_range {
        minimum_price {
          final_price { value currency }
        }
      }
      media_gallery {
        url
        label
      }
      ... on ConfigurableProduct {
        variants {
          product { sku }
          attributes { code label value_index }
        }
      }
    }
  }
}

query GetCategories {
  categories(filters: { parent_id: { eq: "2" } }) {
    items {
      id
      name
      url_path
      children {
        id
        name
      }
    }
  }
}

API Authentication

REST requires OAuth tokens or Integration tokens. GraphQL supports anonymous (limited) and customer token authentication. Admin operations require admin token with appropriate ACL resources.