From 909c005e11875055d30c9c5c20b5b49aea6553ed Mon Sep 17 00:00:00 2001 From: Martina Lindenhofer <68067510+MLindenhofer@users.noreply.github.com> Date: Tue, 21 Mar 2023 10:53:24 +0100 Subject: [PATCH 1/3] Update CartForm.php add $removecount and $updatecount to extension point to make it possible to create session messages in singular form --- src/Forms/CartForm.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Forms/CartForm.php b/src/Forms/CartForm.php index 419d1e680..3a9a4103c 100644 --- a/src/Forms/CartForm.php +++ b/src/Forms/CartForm.php @@ -116,7 +116,7 @@ public function updatecart($data, $form) $form->sessionMessage(implode(' ', $badMessages), 'bad'); } - $this->extend('updateCartFormResponse', $request, $response, $form); + $this->extend('updateCartFormResponse', $request, $response, $form, $removecount, $updatecount); return $response ? $response : $this->controller->redirectBack(); } 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 2/3] 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 3a663b64a..900611187 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 c3079aae7..fa30fcdca 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) { From be3e158127c6edf2c3c91a8b9adb8ec256e5212d Mon Sep 17 00:00:00 2001 From: Martina Lindenhofer <68067510+MLindenhofer@users.noreply.github.com> Date: Wed, 18 Oct 2023 16:14:39 +0200 Subject: [PATCH 3/3] Update VariationForm.php Change notation of sort-params --- src/Forms/VariationForm.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Forms/VariationForm.php b/src/Forms/VariationForm.php index fa30fcdca..969a7215b 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)->sort('Sort', 'ASC') + $product->possibleValuesForAttributeType($attribute)->sort(['Sort' => 'ASC']) ); if ($attributeDropdown) {