From 67a6891cde97153e34a94a4a9d768a5e17cef022 Mon Sep 17 00:00:00 2001 From: Prestasafe Date: Sun, 8 Nov 2026 09:06:33 +0100 Subject: [PATCH] Disable sorting on PrettyBlocks action columns --- README.md | 13 ++++++++ scripts/test-release.sh | 1 + .../Column/Type/PrettyBlocksButtonColumn.php | 1 + tests/admin-grid-button-test.php | 31 +++++++++++++++++++ 4 files changed, 46 insertions(+) create mode 100644 tests/admin-grid-button-test.php diff --git a/README.md b/README.md index 071fd9fd..f1faa158 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,14 @@ module compilé et n'est pas installable. Vous pouvez également utiliser notre module ClassicBlocks, afin d'avoir 4 blocks à utiliser. Disponible ici: [Télécharger ClassicBlocks](https://github.com/PrestaSafe/classicblocks) +### Liste des pages CMS bloquée par le tri « Ouvrir dans PrettyBlocks » + +Si le back-office affiche `Unknown column 'edit2'` sur la liste des pages, +ouvrez l'URL de cette liste avec le même compte et dans la même boutique. +Ajoutez `cms_page[orderBy]=position&cms_page[sortOrder]=asc` à ses paramètres +(`&` s'il y en a déjà, `?` sinon), en remplaçant les éventuelles valeurs de +tri existantes. PrestaShop mémorise ainsi un tri valide, sans intervention SQL. + ## Validation des pull requests V3 Le [laboratoire de PR](docs/pr-validation.md) automatise la construction du ZIP, @@ -92,6 +100,11 @@ and cannot be installed. You can also add our module ClassicBlocks for having 4 blocks to use [Download ClassicBlocks](https://github.com/PrestaSafe/classicblocks) +If the CMS pages list is already blocked by `Unknown column 'edit2'`, open it +as the affected employee in the affected shop and set the URL parameters +`cms_page[orderBy]=position&cms_page[sortOrder]=asc`. This replaces the saved +sort using PrestaShop's normal grid behavior, without editing the database. + ## Compatible Themes Discover our [PrestaShop SEO / Performance and Mobile Optimized Theme: CartZilla](https://www.prestasafe.com/product/theme-prestashop-cartzilla) compatible PrettyBlocks ! diff --git a/scripts/test-release.sh b/scripts/test-release.sh index 9b844d3c..7e3fe9ee 100755 --- a/scripts/test-release.sh +++ b/scripts/test-release.sh @@ -150,6 +150,7 @@ docker compose "${compose_files[@]}" up \ for service in ps82 ps91; do for fixture_and_target in \ + 'admin-grid-button-test:src/Core/Grid/Column/Type/PrettyBlocksButtonColumn.php' \ 'field-fileupload-test:classes/prettyblocks/core/FieldCore.php' \ 'date-field-test:classes/prettyblocks/core/FieldCore.php' \ 'editor-cache-test:prettyblocks.php'; do diff --git a/src/Core/Grid/Column/Type/PrettyBlocksButtonColumn.php b/src/Core/Grid/Column/Type/PrettyBlocksButtonColumn.php index 7f402b6c..fc4889a5 100644 --- a/src/Core/Grid/Column/Type/PrettyBlocksButtonColumn.php +++ b/src/Core/Grid/Column/Type/PrettyBlocksButtonColumn.php @@ -50,6 +50,7 @@ protected function configureOptions(OptionsResolver $resolver) parent::configureOptions($resolver); $resolver ->setDefaults([ + 'sortable' => false, 'icon' => null, 'route_fragment' => null, 'button_template' => false, diff --git a/tests/admin-grid-button-test.php b/tests/admin-grid-button-test.php new file mode 100644 index 00000000..00f82832 --- /dev/null +++ b/tests/admin-grid-button-test.php @@ -0,0 +1,31 @@ + 'id_cms', 'category' => 'id_category', 'product' => 'id_product'] as $endpoint => $field) { + $column = (new PrettyBlocksButtonColumn('edit2'))->setOptions([ + 'field' => $field, + 'route' => 'admin_prettyblocks', + 'route_param_name' => 'id', + 'route_param_field' => $field, + 'endpoint' => $endpoint, + ]); + $options = $column->getOptions(); + if ($options['sortable'] !== false) { + throw new RuntimeException(sprintf('The %s action column is not a sortable database field.', $endpoint)); + } + if ($options['route'] !== 'admin_prettyblocks' || $options['route_param_field'] !== $field) { + throw new RuntimeException(sprintf('The %s action must still link to PrettyBlocks.', $endpoint)); + } +} + +$title = (new DataColumn('meta_title'))->setOptions(['field' => 'meta_title']); +if ($title->getOptions()['sortable'] !== true) { + throw new RuntimeException('Ordinary data columns must remain sortable.'); +} + +echo "PrettyBlocks grid button options passed.\n";