From 154312f1bfc980b896a816593f6a67106206d9c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmlindenhofer=E2=80=9D?= Date: Wed, 4 Oct 2023 09:17:58 +0200 Subject: [PATCH] Remove sort method call with RAW SQL from ProductVariationsExtension.php as it is no longer supported in CMS5. Add sort call to getFormFields-Method in VariationForm.php --- src/Extension/ProductVariationsExtension.php | 4 ++-- src/Forms/VariationForm.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Extension/ProductVariationsExtension.php b/src/Extension/ProductVariationsExtension.php index 3a663b64..90061118 100644 --- a/src/Extension/ProductVariationsExtension.php +++ b/src/Extension/ProductVariationsExtension.php @@ -57,7 +57,7 @@ public function updateCMSFields(FieldList $fields) GridFieldConfig_RecordEditor::create(100) ) ]); - + $variationsGridField->getConfig()->addComponent($sort = new GridFieldOrderableRows('Sort')); if ($this->owner->Variations()->exists()) { @@ -210,7 +210,7 @@ public function possibleValuesForAttributeType($type) '"SilverShop_Variation_AttributeValues"."SilverShop_VariationID" = "SilverShop_Variation"."ID"' )->where( "TypeID = $type AND \"SilverShop_Variation\".\"ProductID\" = " . $this->owner->ID - )->sort('"SilverShop_Variation"."Sort" ASC'); + ); if (!Product::config()->allow_zero_price) { $list = $list->where('"SilverShop_Variation"."Price" > 0'); diff --git a/src/Forms/VariationForm.php b/src/Forms/VariationForm.php index c3079aae..fa30fcdc 100644 --- a/src/Forms/VariationForm.php +++ b/src/Forms/VariationForm.php @@ -130,7 +130,7 @@ protected function getFormFields($controller = null) '', ['attribute' => $attribute->Label] ), - $product->possibleValuesForAttributeType($attribute) + $product->possibleValuesForAttributeType($attribute)->sort('Sort', 'ASC') ); if ($attributeDropdown) {