Skip to content

Conversation

@codegen-sh
Copy link
Contributor

@codegen-sh codegen-sh bot commented Jul 17, 2025

Summary

This PR implements a new configuration option to prevent importing disabled parent products and their children into Clerk, addressing the issue described in FED-1338.

Problem

Currently, when a product is disabled in Magento 2, it still gets imported into Clerk if:

  • The visibility is set to "Catalog & Search"
  • The extension is configured to import saleable products with "Catalog & Search" visibility

For example, a disabled configurable product (like product 70051) and its child products would still be imported even though the parent was disabled.

Solution

New Configuration Option

  • Added exclude_disabled_products configuration option in the Product Synchronization section
  • Default value is enabled (1) to provide the expected behavior out of the box
  • Includes helpful description: "When enabled, disabled parent products and their children will not be imported to Clerk"

Implementation Details

  • Direct filtering: Products with status = disabled are filtered out using addAttributeToFilter
  • Configurable products: Child products of disabled configurable parents are excluded
  • Grouped products: Associated products of disabled grouped parents are excluded
  • Proper logging: Added logging to track how many products are being excluded
  • Error handling: Comprehensive error handling with detailed logging

Files Modified

  • Model/Config.php - Added new configuration constant
  • etc/adminhtml/system.xml - Added configuration field in admin panel
  • etc/config.xml - Set default value to enabled
  • Controller/Getconfig/Index.php - Exposed configuration to frontend
  • Model/Adapter/Product.php - Implemented filtering logic

Testing

The implementation:

  1. Checks if the configuration is enabled before applying filters
  2. Filters out disabled products directly using the status attribute
  3. Identifies disabled configurable/grouped products and excludes their children/associated products
  4. Provides detailed logging for monitoring and debugging
  5. Handles errors gracefully without breaking the import process

Backward Compatibility

This change is backward compatible:

  • The feature is enabled by default but can be disabled via configuration
  • Existing functionality remains unchanged when the option is disabled
  • No breaking changes to existing APIs or data structures

Fixes FED-1338


💻 View my work • 👤 Initiated by @CasperKNAbout Codegen

…r children

- Add new configuration option 'exclude_disabled_products' to prevent importing disabled parent products and their children
- Update system.xml to include the new configuration field with proper description
- Set default value to enabled (1) in config.xml
- Add configuration to getconfig endpoint for frontend access
- Implement filterDisabledProducts method in Product adapter to:
  - Filter out disabled products directly using status attribute
  - Exclude child products of disabled configurable products
  - Exclude associated products of disabled grouped products
- Add proper error handling and logging for the filtering process

Fixes FED-1338: Prevent importing disabled parent products and their children in Clerk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants