Skip to content
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

The selection of a main variant doesn't have any effect #3720

Open
SchlafSchaf opened this issue May 17, 2024 · 1 comment
Open

The selection of a main variant doesn't have any effect #3720

SchlafSchaf opened this issue May 17, 2024 · 1 comment
Labels

Comments

@SchlafSchaf
Copy link

PHP Version

PHP 8.3

Shopware Version

6.6.2.0

Expected behaviour

If i set a main variant in my variant listing configs, it should be preselect on the first load of a product page.

Actual behaviour

It doesn't, because there is a bug in the method checkVariantListingConfig on line 127 and 141 within the Content/Product/SalesChannel/Detail/ProductDetailRoute.php:

$productData = $this->connection->fetchAssociative( SELECT variant_listing_config as variantListingConfig, parent_id as parentId FROM product ...

This query always leeds to a return value null within the following condition on line 141:

if (empty($productData) || empty($productData['parentId']) || $productData['variantListingConfig'] === null) { return null; }

This is because a product can have a database entry in parent_id (x)or in variant_listing_config, but never in both. So the method always return null.

How to reproduce

Try to define a specific variant as main variant in the variant listing config and you will see, that this setting will have no effect. If you request a product page with the parent url, a random variant will be choosen and displayed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant