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

Variations: Problem with Fluent #774

Open
MLindenhofer opened this issue Dec 7, 2021 · 1 comment
Open

Variations: Problem with Fluent #774

MLindenhofer opened this issue Dec 7, 2021 · 1 comment

Comments

@MLindenhofer
Copy link
Contributor

Hi,
After extending ProductVariations, Attributes and Attribute_Types with Fluent the Catalog throws an error and also creating a new variation at a ProductPage stops working.

Is there a way to fix to it?

extensions.yml:

SilverShop\Model\Variation\Variation:
  extensions:
    - TractorCow\Fluent\Extension\FluentVersionedExtension

SilverShop\Model\Variation\AttributeValue:
  extensions:
   - TractorCow\Fluent\Extension\FluentExtension

SilverShop\Model\Variation\AttributeType:
  extensions:
    - TractorCow\Fluent\Extension\FluentExtension

ERROR from ProductCatalogAdmin:

[Emergency] Uncaught SilverStripe\ORM\Connect\DatabaseException: Couldn't run query: SELECT DISTINCT "SilverShop_Variation"."ClassName", "SilverShop_Variation"."LastEdited", "SilverShop_Variation"."Created", "SilverShop_Variation"."Version", "SilverShop_Variation"."Sort", CASE WHEN "SilverShop_Variation_Localised_de_DE"."ID" IS NOT NULL THEN "SilverShop_Variation_Localised_de_DE"."InternalItemID" ELSE "SilverShop_Variation"."InternalItemID" END AS "InternalItemID", "SilverShop_Variation"."Price", "SilverShop_Variation"."Weight", "SilverShop_Variation"."Height", "SilverShop_Variation"."Width", "SilverShop_Variation"."Depth", "SilverShop_Variation"."ProductID", "SilverShop_Variation"."ImageID", "SilverShop_Variation"."ID", CASE WHEN "SilverShop_Variation"."ClassName" IS NOT NULL THEN "SilverShop_Variation"."ClassName" ELSE 'SilverShop\\Model\\Variation\\Variation' END AS "RecordClassName", 'de_DE' AS "Locale", CASE WHEN "SilverShop_Variation_Localised_de_DE"."ID" IS NOT NULL THEN 'de_DE' ELSE NULL END AS "SourceLocale" FROM "SilverShop_Variation" LEFT JOIN "SilverShop_Variation_Localised" AS "SilverShop_Variation_Localised_de_DE" ON "SilverShop_Variation"."ID" = "SilverShop_Variation_Localised_de_DE"."RecordID" AND "SilverShop_Variation_Localised_de_DE"."Locale" = ? WHERE ("SilverShop_Variation"."ProductID" = ?) ORDER BY "SilverShop_Variation"."InternalItemID" ASC LIMIT 1 HY000-3065: Expression #1 of ORDER BY clause is not in SELECT list, references column 'cromab2bdb.SilverShop_Variation.InternalItemID' which is not in SELECT list; this is incompatible with DISTINCT
GET /admin/catalog/
Line 64 in /var/www/html/vendor/silverstripe/framework/src/ORM/Connect/DBConnector.php
@adiwidjaja
Copy link

For reference: Found this when searching for the same problem. This query can be fixed by configuring sql_mode

SilverStripe\ORM\Connect\MySQLDatabase:
  sql_mode: ANSI_QUOTES

But in my case I just needed to translate AttributeType and AttributeValue, which didn't need this fix.

See also: tractorcow-farm/silverstripe-fluent#257

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

No branches or pull requests

2 participants