Skip to content

fix product export of configurable_variations for configurable products with multiple super attributes #142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 2.4-develop
Choose a base branch
from

Conversation

rhoerr
Copy link
Contributor

@rhoerr rhoerr commented May 8, 2025

Description (*)

Default export functionality outputs invalid data for configurable products having more than one super attribute.

Column configurable_variations should contain all child SKUs, with the unique super attribute values of each one.
Instead, it outputs only the first SKU matched for each super attribute value.

Invalid, with attributes color and size: Note that most SKUs do not include both size and color. Only one row is output for each size and each color. (I put each SKU on a new line for clarity.)

sku=ABC-BM,color=Black,size=Medium|
sku=ABC-RM,color=Red|
sku=ABC-NM,color=Navy|
sku=ABC-BS,size=Small|
sku=ABC-BL,size=Large|
sku=ABC-BXL,size=XLarge|
sku=ABC-BXXL,size=XXLarge

Corrected: All child SKUs are output, with all super attribute values for each.

sku=ABC-RS,color=Red,size=Small|
sku=ABC-RM,color=Red,size=Medium|
sku=ABC-RL,color=Red,size=Large|
sku=ABC-RXL,color=Red,size=XLarge|
sku=ABC-RXXL,color=Red,size=XXLarge|
sku=ABC-NS,color=Navy,size=Small|
sku=ABC-NM,color=Navy,size=Medium|
sku=ABC-NL,color=Navy,size=Large|
sku=ABC-NXL,color=Navy,size=XLarge|
sku=ABC-NXXL,color=Navy,size=XXLarge|
sku=ABC-BS,color=Black,size=Small|
sku=ABC-BM,color=Black,size=Medium|
sku=ABC-BL,color=Black,size=Large|
sku=ABC-BXL,color=Black,size=XLarge|
sku=ABC-BXXL,color=Black,size=XXLarge

The issue was the core code iterating over super attributes and options (one match for each separate value), not over the combinations of super attributes and options (one match for each combination of values). I changed the loop to iterate over assigned child products and then output each super attribute in order, for each one.

Related Pull Requests

N/A

Fixed Issues (if relevant)

  1. No related issues that I've seen

Manual testing scenarios (*)

  1. Have a product with two or more configurable attributes.
  2. Export that product.
  3. Examine the export configurable_variations to confirm whether all child products and options are represented.

Questions or comments

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • All automated tests passed successfully (all builds are green)

@rhoerr rhoerr requested a review from a team as a code owner May 8, 2025 20:30
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.

1 participant