From 394fdff94bbfc8bee7b183c96ba1b32296b6a9f1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Sep 2023 09:44:18 +0000 Subject: [PATCH 01/19] Bump @babel/cli from 7.22.10 to 7.22.15 Bumps [@babel/cli](https://github.com/babel/babel/tree/HEAD/packages/babel-cli) from 7.22.10 to 7.22.15. - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.22.15/packages/babel-cli) --- updated-dependencies: - dependency-name: "@babel/cli" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index e0699108c..84a83daad 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "lodash.escaperegexp": "^4.1.2" }, "devDependencies": { - "@babel/cli": "^7.22.10", + "@babel/cli": "^7.22.15", "@babel/core": "^7.22.20", "@babel/eslint-parser": "^7.22.11", "@babel/node": "^7.22.10", @@ -85,9 +85,9 @@ } }, "node_modules/@babel/cli": { - "version": "7.22.10", - "resolved": "https://registry.npmjs.org/@babel/cli/-/cli-7.22.10.tgz", - "integrity": "sha512-rM9ZMmaII630zGvtMtQ3P4GyHs28CHLYE9apLG7L8TgaSqcfoIGrlLSLsh4Q8kDTdZQQEXZm1M0nQtOvU/2heg==", + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/cli/-/cli-7.22.15.tgz", + "integrity": "sha512-prtg5f6zCERIaECeTZzd2fMtVjlfjhUcO+fBLQ6DXXdq5FljN+excVitJ2nogsusdf31LeqkjAfXZ7Xq+HmN8g==", "dev": true, "dependencies": { "@jridgewell/trace-mapping": "^0.3.17", @@ -9792,9 +9792,9 @@ } }, "@babel/cli": { - "version": "7.22.10", - "resolved": "https://registry.npmjs.org/@babel/cli/-/cli-7.22.10.tgz", - "integrity": "sha512-rM9ZMmaII630zGvtMtQ3P4GyHs28CHLYE9apLG7L8TgaSqcfoIGrlLSLsh4Q8kDTdZQQEXZm1M0nQtOvU/2heg==", + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/cli/-/cli-7.22.15.tgz", + "integrity": "sha512-prtg5f6zCERIaECeTZzd2fMtVjlfjhUcO+fBLQ6DXXdq5FljN+excVitJ2nogsusdf31LeqkjAfXZ7Xq+HmN8g==", "dev": true, "requires": { "@jridgewell/trace-mapping": "^0.3.17", diff --git a/package.json b/package.json index ac2349434..d3976ba44 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "homepage": "https://github.com/PrestaShop/ps_facetedsearch#readme", "devDependencies": { "@babel/eslint-parser": "^7.22.11", - "@babel/cli": "^7.22.10", + "@babel/cli": "^7.22.15", "@babel/core": "^7.22.20", "@babel/node": "^7.22.10", "@babel/preset-env": "^7.22.20", From d93666ffb5419c61505191eff8f878af6208a153 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Sep 2023 09:44:35 +0000 Subject: [PATCH 02/19] Bump eslint from 8.48.0 to 8.49.0 Bumps [eslint](https://github.com/eslint/eslint) from 8.48.0 to 8.49.0. - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v8.48.0...v8.49.0) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 46 +++++++++++++++++++++++----------------------- package.json | 2 +- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/package-lock.json b/package-lock.json index e0699108c..ba488496c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,7 +22,7 @@ "chai": "^4.3.8", "clean-webpack-plugin": "^4.0.0", "css-loader": "^6.8.1", - "eslint": "^8.48.0", + "eslint": "^8.49.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prestashop": "^0.2.1", "eslint-plugin-import": "^2.28.1", @@ -2109,9 +2109,9 @@ "dev": true }, "node_modules/@eslint/js": { - "version": "8.48.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.48.0.tgz", - "integrity": "sha512-ZSjtmelB7IJfWD2Fvb7+Z+ChTIKWq6kjda95fLcQKNS5aheVHn4IkfgRQE3sIIzTcSLwLcLZUD9UBt+V7+h+Pw==", + "version": "8.49.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.49.0.tgz", + "integrity": "sha512-1S8uAY/MTJqVx0SC4epBq+N2yhuwtNwLbJYNZyhL2pO1ZVKn5HFXav5T41Ryzy9K9V7ZId2JB2oy/W4aCd9/2w==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -2124,9 +2124,9 @@ "dev": true }, "node_modules/@humanwhocodes/config-array": { - "version": "0.11.10", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.10.tgz", - "integrity": "sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ==", + "version": "0.11.11", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.11.tgz", + "integrity": "sha512-N2brEuAadi0CcdeMXUkhbZB84eskAc8MEX1By6qEchoVywSgXPIjou4rYsl0V3Hj0ZnuGycGCjdNgockbzeWNA==", "dev": true, "dependencies": { "@humanwhocodes/object-schema": "^1.2.1", @@ -4233,16 +4233,16 @@ } }, "node_modules/eslint": { - "version": "8.48.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.48.0.tgz", - "integrity": "sha512-sb6DLeIuRXxeM1YljSe1KEx9/YYeZFQWcV8Rq9HfigmdDEugjLEVEa1ozDjL6YDjBpQHPJxJzze+alxi4T3OLg==", + "version": "8.49.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.49.0.tgz", + "integrity": "sha512-jw03ENfm6VJI0jA9U+8H5zfl5b+FvuU3YYvZRdZHOlU2ggJkxrlkJH4HcDrZpj6YwD8kuYqvQM8LyesoazrSOQ==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", "@eslint/eslintrc": "^2.1.2", - "@eslint/js": "8.48.0", - "@humanwhocodes/config-array": "^0.11.10", + "@eslint/js": "8.49.0", + "@humanwhocodes/config-array": "^0.11.11", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", "ajv": "^6.12.4", @@ -11197,9 +11197,9 @@ } }, "@eslint/js": { - "version": "8.48.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.48.0.tgz", - "integrity": "sha512-ZSjtmelB7IJfWD2Fvb7+Z+ChTIKWq6kjda95fLcQKNS5aheVHn4IkfgRQE3sIIzTcSLwLcLZUD9UBt+V7+h+Pw==", + "version": "8.49.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.49.0.tgz", + "integrity": "sha512-1S8uAY/MTJqVx0SC4epBq+N2yhuwtNwLbJYNZyhL2pO1ZVKn5HFXav5T41Ryzy9K9V7ZId2JB2oy/W4aCd9/2w==", "dev": true }, "@gar/promisify": { @@ -11209,9 +11209,9 @@ "dev": true }, "@humanwhocodes/config-array": { - "version": "0.11.10", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.10.tgz", - "integrity": "sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ==", + "version": "0.11.11", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.11.tgz", + "integrity": "sha512-N2brEuAadi0CcdeMXUkhbZB84eskAc8MEX1By6qEchoVywSgXPIjou4rYsl0V3Hj0ZnuGycGCjdNgockbzeWNA==", "dev": true, "requires": { "@humanwhocodes/object-schema": "^1.2.1", @@ -12834,16 +12834,16 @@ "dev": true }, "eslint": { - "version": "8.48.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.48.0.tgz", - "integrity": "sha512-sb6DLeIuRXxeM1YljSe1KEx9/YYeZFQWcV8Rq9HfigmdDEugjLEVEa1ozDjL6YDjBpQHPJxJzze+alxi4T3OLg==", + "version": "8.49.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.49.0.tgz", + "integrity": "sha512-jw03ENfm6VJI0jA9U+8H5zfl5b+FvuU3YYvZRdZHOlU2ggJkxrlkJH4HcDrZpj6YwD8kuYqvQM8LyesoazrSOQ==", "dev": true, "requires": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", "@eslint/eslintrc": "^2.1.2", - "@eslint/js": "8.48.0", - "@humanwhocodes/config-array": "^0.11.10", + "@eslint/js": "8.49.0", + "@humanwhocodes/config-array": "^0.11.11", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", "ajv": "^6.12.4", diff --git a/package.json b/package.json index ac2349434..1c2c6a48a 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "chai": "^4.3.8", "clean-webpack-plugin": "^4.0.0", "css-loader": "^6.8.1", - "eslint": "^8.48.0", + "eslint": "^8.49.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prestashop": "^0.2.1", "eslint-plugin-import": "^2.28.1", From 76fbb86da3474bdcd2ea1b051b0a9f5a7ba1e236 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Sep 2023 09:44:48 +0000 Subject: [PATCH 03/19] Bump @babel/register from 7.22.5 to 7.22.15 Bumps [@babel/register](https://github.com/babel/babel/tree/HEAD/packages/babel-register) from 7.22.5 to 7.22.15. - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.22.15/packages/babel-register) --- updated-dependencies: - dependency-name: "@babel/register" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index e0699108c..8a8b575a1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,7 @@ "@babel/eslint-parser": "^7.22.11", "@babel/node": "^7.22.10", "@babel/preset-env": "^7.22.20", - "@babel/register": "^7.22.5", + "@babel/register": "^7.22.15", "babel-loader": "^9.1.3", "chai": "^4.3.8", "clean-webpack-plugin": "^4.0.0", @@ -1894,9 +1894,9 @@ } }, "node_modules/@babel/register": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/register/-/register-7.22.5.tgz", - "integrity": "sha512-vV6pm/4CijSQ8Y47RH5SopXzursN35RQINfGJkmOlcpAtGuf94miFvIPhCKGQN7WGIcsgG1BHEX2KVdTYwTwUQ==", + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/register/-/register-7.22.15.tgz", + "integrity": "sha512-V3Q3EqoQdn65RCgTLwauZaTfd1ShhwPmbBv+1dkZV/HpCGMKVyn6oFcRlI7RaKqiDQjX2Qd3AuoEguBgdjIKlg==", "dev": true, "dependencies": { "clone-deep": "^4.0.1", @@ -11039,9 +11039,9 @@ } }, "@babel/register": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/register/-/register-7.22.5.tgz", - "integrity": "sha512-vV6pm/4CijSQ8Y47RH5SopXzursN35RQINfGJkmOlcpAtGuf94miFvIPhCKGQN7WGIcsgG1BHEX2KVdTYwTwUQ==", + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/register/-/register-7.22.15.tgz", + "integrity": "sha512-V3Q3EqoQdn65RCgTLwauZaTfd1ShhwPmbBv+1dkZV/HpCGMKVyn6oFcRlI7RaKqiDQjX2Qd3AuoEguBgdjIKlg==", "dev": true, "requires": { "clone-deep": "^4.0.1", diff --git a/package.json b/package.json index ac2349434..8ce58f561 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "@babel/core": "^7.22.20", "@babel/node": "^7.22.10", "@babel/preset-env": "^7.22.20", - "@babel/register": "^7.22.5", + "@babel/register": "^7.22.15", "babel-loader": "^9.1.3", "chai": "^4.3.8", "clean-webpack-plugin": "^4.0.0", From 16965947640b74f6243f214bd44ef48b900352a2 Mon Sep 17 00:00:00 2001 From: Benjamin Date: Wed, 20 Sep 2023 10:06:56 +0200 Subject: [PATCH 04/19] Add sorting by reference --- src/Product/SearchProvider.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Product/SearchProvider.php b/src/Product/SearchProvider.php index d07108d74..642aa08f6 100644 --- a/src/Product/SearchProvider.php +++ b/src/Product/SearchProvider.php @@ -97,6 +97,8 @@ private function getAvailableSortOrders($query) $sortPriceDesc = new SortOrder('product', 'price', 'desc'); $sortDateAsc = new SortOrder('product', 'date_add', 'asc'); $sortDateDesc = new SortOrder('product', 'date_add', 'desc'); + $sortRefAsc = new SortOrder('product', 'reference', 'asc'); + $sortRefDesc = new SortOrder('product', 'reference', 'desc'); $translator = $this->module->getTranslator(); $sortOrders = [ @@ -118,6 +120,12 @@ private function getAvailableSortOrders($query) $sortPriceDesc->setLabel( $translator->trans('Price, high to low', [], 'Shop.Theme.Catalog') ), + $sortRefAsc->setLabel( + $translator->trans('Reference, A to Z', [], 'Shop.Theme.Catalog') + ), + $sortRefDesc->setLabel( + $translator->trans('Reference, Z to A', [], 'Shop.Theme.Catalog') + ), ]; if ($query->getQueryType() == 'new-products') { From 569a72e692d4e222da16e377b9b082986e7fc1ae Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Sep 2023 12:29:32 +0000 Subject: [PATCH 05/19] Bump @babel/eslint-parser from 7.22.11 to 7.22.15 Bumps [@babel/eslint-parser](https://github.com/babel/babel/tree/HEAD/eslint/babel-eslint-parser) from 7.22.11 to 7.22.15. - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.22.15/eslint/babel-eslint-parser) --- updated-dependencies: - dependency-name: "@babel/eslint-parser" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 415f4ee83..c2926c985 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,7 @@ "devDependencies": { "@babel/cli": "^7.22.15", "@babel/core": "^7.22.20", - "@babel/eslint-parser": "^7.22.11", + "@babel/eslint-parser": "^7.22.15", "@babel/node": "^7.22.10", "@babel/preset-env": "^7.22.20", "@babel/register": "^7.22.15", @@ -242,9 +242,9 @@ } }, "node_modules/@babel/eslint-parser": { - "version": "7.22.11", - "resolved": "https://registry.npmjs.org/@babel/eslint-parser/-/eslint-parser-7.22.11.tgz", - "integrity": "sha512-YjOYZ3j7TjV8OhLW6NCtyg8G04uStATEUe5eiLuCZaXz2VSDQ3dsAtm2D+TuQyAqNMUK2WacGo0/uma9Pein1w==", + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/eslint-parser/-/eslint-parser-7.22.15.tgz", + "integrity": "sha512-yc8OOBIQk1EcRrpizuARSQS0TWAcOMpEJ1aafhNznaeYkeL+OhqnDObGFylB8ka8VFF/sZc+S4RzHyO+3LjQxg==", "dev": true, "dependencies": { "@nicolo-ribaudo/eslint-scope-5-internals": "5.1.1-v1", @@ -9902,9 +9902,9 @@ } }, "@babel/eslint-parser": { - "version": "7.22.11", - "resolved": "https://registry.npmjs.org/@babel/eslint-parser/-/eslint-parser-7.22.11.tgz", - "integrity": "sha512-YjOYZ3j7TjV8OhLW6NCtyg8G04uStATEUe5eiLuCZaXz2VSDQ3dsAtm2D+TuQyAqNMUK2WacGo0/uma9Pein1w==", + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/eslint-parser/-/eslint-parser-7.22.15.tgz", + "integrity": "sha512-yc8OOBIQk1EcRrpizuARSQS0TWAcOMpEJ1aafhNznaeYkeL+OhqnDObGFylB8ka8VFF/sZc+S4RzHyO+3LjQxg==", "dev": true, "requires": { "@nicolo-ribaudo/eslint-scope-5-internals": "5.1.1-v1", diff --git a/package.json b/package.json index 2cd0a39cf..e014cd917 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ }, "homepage": "https://github.com/PrestaShop/ps_facetedsearch#readme", "devDependencies": { - "@babel/eslint-parser": "^7.22.11", + "@babel/eslint-parser": "^7.22.15", "@babel/cli": "^7.22.15", "@babel/core": "^7.22.20", "@babel/node": "^7.22.10", From 94d808551238b96d6e4c4f63ebff44c5ba786b56 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Sep 2023 12:37:50 +0000 Subject: [PATCH 06/19] Bump eslint from 8.49.0 to 8.50.0 Bumps [eslint](https://github.com/eslint/eslint) from 8.49.0 to 8.50.0. - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v8.49.0...v8.50.0) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 30 +++++++++++++++--------------- package.json | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/package-lock.json b/package-lock.json index c2926c985..f3b4d6530 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,7 +22,7 @@ "chai": "^4.3.8", "clean-webpack-plugin": "^4.0.0", "css-loader": "^6.8.1", - "eslint": "^8.49.0", + "eslint": "^8.50.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prestashop": "^0.2.1", "eslint-plugin-import": "^2.28.1", @@ -2109,9 +2109,9 @@ "dev": true }, "node_modules/@eslint/js": { - "version": "8.49.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.49.0.tgz", - "integrity": "sha512-1S8uAY/MTJqVx0SC4epBq+N2yhuwtNwLbJYNZyhL2pO1ZVKn5HFXav5T41Ryzy9K9V7ZId2JB2oy/W4aCd9/2w==", + "version": "8.50.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.50.0.tgz", + "integrity": "sha512-NCC3zz2+nvYd+Ckfh87rA47zfu2QsQpvc6k1yzTk+b9KzRj0wkGa8LSoGOXN6Zv4lRf/EIoZ80biDh9HOI+RNQ==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -4233,15 +4233,15 @@ } }, "node_modules/eslint": { - "version": "8.49.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.49.0.tgz", - "integrity": "sha512-jw03ENfm6VJI0jA9U+8H5zfl5b+FvuU3YYvZRdZHOlU2ggJkxrlkJH4HcDrZpj6YwD8kuYqvQM8LyesoazrSOQ==", + "version": "8.50.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.50.0.tgz", + "integrity": "sha512-FOnOGSuFuFLv/Sa+FDVRZl4GGVAAFFi8LecRsI5a1tMO5HIE8nCm4ivAlzt4dT3ol/PaaGC0rJEEXQmHJBGoOg==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", "@eslint/eslintrc": "^2.1.2", - "@eslint/js": "8.49.0", + "@eslint/js": "8.50.0", "@humanwhocodes/config-array": "^0.11.11", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", @@ -11197,9 +11197,9 @@ } }, "@eslint/js": { - "version": "8.49.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.49.0.tgz", - "integrity": "sha512-1S8uAY/MTJqVx0SC4epBq+N2yhuwtNwLbJYNZyhL2pO1ZVKn5HFXav5T41Ryzy9K9V7ZId2JB2oy/W4aCd9/2w==", + "version": "8.50.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.50.0.tgz", + "integrity": "sha512-NCC3zz2+nvYd+Ckfh87rA47zfu2QsQpvc6k1yzTk+b9KzRj0wkGa8LSoGOXN6Zv4lRf/EIoZ80biDh9HOI+RNQ==", "dev": true }, "@gar/promisify": { @@ -12834,15 +12834,15 @@ "dev": true }, "eslint": { - "version": "8.49.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.49.0.tgz", - "integrity": "sha512-jw03ENfm6VJI0jA9U+8H5zfl5b+FvuU3YYvZRdZHOlU2ggJkxrlkJH4HcDrZpj6YwD8kuYqvQM8LyesoazrSOQ==", + "version": "8.50.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.50.0.tgz", + "integrity": "sha512-FOnOGSuFuFLv/Sa+FDVRZl4GGVAAFFi8LecRsI5a1tMO5HIE8nCm4ivAlzt4dT3ol/PaaGC0rJEEXQmHJBGoOg==", "dev": true, "requires": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", "@eslint/eslintrc": "^2.1.2", - "@eslint/js": "8.49.0", + "@eslint/js": "8.50.0", "@humanwhocodes/config-array": "^0.11.11", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", diff --git a/package.json b/package.json index e014cd917..a59f9b170 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "chai": "^4.3.8", "clean-webpack-plugin": "^4.0.0", "css-loader": "^6.8.1", - "eslint": "^8.49.0", + "eslint": "^8.50.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prestashop": "^0.2.1", "eslint-plugin-import": "^2.28.1", From 9dc59e38e9f46a39a7c86e6798e09137bd19c23c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 26 Sep 2023 04:35:11 +0000 Subject: [PATCH 07/19] Bump @babel/core from 7.22.20 to 7.23.0 Bumps [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) from 7.22.20 to 7.23.0. - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.23.0/packages/babel-core) --- updated-dependencies: - dependency-name: "@babel/core" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 178 +++++++++++++++++++++++++--------------------- package.json | 2 +- 2 files changed, 96 insertions(+), 84 deletions(-) diff --git a/package-lock.json b/package-lock.json index c2926c985..423822765 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ }, "devDependencies": { "@babel/cli": "^7.22.15", - "@babel/core": "^7.22.20", + "@babel/core": "^7.23.0", "@babel/eslint-parser": "^7.22.15", "@babel/node": "^7.22.10", "@babel/preset-env": "^7.22.20", @@ -168,22 +168,22 @@ } }, "node_modules/@babel/core": { - "version": "7.22.20", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.22.20.tgz", - "integrity": "sha512-Y6jd1ahLubuYweD/zJH+vvOY141v4f9igNQAQ+MBgq9JlHS2iTsZKn1aMsb3vGccZsXI16VzTBw52Xx0DWmtnA==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.23.0.tgz", + "integrity": "sha512-97z/ju/Jy1rZmDxybphrBuI+jtJjFVoz7Mr9yUQVVVi+DNZE333uFQeMOqcCIy1x3WYBIbWftUSLmbNXNT7qFQ==", "dev": true, "dependencies": { "@ampproject/remapping": "^2.2.0", "@babel/code-frame": "^7.22.13", - "@babel/generator": "^7.22.15", + "@babel/generator": "^7.23.0", "@babel/helper-compilation-targets": "^7.22.15", - "@babel/helper-module-transforms": "^7.22.20", - "@babel/helpers": "^7.22.15", - "@babel/parser": "^7.22.16", + "@babel/helper-module-transforms": "^7.23.0", + "@babel/helpers": "^7.23.0", + "@babel/parser": "^7.23.0", "@babel/template": "^7.22.15", - "@babel/traverse": "^7.22.20", - "@babel/types": "^7.22.19", - "convert-source-map": "^1.7.0", + "@babel/traverse": "^7.23.0", + "@babel/types": "^7.23.0", + "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", "json5": "^2.2.3", @@ -197,6 +197,12 @@ "url": "https://opencollective.com/babel" } }, + "node_modules/@babel/core/node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true + }, "node_modules/@babel/core/node_modules/debug": { "version": "4.3.2", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", @@ -278,12 +284,12 @@ } }, "node_modules/@babel/generator": { - "version": "7.22.15", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.22.15.tgz", - "integrity": "sha512-Zu9oWARBqeVOW0dZOjXc3JObrzuqothQ3y/n1kUtrjCoCPLkXUwMvOo/F/TCfoHMbWIFlWwpZtkZVb9ga4U2pA==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.0.tgz", + "integrity": "sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g==", "dev": true, "dependencies": { - "@babel/types": "^7.22.15", + "@babel/types": "^7.23.0", "@jridgewell/gen-mapping": "^0.3.2", "@jridgewell/trace-mapping": "^0.3.17", "jsesc": "^2.5.1" @@ -463,13 +469,13 @@ } }, "node_modules/@babel/helper-function-name": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.22.5.tgz", - "integrity": "sha512-wtHSq6jMRE3uF2otvfuD3DIvVhOsSNshQl0Qrd7qC9oQJzHvOL4qQXlQn2916+CXGywIjpGuIkoyZRRxHPiNQQ==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz", + "integrity": "sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==", "dev": true, "dependencies": { - "@babel/template": "^7.22.5", - "@babel/types": "^7.22.5" + "@babel/template": "^7.22.15", + "@babel/types": "^7.23.0" }, "engines": { "node": ">=6.9.0" @@ -512,9 +518,9 @@ } }, "node_modules/@babel/helper-module-transforms": { - "version": "7.22.20", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.22.20.tgz", - "integrity": "sha512-dLT7JVWIUUxKOs1UnJUBR3S70YK+pKX6AbJgB2vMIvEkZkrfJDbYDJesnPshtKV4LhDOR3Oc5YULeDizRek+5A==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.23.0.tgz", + "integrity": "sha512-WhDWw1tdrlT0gMgUJSlX0IQvoO1eN279zrAUbVB+KpV2c3Tylz8+GnKOLllCS6Z/iZQEyVYxhZVUdPTqs2YYPw==", "dev": true, "dependencies": { "@babel/helper-environment-visitor": "^7.22.20", @@ -663,14 +669,14 @@ } }, "node_modules/@babel/helpers": { - "version": "7.22.15", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.22.15.tgz", - "integrity": "sha512-7pAjK0aSdxOwR+CcYAqgWOGy5dcfvzsTIfFTb2odQqW47MDfv14UaJDY6eng8ylM2EaeKXdxaSWESbkmaQHTmw==", + "version": "7.23.1", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.23.1.tgz", + "integrity": "sha512-chNpneuK18yW5Oxsr+t553UZzzAs3aZnFm4bxhebsNTeshrC95yA7l5yl7GBAG+JG1rF0F7zzD2EixK9mWSDoA==", "dev": true, "dependencies": { "@babel/template": "^7.22.15", - "@babel/traverse": "^7.22.15", - "@babel/types": "^7.22.15" + "@babel/traverse": "^7.23.0", + "@babel/types": "^7.23.0" }, "engines": { "node": ">=6.9.0" @@ -714,9 +720,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.22.16", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.22.16.tgz", - "integrity": "sha512-+gPfKv8UWeKKeJTUxe59+OobVcrYHETCsORl61EmSkmgymguYk/X5bp7GuUIXaFsc6y++v8ZxPsLSSuujqDphA==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.0.tgz", + "integrity": "sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw==", "dev": true, "bin": { "parser": "bin/babel-parser.js" @@ -1945,19 +1951,19 @@ } }, "node_modules/@babel/traverse": { - "version": "7.22.20", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.22.20.tgz", - "integrity": "sha512-eU260mPZbU7mZ0N+X10pxXhQFMGTeLb9eFS0mxehS8HZp9o1uSnFeWQuG1UPrlxgA7QoUzFhOnilHDp0AXCyHw==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.0.tgz", + "integrity": "sha512-t/QaEvyIoIkwzpiZ7aoSKK8kObQYeF7T2v+dazAYCb8SXtp58zEVkWW7zAnju8FNKNdr4ScAOEDmMItbyOmEYw==", "dev": true, "dependencies": { "@babel/code-frame": "^7.22.13", - "@babel/generator": "^7.22.15", + "@babel/generator": "^7.23.0", "@babel/helper-environment-visitor": "^7.22.20", - "@babel/helper-function-name": "^7.22.5", + "@babel/helper-function-name": "^7.23.0", "@babel/helper-hoist-variables": "^7.22.5", "@babel/helper-split-export-declaration": "^7.22.6", - "@babel/parser": "^7.22.16", - "@babel/types": "^7.22.19", + "@babel/parser": "^7.23.0", + "@babel/types": "^7.23.0", "debug": "^4.1.0", "globals": "^11.1.0" }, @@ -1989,13 +1995,13 @@ "dev": true }, "node_modules/@babel/types": { - "version": "7.22.19", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.22.19.tgz", - "integrity": "sha512-P7LAw/LbojPzkgp5oznjE6tQEIWbp4PkkfrZDINTro9zgBRtI324/EYsiSI7lhPbpIQ+DCeR2NNmMWANGGfZsg==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz", + "integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==", "dev": true, "dependencies": { "@babel/helper-string-parser": "^7.22.5", - "@babel/helper-validator-identifier": "^7.22.19", + "@babel/helper-validator-identifier": "^7.22.20", "to-fast-properties": "^2.0.0" }, "engines": { @@ -9850,28 +9856,34 @@ "dev": true }, "@babel/core": { - "version": "7.22.20", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.22.20.tgz", - "integrity": "sha512-Y6jd1ahLubuYweD/zJH+vvOY141v4f9igNQAQ+MBgq9JlHS2iTsZKn1aMsb3vGccZsXI16VzTBw52Xx0DWmtnA==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.23.0.tgz", + "integrity": "sha512-97z/ju/Jy1rZmDxybphrBuI+jtJjFVoz7Mr9yUQVVVi+DNZE333uFQeMOqcCIy1x3WYBIbWftUSLmbNXNT7qFQ==", "dev": true, "requires": { "@ampproject/remapping": "^2.2.0", "@babel/code-frame": "^7.22.13", - "@babel/generator": "^7.22.15", + "@babel/generator": "^7.23.0", "@babel/helper-compilation-targets": "^7.22.15", - "@babel/helper-module-transforms": "^7.22.20", - "@babel/helpers": "^7.22.15", - "@babel/parser": "^7.22.16", + "@babel/helper-module-transforms": "^7.23.0", + "@babel/helpers": "^7.23.0", + "@babel/parser": "^7.23.0", "@babel/template": "^7.22.15", - "@babel/traverse": "^7.22.20", - "@babel/types": "^7.22.19", - "convert-source-map": "^1.7.0", + "@babel/traverse": "^7.23.0", + "@babel/types": "^7.23.0", + "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", "json5": "^2.2.3", "semver": "^6.3.1" }, "dependencies": { + "convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true + }, "debug": { "version": "4.3.2", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", @@ -9927,12 +9939,12 @@ } }, "@babel/generator": { - "version": "7.22.15", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.22.15.tgz", - "integrity": "sha512-Zu9oWARBqeVOW0dZOjXc3JObrzuqothQ3y/n1kUtrjCoCPLkXUwMvOo/F/TCfoHMbWIFlWwpZtkZVb9ga4U2pA==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.0.tgz", + "integrity": "sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g==", "dev": true, "requires": { - "@babel/types": "^7.22.15", + "@babel/types": "^7.23.0", "@jridgewell/gen-mapping": "^0.3.2", "@jridgewell/trace-mapping": "^0.3.17", "jsesc": "^2.5.1" @@ -10073,13 +10085,13 @@ "dev": true }, "@babel/helper-function-name": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.22.5.tgz", - "integrity": "sha512-wtHSq6jMRE3uF2otvfuD3DIvVhOsSNshQl0Qrd7qC9oQJzHvOL4qQXlQn2916+CXGywIjpGuIkoyZRRxHPiNQQ==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz", + "integrity": "sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==", "dev": true, "requires": { - "@babel/template": "^7.22.5", - "@babel/types": "^7.22.5" + "@babel/template": "^7.22.15", + "@babel/types": "^7.23.0" } }, "@babel/helper-hoist-variables": { @@ -10110,9 +10122,9 @@ } }, "@babel/helper-module-transforms": { - "version": "7.22.20", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.22.20.tgz", - "integrity": "sha512-dLT7JVWIUUxKOs1UnJUBR3S70YK+pKX6AbJgB2vMIvEkZkrfJDbYDJesnPshtKV4LhDOR3Oc5YULeDizRek+5A==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.23.0.tgz", + "integrity": "sha512-WhDWw1tdrlT0gMgUJSlX0IQvoO1eN279zrAUbVB+KpV2c3Tylz8+GnKOLllCS6Z/iZQEyVYxhZVUdPTqs2YYPw==", "dev": true, "requires": { "@babel/helper-environment-visitor": "^7.22.20", @@ -10216,14 +10228,14 @@ } }, "@babel/helpers": { - "version": "7.22.15", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.22.15.tgz", - "integrity": "sha512-7pAjK0aSdxOwR+CcYAqgWOGy5dcfvzsTIfFTb2odQqW47MDfv14UaJDY6eng8ylM2EaeKXdxaSWESbkmaQHTmw==", + "version": "7.23.1", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.23.1.tgz", + "integrity": "sha512-chNpneuK18yW5Oxsr+t553UZzzAs3aZnFm4bxhebsNTeshrC95yA7l5yl7GBAG+JG1rF0F7zzD2EixK9mWSDoA==", "dev": true, "requires": { "@babel/template": "^7.22.15", - "@babel/traverse": "^7.22.15", - "@babel/types": "^7.22.15" + "@babel/traverse": "^7.23.0", + "@babel/types": "^7.23.0" } }, "@babel/highlight": { @@ -10252,9 +10264,9 @@ } }, "@babel/parser": { - "version": "7.22.16", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.22.16.tgz", - "integrity": "sha512-+gPfKv8UWeKKeJTUxe59+OobVcrYHETCsORl61EmSkmgymguYk/X5bp7GuUIXaFsc6y++v8ZxPsLSSuujqDphA==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.0.tgz", + "integrity": "sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw==", "dev": true }, "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { @@ -11078,19 +11090,19 @@ } }, "@babel/traverse": { - "version": "7.22.20", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.22.20.tgz", - "integrity": "sha512-eU260mPZbU7mZ0N+X10pxXhQFMGTeLb9eFS0mxehS8HZp9o1uSnFeWQuG1UPrlxgA7QoUzFhOnilHDp0AXCyHw==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.0.tgz", + "integrity": "sha512-t/QaEvyIoIkwzpiZ7aoSKK8kObQYeF7T2v+dazAYCb8SXtp58zEVkWW7zAnju8FNKNdr4ScAOEDmMItbyOmEYw==", "dev": true, "requires": { "@babel/code-frame": "^7.22.13", - "@babel/generator": "^7.22.15", + "@babel/generator": "^7.23.0", "@babel/helper-environment-visitor": "^7.22.20", - "@babel/helper-function-name": "^7.22.5", + "@babel/helper-function-name": "^7.23.0", "@babel/helper-hoist-variables": "^7.22.5", "@babel/helper-split-export-declaration": "^7.22.6", - "@babel/parser": "^7.22.16", - "@babel/types": "^7.22.19", + "@babel/parser": "^7.23.0", + "@babel/types": "^7.23.0", "debug": "^4.1.0", "globals": "^11.1.0" }, @@ -11113,13 +11125,13 @@ } }, "@babel/types": { - "version": "7.22.19", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.22.19.tgz", - "integrity": "sha512-P7LAw/LbojPzkgp5oznjE6tQEIWbp4PkkfrZDINTro9zgBRtI324/EYsiSI7lhPbpIQ+DCeR2NNmMWANGGfZsg==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz", + "integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==", "dev": true, "requires": { "@babel/helper-string-parser": "^7.22.5", - "@babel/helper-validator-identifier": "^7.22.19", + "@babel/helper-validator-identifier": "^7.22.20", "to-fast-properties": "^2.0.0" } }, diff --git a/package.json b/package.json index e014cd917..a8f80b776 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "devDependencies": { "@babel/eslint-parser": "^7.22.15", "@babel/cli": "^7.22.15", - "@babel/core": "^7.22.20", + "@babel/core": "^7.23.0", "@babel/node": "^7.22.10", "@babel/preset-env": "^7.22.20", "@babel/register": "^7.22.15", From c6a1455fd87d45032cea50c4447431c173456a65 Mon Sep 17 00:00:00 2001 From: Hlavtox Date: Mon, 17 Jul 2023 08:18:19 +0200 Subject: [PATCH 08/19] Add selections feature --- config.xml | 2 +- ps_facetedsearch.php | 104 +++++++++++------- src/Adapter/MySQL.php | 14 ++- src/Filters/Block.php | 96 ++++++++++++++++ src/Filters/Converter.php | 35 ++++++ src/Product/Search.php | 46 ++++++++ src/Product/SearchProvider.php | 6 +- tests/php/FacetedSearch/Adapter/MySQLTest.php | 12 +- upgrade/upgrade-3.14.0.php | 32 ++++++ views/templates/admin/add.tpl | 30 +++++ 10 files changed, 323 insertions(+), 54 deletions(-) create mode 100644 upgrade/upgrade-3.14.0.php diff --git a/config.xml b/config.xml index 0ab6f7f39..e2426dd61 100644 --- a/config.xml +++ b/config.xml @@ -2,7 +2,7 @@ ps_facetedsearch - + diff --git a/ps_facetedsearch.php b/ps_facetedsearch.php index eb20d0659..97d901f67 100644 --- a/ps_facetedsearch.php +++ b/ps_facetedsearch.php @@ -96,7 +96,7 @@ public function __construct() { $this->name = 'ps_facetedsearch'; $this->tab = 'front_office_features'; - $this->version = '3.13.2'; + $this->version = '3.14.0'; $this->author = 'PrestaShop'; $this->need_instance = 0; $this->bootstrap = true; @@ -172,6 +172,9 @@ protected function getDefaultFilters() 'label' => 'Product price filter (slider)', 'slider' => true, ], + 'layered_selection_extras' => [ + 'label' => 'Product extras filter', + ], ]; } @@ -216,7 +219,7 @@ public function install() $productsCount = $this->getDatabase()->getValue('SELECT COUNT(*) FROM `' . _DB_PREFIX_ . 'product`'); if ($productsCount < static::LOCK_TEMPLATE_CREATION) { - $this->rebuildLayeredCache(); + $this->createDefaultTemplate(); } $this->rebuildPriceIndexTable(); @@ -591,7 +594,6 @@ public function indexProductPrices($idProduct, $smart = true) */ public function getContent() { - global $cookie; $message = ''; if (Tools::isSubmit('SubmitFilter')) { @@ -990,7 +992,7 @@ public function rebuildLayeredStructure() `controller` VARCHAR(64) NOT NULL, `id_category` INT(10) UNSIGNED NOT NULL, `id_value` INT(10) UNSIGNED NULL DEFAULT \'0\', - `type` ENUM(\'category\',\'id_feature\',\'id_attribute_group\',\'availability\',\'condition\',\'manufacturer\',\'weight\',\'price\') NOT NULL, + `type` ENUM(\'category\',\'id_feature\',\'id_attribute_group\',\'availability\',\'condition\',\'manufacturer\',\'weight\',\'price\',\'extras\') NOT NULL, `position` INT(10) UNSIGNED NOT NULL, `filter_type` int(10) UNSIGNED NOT NULL DEFAULT 0, `filter_show_limit` int(10) UNSIGNED NOT NULL DEFAULT 0, @@ -1027,17 +1029,25 @@ public function rebuildLayeredStructure() } /** - * Build layered cache - * - * @param array $productsIds - * @param array $categoriesIds - * @param bool $rebuildLayeredCategories + * This method creates the first initial filter after installing the module, + * from all available features and attributes. */ - public function rebuildLayeredCache($productsIds = [], $categoriesIds = [], $rebuildLayeredCategories = true) + public function createDefaultTemplate() { @set_time_limit(0); - $filterData = ['categories' => [], 'controllers' => ['category']]; + // Default filter data + $filterData = [ + 'categories' => [], + 'controllers' => [], + ]; + + // Add all stable controllers (except search) + foreach ($this->getSupportedControllers() as $controller_name => $data) { + if ($controller_name != 'search') { + $filterData['controllers'][] = $controller_name; + } + } /* Set memory limit to 128M only if current is lower */ $memoryLimit = Tools::getMemoryLimit(); @@ -1053,6 +1063,7 @@ public function rebuildLayeredCache($productsIds = [], $categoriesIds = [], $reb $joinProduct = Shop::addSqlAssociation('product', 'p'); $joinProductAttribute = Shop::addSqlAssociation('product_attribute', 'pa'); + // Fetch all available attributes and their values $attributeGroups = $this->query( 'SELECT a.id_attribute, a.id_attribute_group FROM ' . _DB_PREFIX_ . 'attribute a @@ -1062,10 +1073,8 @@ public function rebuildLayeredCache($productsIds = [], $categoriesIds = [], $reb ' . $joinProduct . $joinProductAttribute . ' LEFT JOIN ' . _DB_PREFIX_ . 'category_product cp ON (cp.id_product = p.id_product) LEFT JOIN ' . _DB_PREFIX_ . 'category c ON (c.id_category = cp.id_category) - WHERE c.active = 1' . - (count($categoriesIds) ? ' AND cp.id_category IN (' . implode(',', array_map('intval', $categoriesIds)) . ')' : '') . ' - AND ' . $alias . '.active = 1 AND ' . $alias . '.`visibility` IN ("both", "catalog") - ' . (count($productsIds) ? 'AND p.id_product IN (' . implode(',', array_map('intval', $productsIds)) . ')' : '') + WHERE c.active = 1 + AND ' . $alias . '.active = 1 AND ' . $alias . '.`visibility` IN ("both", "catalog")' ); $attributeGroupsById = []; @@ -1073,6 +1082,7 @@ public function rebuildLayeredCache($productsIds = [], $categoriesIds = [], $reb $attributeGroupsById[(int) $row['id_attribute']] = (int) $row['id_attribute_group']; } + // Fetch all available features and their values $features = $this->query( 'SELECT fv.id_feature_value, fv.id_feature FROM ' . _DB_PREFIX_ . 'feature_value fv @@ -1081,9 +1091,8 @@ public function rebuildLayeredCache($productsIds = [], $categoriesIds = [], $reb ' . $joinProduct . ' LEFT JOIN ' . _DB_PREFIX_ . 'category_product cp ON (cp.id_product = p.id_product) LEFT JOIN ' . _DB_PREFIX_ . 'category c ON (c.id_category = cp.id_category) - WHERE (fv.custom IS NULL OR fv.custom = 0) AND c.active = 1' . (count($categoriesIds) ? ' AND cp.id_category IN (' . implode(',', array_map('intval', $categoriesIds)) . ')' : '') . ' - AND ' . $alias . '.active = 1 AND ' . $alias . '.`visibility` IN ("both", "catalog") ' . - (count($productsIds) ? 'AND p.id_product IN (' . implode(',', array_map('intval', $productsIds)) . ')' : '') + WHERE (fv.custom IS NULL OR fv.custom = 0) AND c.active = 1 + AND ' . $alias . '.active = 1 AND ' . $alias . '.`visibility` IN ("both", "catalog") ' ); $featuresById = []; @@ -1104,10 +1113,9 @@ public function rebuildLayeredCache($productsIds = [], $categoriesIds = [], $reb LEFT JOIN ' . _DB_PREFIX_ . 'product_attribute pa ON (pa.id_product = p.id_product) ' . $joinProduct . $joinProductAttribute . ' LEFT JOIN ' . _DB_PREFIX_ . 'product_attribute_combination pac ON (pac.id_product_attribute = pa.id_product_attribute) - WHERE c.active = 1' . (count($categoriesIds) ? ' AND cp.id_category IN (' . implode(',', array_map('intval', $categoriesIds)) . ')' : '') . ' + WHERE c.active = 1 AND ' . $alias . '.active = 1 AND ' . $alias . '.`visibility` IN ("both", "catalog") - ' . (count($productsIds) ? 'AND p.id_product IN (' . implode(',', array_map('intval', $productsIds)) . ')' : '') . - ' AND (fv.custom IS NULL OR fv.custom = 0) + AND (fv.custom IS NULL OR fv.custom = 0) GROUP BY p.id_product' ); @@ -1138,11 +1146,36 @@ public function rebuildLayeredCache($productsIds = [], $categoriesIds = [], $reb if (!isset($nCategories[(int) $idCategory])) { $nCategories[(int) $idCategory] = 1; } + + // Stock filter + if (!isset($doneCategories[(int) $idCategory]['q'])) { + $filterData['layered_selection_stock'] = ['filter_type' => Converter::WIDGET_TYPE_CHECKBOX, 'filter_show_limit' => 0]; + $doneCategories[(int) $idCategory]['q'] = true; + $toInsert = true; + } + + // Add extras filter + if (!isset($doneCategories[(int) $idCategory]['e'])) { + $filterData['layered_selection_extras'] = ['filter_type' => Converter::WIDGET_TYPE_CHECKBOX, 'filter_show_limit' => 0]; + $doneCategories[(int) $idCategory]['e'] = true; + $toInsert = true; + } + + // Price filter + if (!isset($doneCategories[(int) $idCategory]['p'])) { + $filterData['layered_selection_price_slider'] = ['filter_type' => Converter::WIDGET_TYPE_CHECKBOX, 'filter_show_limit' => 0]; + $doneCategories[(int) $idCategory]['p'] = true; + $toInsert = true; + } + + // Category filter if (!isset($doneCategories[(int) $idCategory]['cat'])) { $filterData['layered_selection_subcategories'] = ['filter_type' => Converter::WIDGET_TYPE_CHECKBOX, 'filter_show_limit' => 0]; $doneCategories[(int) $idCategory]['cat'] = true; $toInsert = true; } + + // Attribute filter if (is_array($attributeGroupsById) && count($attributeGroupsById) > 0) { foreach ($a as $kAttribute => $attribute) { if (!isset($doneCategories[(int) $idCategory]['a' . (int) $attributeGroupsById[(int) $kAttribute]])) { @@ -1152,7 +1185,9 @@ public function rebuildLayeredCache($productsIds = [], $categoriesIds = [], $reb } } } - if (is_array($attributeGroupsById) && count($attributeGroupsById) > 0) { + + // Features filter + if (is_array($featuresById) && count($featuresById) > 0) { foreach ($f as $kFeature => $feature) { if (!isset($doneCategories[(int) $idCategory]['f' . (int) $featuresById[(int) $kFeature]])) { $filterData['layered_selection_feat_' . (int) $featuresById[(int) $kFeature]] = ['filter_type' => Converter::WIDGET_TYPE_CHECKBOX, 'filter_show_limit' => 0]; @@ -1162,38 +1197,30 @@ public function rebuildLayeredCache($productsIds = [], $categoriesIds = [], $reb } } - if (!isset($doneCategories[(int) $idCategory]['q'])) { - $filterData['layered_selection_stock'] = ['filter_type' => Converter::WIDGET_TYPE_CHECKBOX, 'filter_show_limit' => 0]; - $doneCategories[(int) $idCategory]['q'] = true; - $toInsert = true; - } - + // Manufacturer filter if (!isset($doneCategories[(int) $idCategory]['m'])) { $filterData['layered_selection_manufacturer'] = ['filter_type' => Converter::WIDGET_TYPE_CHECKBOX, 'filter_show_limit' => 0]; $doneCategories[(int) $idCategory]['m'] = true; $toInsert = true; } + // Condition filter if (!isset($doneCategories[(int) $idCategory]['c'])) { $filterData['layered_selection_condition'] = ['filter_type' => Converter::WIDGET_TYPE_CHECKBOX, 'filter_show_limit' => 0]; $doneCategories[(int) $idCategory]['c'] = true; $toInsert = true; } + // Weight filter if (!isset($doneCategories[(int) $idCategory]['w'])) { $filterData['layered_selection_weight_slider'] = ['filter_type' => Converter::WIDGET_TYPE_CHECKBOX, 'filter_show_limit' => 0]; $doneCategories[(int) $idCategory]['w'] = true; $toInsert = true; } - - if (!isset($doneCategories[(int) $idCategory]['p'])) { - $filterData['layered_selection_price_slider'] = ['filter_type' => Converter::WIDGET_TYPE_CHECKBOX, 'filter_show_limit' => 0]; - $doneCategories[(int) $idCategory]['p'] = true; - $toInsert = true; - } } } + // If there are any filters available to setup, we will create the filter template if ($toInsert) { $this->getDatabase()->execute('INSERT INTO ' . _DB_PREFIX_ . 'layered_filter(name, filters, n_categories, date_add) VALUES (\'' . sprintf($this->trans('My template %s', [], 'Modules.Facetedsearch.Admin'), date('Y-m-d')) . '\', \'' . pSQL(serialize($filterData)) . '\', ' . count($filterData['categories']) . ', NOW())'); @@ -1204,11 +1231,10 @@ public function rebuildLayeredCache($productsIds = [], $categoriesIds = [], $reb $this->getDatabase()->execute('INSERT INTO ' . _DB_PREFIX_ . 'layered_filter_shop (`id_layered_filter`, `id_shop`) VALUES(' . $last_id . ', ' . (int) $idShop . ')'); } - - if ($rebuildLayeredCategories) { - $this->buildLayeredCategories(); - } } + + // Now we need to build layered_category table from this template + $this->buildLayeredCategories(); } /** @@ -1295,6 +1321,8 @@ public function buildLayeredCategories() } elseif (substr($key, 0, 23) == 'layered_selection_feat_') { $sqlInsert .= '(' . (int) $idCategory . ', \'' . $controller . '\', ' . (int) $idShop . ', ' . (int) str_replace('layered_selection_feat_', '', $key) . ', \'id_feature\',' . (int) $n . ', ' . (int) $limit . ', ' . (int) $type . '),'; + } elseif ($key == 'layered_selection_extras') { + $sqlInsert .= '(' . (int) $idCategory . ', \'' . $controller . '\', ' . (int) $idShop . ', NULL,\'extras\',' . (int) $n . ', ' . (int) $limit . ', ' . (int) $type . '),'; } ++$nbSqlValuesToInsert; diff --git a/src/Adapter/MySQL.php b/src/Adapter/MySQL.php index cb13a4d66..821b62812 100644 --- a/src/Adapter/MySQL.php +++ b/src/Adapter/MySQL.php @@ -98,20 +98,20 @@ public function getQuery() // Process and generate all fields for the SQL query below $orderField = $this->computeOrderByField($filterToTableMapping); + $selectFields = $this->computeSelectFields($filterToTableMapping); + $whereConditions = $this->computeWhereConditions($filterToTableMapping); + $joinConditions = $this->computeJoinConditions($filterToTableMapping); + $groupFields = $this->computeGroupByFields($filterToTableMapping); // Now, let's build the query... // If this query IS the initial population (the base table), we are selecting from product table if ($this->getInitialPopulation() === null) { $referenceTable = _DB_PREFIX_ . 'product'; + // If not, we will call this function again but for the initial population } else { $referenceTable = '(' . $this->getInitialPopulation()->getQuery() . ')'; } - $selectFields = $this->computeSelectFields($filterToTableMapping); - $whereConditions = $this->computeWhereConditions($filterToTableMapping); - $joinConditions = $this->computeJoinConditions($filterToTableMapping); - $groupFields = $this->computeGroupByFields($filterToTableMapping); - $query = 'SELECT ' . implode(', ', $selectFields) . ' FROM ' . $referenceTable . ' p'; foreach ($joinConditions as $joinAliasInfos) { @@ -327,7 +327,7 @@ protected function getFieldMapping() (sp.from = \'0000-00-00 00:00:00\' OR \'' . date('Y-m-d H:i:s') . '\' >= sp.from) AND (sp.to = \'0000-00-00 00:00:00\' OR \'' . date('Y-m-d H:i:s') . '\' <= sp.to) )', - 'joinType' => self::INNER_JOIN, + 'joinType' => self::LEFT_JOIN, ], ]; @@ -805,6 +805,8 @@ public function useFiltersAsInitialPopulation() 'weight', 'price', 'sales', + 'on_sale', + 'date_add', ] ); diff --git a/src/Filters/Block.php b/src/Filters/Block.php index bd411ff84..d9924de81 100644 --- a/src/Filters/Block.php +++ b/src/Filters/Block.php @@ -139,6 +139,9 @@ public function getFilterBlock( case 'availability': $filterBlocks[] = $this->getAvailabilitiesBlock($filter, $selectedFilters); break; + case 'extras': + $filterBlocks[] = $this->getHighlightsBlock($filter, $selectedFilters); + break; case 'manufacturer': $filterBlocks[] = $this->getManufacturersBlock($filter, $selectedFilters, $idLang); break; @@ -532,6 +535,99 @@ private function getAvailabilitiesBlock($filter, $selectedFilters) return $quantityBlock; } + /** + * Gets block for extra product properties like "new", "on sale" and "discounted" + * + * @param array $filter + * @param array $selectedFilters + * + * @return array + */ + private function getHighlightsBlock($filter, $selectedFilters) + { + // Prepare array with options + $extrasOptions = []; + + // Products on sale - available everywhere + $extrasOptions['sale'] = [ + 'name' => $this->context->getTranslator()->trans( + 'On sale', + [], + 'Modules.Facetedsearch.Shop' + ), + 'nbr' => 0, + ]; + $filteredSearchAdapter = $this->searchAdapter->getFilteredSearchAdapter(Search::HIGHLIGHTS_FILTER); + $filteredSearchAdapter->addOperationsFilter( + Search::HIGHLIGHTS_FILTER, + [[['on_sale', [1], '=']]] + ); + $extrasOptions['sale']['nbr'] = $filteredSearchAdapter->count(); + + // New products - available everywhere except that page + if ($this->query->getQueryType() != 'new-products') { + $extrasOptions['new'] = [ + 'name' => $this->context->getTranslator()->trans( + 'New product', + [], + 'Modules.Facetedsearch.Shop' + ), + 'nbr' => 0, + ]; + $filteredSearchAdapter = $this->searchAdapter->getFilteredSearchAdapter('date_add'); + $timeCondition = date( + 'Y-m-d 00:00:00', + strtotime( + ((int) Configuration::get('PS_NB_DAYS_NEW_PRODUCT') > 0 ? + '-' . ((int) Configuration::get('PS_NB_DAYS_NEW_PRODUCT') - 1) . ' days' : + '+ 1 days') + ) + ); + $filteredSearchAdapter->addFilter('date_add', ["'" . $timeCondition . "'"], '>'); + $extrasOptions['new']['nbr'] = $filteredSearchAdapter->count(); + } + + // Discounted products - available everywhere except that page + if ($this->query->getQueryType() != 'prices-drop') { + $extrasOptions['discount'] = [ + 'name' => $this->context->getTranslator()->trans( + 'Discounted', + [], + 'Modules.Facetedsearch.Shop' + ), + 'nbr' => 0, + ]; + $filteredSearchAdapter = $this->searchAdapter->getFilteredSearchAdapter(Search::HIGHLIGHTS_FILTER); + $filteredSearchAdapter->addOperationsFilter( + Search::HIGHLIGHTS_FILTER, + [[['reduction', [0], '>']]] + ); + $extrasOptions['discount']['nbr'] = $filteredSearchAdapter->count(); + } + + // If some filters are selected, we mark them as such + if (isset($selectedFilters['extras'])) { + // We loop through selected filters and assign it to our options and remove the rest + foreach ($extrasOptions as $key => $values) { + if (in_array($key, $selectedFilters['extras'], true)) { + $extrasOptions[$key]['checked'] = true; + } + } + } + + $conditionBlock = [ + 'type_lite' => 'extras', + 'type' => 'extras', + 'id_key' => 0, + 'name' => $this->context->getTranslator()->trans('Selections', [], 'Modules.Facetedsearch.Shop'), + 'values' => $extrasOptions, + 'filter_show_limit' => (int) $filter['filter_show_limit'], + 'filter_type' => $filter['filter_type'], + ]; + + return $conditionBlock; + } + /** * Get the manufacturers filter block * diff --git a/src/Filters/Converter.php b/src/Filters/Converter.php index abe255c03..549d2d2f9 100644 --- a/src/Filters/Converter.php +++ b/src/Filters/Converter.php @@ -47,6 +47,7 @@ class Converter const TYPE_MANUFACTURER = 'manufacturer'; const TYPE_PRICE = 'price'; const TYPE_WEIGHT = 'weight'; + const TYPE_EXTRAS = 'extras'; const PROPERTY_URL_NAME = 'url_name'; const PROPERTY_COLOR = 'color'; @@ -115,6 +116,7 @@ public function getFacetsFromFilterBlocks(array $filterBlocks) switch ($filterBlock['type']) { case self::TYPE_CATEGORY: case self::TYPE_CONDITION: + case self::TYPE_EXTRAS: case self::TYPE_MANUFACTURER: case self::TYPE_AVAILABILITY: case self::TYPE_ATTRIBUTE_GROUP: @@ -351,6 +353,37 @@ public function createFacetedSearchFiltersFromQuery(ProductSearchQuery $query) } } break; + case self::TYPE_EXTRAS: + if (!isset($receivedFilters[$filterLabel])) { + // No need to filter if no information + continue 2; + } + + $extrasOptions = [ + $this->context->getTranslator()->trans( + 'New product', + [], + 'Modules.Facetedsearch.Shop' + ) => 'new', + $this->context->getTranslator()->trans( + 'On sale', + [], + 'Modules.Facetedsearch.Shop' + ) => 'sale', + $this->context->getTranslator()->trans( + 'Discounted', + [], + 'Modules.Facetedsearch.Shop' + ) => 'discount', + ]; + + $searchFilters[$filter['type']] = []; + foreach ($extrasOptions as $extrasOption => $optionId) { + if (isset($receivedFilters[$filterLabel]) && in_array($extrasOption, $receivedFilters[$filterLabel])) { + $searchFilters[$filter['type']][] = $optionId; + } + } + break; case self::TYPE_FEATURE: $features = $this->dataAccessor->getFeatures($idLang); foreach ($features as $feature) { @@ -471,6 +504,8 @@ private function convertFilterTypeToLabel($filterType) return $this->context->getTranslator()->trans('Weight', [], 'Modules.Facetedsearch.Shop'); case self::TYPE_CONDITION: return $this->context->getTranslator()->trans('Condition', [], 'Modules.Facetedsearch.Shop'); + case self::TYPE_EXTRAS: + return $this->context->getTranslator()->trans('Selections', [], 'Modules.Facetedsearch.Shop'); case self::TYPE_AVAILABILITY: return $this->context->getTranslator()->trans('Availability', [], 'Modules.Facetedsearch.Shop'); case self::TYPE_MANUFACTURER: diff --git a/src/Product/Search.php b/src/Product/Search.php index 638057446..8e85c9e2b 100644 --- a/src/Product/Search.php +++ b/src/Product/Search.php @@ -33,6 +33,7 @@ class Search { const STOCK_MANAGEMENT_FILTER = 'with_stock_management'; + const HIGHLIGHTS_FILTER = 'extras'; /** * @var bool @@ -173,6 +174,41 @@ private function addSearchFilters($selectedFilters) $this->addFilter('id_category', $filterValues); break; + case 'extras': + // Filter for new products + if (in_array('new', $filterValues)) { + $timeCondition = date( + 'Y-m-d 00:00:00', + strtotime( + ((int) Configuration::get('PS_NB_DAYS_NEW_PRODUCT') > 0 ? + '-' . ((int) Configuration::get('PS_NB_DAYS_NEW_PRODUCT') - 1) . ' days' : + '+ 1 days') + ) + ); + // Reset filter to prevent two same filters if we are on new products page + $this->getSearchAdapter()->addFilter('date_add', ["'" . $timeCondition . "'"], '>'); + } + + // Filter for discounts - they must work as OR + $operationsFilter = []; + if (in_array('discount', $filterValues)) { + $operationsFilter[] = [ + ['reduction', [0], '>'], + ]; + } + if (in_array('sale', $filterValues)) { + $operationsFilter[] = [ + ['on_sale', [1], '='], + ]; + } + if (!empty($operationsFilter)) { + $this->getSearchAdapter()->addOperationsFilter( + self::HIGHLIGHTS_FILTER, + $operationsFilter + ); + } + break; + case 'availability': /* * $filterValues options can have following values: @@ -360,6 +396,11 @@ private function addControllerSpecificFilters() * If there is a zero set to disable this feature, it creates unreachable condition. */ if ($this->query->getQueryType() == 'new-products') { + // We check if some specific filter of this type wasn't added before + if (!empty($this->getSearchAdapter()->getFilter('date_add'))) { + return; + } + $timeCondition = date( 'Y-m-d 00:00:00', strtotime( @@ -386,6 +427,11 @@ private function addControllerSpecificFilters() * We are selecting products that have a specific price created meeting certain conditions. */ if ($this->query->getQueryType() == 'prices-drop') { + // We check if some specific filter of this type wasn't added before + if (!empty($this->getSearchAdapter()->getFilter('reduction'))) { + return; + } + $this->getSearchAdapter()->addFilter('reduction', [0], '>'); } diff --git a/src/Product/SearchProvider.php b/src/Product/SearchProvider.php index d07108d74..b42e439ae 100644 --- a/src/Product/SearchProvider.php +++ b/src/Product/SearchProvider.php @@ -507,7 +507,7 @@ private function addEncodedFacetsToFilters(array $facets) /** * Remove the facet when there's only 1 result. * Keep facet status when it's a slider. - * Keep facet status if it's a availability facet. + * Keep facet status if it's a availability or extras facet. * * @param array $facets * @param int $totalProducts @@ -545,8 +545,8 @@ private function hideUselessFacets(array $facets, $totalProducts) && $usefulFiltersCount > 0 ) || - // If there is only one filter, but it's availability filter - we want this one to be displayed all the time - ($usefulFiltersCount === 1 && $facet->getType() == 'availability') + // If there is only one filter, but it's availability or extras filter - we want this one to be displayed all the time + ($usefulFiltersCount === 1 && ($facet->getType() == 'availability' || $facet->getType() == 'extras')) ); // Other cases - hidden by default } diff --git a/tests/php/FacetedSearch/Adapter/MySQLTest.php b/tests/php/FacetedSearch/Adapter/MySQLTest.php index a8a9c641d..85f95f0c2 100644 --- a/tests/php/FacetedSearch/Adapter/MySQLTest.php +++ b/tests/php/FacetedSearch/Adapter/MySQLTest.php @@ -207,7 +207,7 @@ public function testValueCountWithInitialPopulation() $dbInstanceMock = Mockery::mock(Db::class); $dbInstanceMock->shouldReceive('executeS') ->once() - ->with('SELECT p.id_product, p.weight, COUNT(DISTINCT p.id_product) c FROM (SELECT p.id_product, p.id_manufacturer, SUM(sa.quantity) as quantity, p.condition, p.weight, p.price, psales.quantity as sales FROM ps_product p LEFT JOIN ps_product_attribute pa ON (p.id_product = pa.id_product) LEFT JOIN ps_product_attribute_combination pac ON (pa.id_product_attribute = pac.id_product_attribute) LEFT JOIN ps_stock_available sa ON (p.id_product = sa.id_product AND IFNULL(pac.id_product_attribute, 0) = sa.id_product_attribute) LEFT JOIN ps_product_sale psales ON (psales.id_product = p.id_product)) p GROUP BY p.weight') + ->with('SELECT p.id_product, p.weight, COUNT(DISTINCT p.id_product) c FROM (SELECT p.id_product, p.id_manufacturer, SUM(sa.quantity) as quantity, p.condition, p.weight, p.price, psales.quantity as sales, p.on_sale, p.date_add FROM ps_product p LEFT JOIN ps_product_attribute pa ON (p.id_product = pa.id_product) LEFT JOIN ps_product_attribute_combination pac ON (pa.id_product_attribute = pac.id_product_attribute) LEFT JOIN ps_stock_available sa ON (p.id_product = sa.id_product AND IFNULL(pac.id_product_attribute, 0) = sa.id_product_attribute) LEFT JOIN ps_product_sale psales ON (psales.id_product = p.id_product)) p GROUP BY p.weight') ->andReturn( [ [ @@ -244,7 +244,7 @@ public function testValueCountWithInitialPopulationAndStockManagement() $dbInstanceMock = Mockery::mock(Db::class); $dbInstanceMock->shouldReceive('executeS') ->once() - ->with('SELECT p.id_product, p.weight, COUNT(DISTINCT p.id_product) c FROM (SELECT p.id_product, p.id_manufacturer, SUM(sa.quantity) as quantity, p.condition, p.weight, p.price, psales.quantity as sales FROM ps_product p LEFT JOIN ps_product_attribute pa ON (p.id_product = pa.id_product) LEFT JOIN ps_product_attribute_combination pac ON (pa.id_product_attribute = pac.id_product_attribute) LEFT JOIN ps_stock_available sa ON (p.id_product = sa.id_product AND IFNULL(pac.id_product_attribute, 0) = sa.id_product_attribute) LEFT JOIN ps_product_sale psales ON (psales.id_product = p.id_product) WHERE ((sa.quantity>=0))) p LEFT JOIN ps_product_attribute pa ON (p.id_product = pa.id_product) LEFT JOIN ps_product_attribute_combination pac ON (pa.id_product_attribute = pac.id_product_attribute) LEFT JOIN ps_stock_available sa ON (p.id_product = sa.id_product AND IFNULL(pac.id_product_attribute, 0) = sa.id_product_attribute) WHERE ((sa.quantity>=0)) GROUP BY p.weight') + ->with('SELECT p.id_product, p.weight, COUNT(DISTINCT p.id_product) c FROM (SELECT p.id_product, p.id_manufacturer, SUM(sa.quantity) as quantity, p.condition, p.weight, p.price, psales.quantity as sales, p.on_sale, p.date_add FROM ps_product p LEFT JOIN ps_product_attribute pa ON (p.id_product = pa.id_product) LEFT JOIN ps_product_attribute_combination pac ON (pa.id_product_attribute = pac.id_product_attribute) LEFT JOIN ps_stock_available sa ON (p.id_product = sa.id_product AND IFNULL(pac.id_product_attribute, 0) = sa.id_product_attribute) LEFT JOIN ps_product_sale psales ON (psales.id_product = p.id_product) WHERE ((sa.quantity>=0))) p LEFT JOIN ps_product_attribute pa ON (p.id_product = pa.id_product) LEFT JOIN ps_product_attribute_combination pac ON (pa.id_product_attribute = pac.id_product_attribute) LEFT JOIN ps_stock_available sa ON (p.id_product = sa.id_product AND IFNULL(pac.id_product_attribute, 0) = sa.id_product_attribute) WHERE ((sa.quantity>=0)) GROUP BY p.weight') ->andReturn( [ [ @@ -391,7 +391,7 @@ public function testGetQueryWithPriceOrderFieldInAscWithInitialPopulation() $this->adapter->setOrderDirection('asc'); $this->assertEquals( - 'SELECT p.id_product FROM (SELECT p.id_product, p.id_manufacturer, SUM(sa.quantity) as quantity, p.condition, p.weight, p.price, psales.quantity as sales, m.name FROM ps_product p LEFT JOIN ps_product_attribute pa ON (p.id_product = pa.id_product) LEFT JOIN ps_product_attribute_combination pac ON (pa.id_product_attribute = pac.id_product_attribute) LEFT JOIN ps_stock_available sa ON (p.id_product = sa.id_product AND IFNULL(pac.id_product_attribute, 0) = sa.id_product_attribute) LEFT JOIN ps_product_sale psales ON (psales.id_product = p.id_product) LEFT JOIN ps_manufacturer m ON (p.id_manufacturer = m.id_manufacturer)) p LEFT JOIN ps_manufacturer m ON (p.id_manufacturer = m.id_manufacturer) ORDER BY m.name ASC, p.id_product DESC', + 'SELECT p.id_product FROM (SELECT p.id_product, p.id_manufacturer, SUM(sa.quantity) as quantity, p.condition, p.weight, p.price, psales.quantity as sales, p.on_sale, p.date_add, m.name FROM ps_product p LEFT JOIN ps_product_attribute pa ON (p.id_product = pa.id_product) LEFT JOIN ps_product_attribute_combination pac ON (pa.id_product_attribute = pac.id_product_attribute) LEFT JOIN ps_stock_available sa ON (p.id_product = sa.id_product AND IFNULL(pac.id_product_attribute, 0) = sa.id_product_attribute) LEFT JOIN ps_product_sale psales ON (psales.id_product = p.id_product) LEFT JOIN ps_manufacturer m ON (p.id_manufacturer = m.id_manufacturer)) p LEFT JOIN ps_manufacturer m ON (p.id_manufacturer = m.id_manufacturer) ORDER BY m.name ASC, p.id_product DESC', $this->adapter->getQuery() ); } @@ -404,7 +404,7 @@ public function testGetQueryWithPositionOrderFieldInAscWithInitialPopulation() $this->adapter->setOrderDirection('desc'); $this->assertEquals( - 'SELECT p.id_product FROM (SELECT p.id_product, p.id_manufacturer, SUM(sa.quantity) as quantity, p.condition, p.weight, p.price, psales.quantity as sales, cp.position FROM ps_product p LEFT JOIN ps_product_attribute pa ON (p.id_product = pa.id_product) LEFT JOIN ps_product_attribute_combination pac ON (pa.id_product_attribute = pac.id_product_attribute) LEFT JOIN ps_stock_available sa ON (p.id_product = sa.id_product AND IFNULL(pac.id_product_attribute, 0) = sa.id_product_attribute) LEFT JOIN ps_product_sale psales ON (psales.id_product = p.id_product) INNER JOIN ps_category_product cp ON (p.id_product = cp.id_product)) p INNER JOIN ps_category_product cp ON (p.id_product = cp.id_product) ORDER BY p.position DESC, p.id_product DESC', + 'SELECT p.id_product FROM (SELECT p.id_product, p.id_manufacturer, SUM(sa.quantity) as quantity, p.condition, p.weight, p.price, psales.quantity as sales, p.on_sale, p.date_add, cp.position FROM ps_product p LEFT JOIN ps_product_attribute pa ON (p.id_product = pa.id_product) LEFT JOIN ps_product_attribute_combination pac ON (pa.id_product_attribute = pac.id_product_attribute) LEFT JOIN ps_stock_available sa ON (p.id_product = sa.id_product AND IFNULL(pac.id_product_attribute, 0) = sa.id_product_attribute) LEFT JOIN ps_product_sale psales ON (psales.id_product = p.id_product) INNER JOIN ps_category_product cp ON (p.id_product = cp.id_product)) p INNER JOIN ps_category_product cp ON (p.id_product = cp.id_product) ORDER BY p.position DESC, p.id_product DESC', $this->adapter->getQuery() ); } @@ -428,7 +428,7 @@ public function testGetQueryWithComputeShowLastEnabled() $this->adapter->setOrderDirection('desc'); $this->assertEquals( - 'SELECT p.id_product, sa.out_of_stock FROM (SELECT p.id_product, p.id_manufacturer, SUM(sa.quantity) as quantity, p.condition, p.weight, p.price, psales.quantity as sales, cp.position FROM ps_product p LEFT JOIN ps_product_attribute pa ON (p.id_product = pa.id_product) LEFT JOIN ps_product_attribute_combination pac ON (pa.id_product_attribute = pac.id_product_attribute) LEFT JOIN ps_stock_available sa ON (p.id_product = sa.id_product AND IFNULL(pac.id_product_attribute, 0) = sa.id_product_attribute) LEFT JOIN ps_product_sale psales ON (psales.id_product = p.id_product) INNER JOIN ps_category_product cp ON (p.id_product = cp.id_product)) p LEFT JOIN ps_product_attribute pa ON (p.id_product = pa.id_product) LEFT JOIN ps_product_attribute_combination pac ON (pa.id_product_attribute = pac.id_product_attribute) LEFT JOIN ps_stock_available sa ON (p.id_product = sa.id_product AND IFNULL(pac.id_product_attribute, 0) = sa.id_product_attribute) INNER JOIN ps_category_product cp ON (p.id_product = cp.id_product) ORDER BY IFNULL(p.quantity, 0) <= 0, IFNULL(p.quantity, 0) <= 0 AND FIELD(sa.out_of_stock, 0) ASC, p.position DESC, p.id_product DESC', + 'SELECT p.id_product, sa.out_of_stock FROM (SELECT p.id_product, p.id_manufacturer, SUM(sa.quantity) as quantity, p.condition, p.weight, p.price, psales.quantity as sales, p.on_sale, p.date_add, cp.position FROM ps_product p LEFT JOIN ps_product_attribute pa ON (p.id_product = pa.id_product) LEFT JOIN ps_product_attribute_combination pac ON (pa.id_product_attribute = pac.id_product_attribute) LEFT JOIN ps_stock_available sa ON (p.id_product = sa.id_product AND IFNULL(pac.id_product_attribute, 0) = sa.id_product_attribute) LEFT JOIN ps_product_sale psales ON (psales.id_product = p.id_product) INNER JOIN ps_category_product cp ON (p.id_product = cp.id_product)) p LEFT JOIN ps_product_attribute pa ON (p.id_product = pa.id_product) LEFT JOIN ps_product_attribute_combination pac ON (pa.id_product_attribute = pac.id_product_attribute) LEFT JOIN ps_stock_available sa ON (p.id_product = sa.id_product AND IFNULL(pac.id_product_attribute, 0) = sa.id_product_attribute) INNER JOIN ps_category_product cp ON (p.id_product = cp.id_product) ORDER BY IFNULL(p.quantity, 0) <= 0, IFNULL(p.quantity, 0) <= 0 AND FIELD(sa.out_of_stock, 0) ASC, p.position DESC, p.id_product DESC', $this->adapter->getQuery() ); } @@ -452,7 +452,7 @@ public function testGetQueryWithComputeShowLastEnabledAndDenyOrderOutOfStockProd $this->adapter->setOrderDirection('desc'); $this->assertEquals( - 'SELECT p.id_product, sa.out_of_stock FROM (SELECT p.id_product, p.id_manufacturer, SUM(sa.quantity) as quantity, p.condition, p.weight, p.price, psales.quantity as sales, cp.position FROM ps_product p LEFT JOIN ps_product_attribute pa ON (p.id_product = pa.id_product) LEFT JOIN ps_product_attribute_combination pac ON (pa.id_product_attribute = pac.id_product_attribute) LEFT JOIN ps_stock_available sa ON (p.id_product = sa.id_product AND IFNULL(pac.id_product_attribute, 0) = sa.id_product_attribute) LEFT JOIN ps_product_sale psales ON (psales.id_product = p.id_product) INNER JOIN ps_category_product cp ON (p.id_product = cp.id_product)) p LEFT JOIN ps_product_attribute pa ON (p.id_product = pa.id_product) LEFT JOIN ps_product_attribute_combination pac ON (pa.id_product_attribute = pac.id_product_attribute) LEFT JOIN ps_stock_available sa ON (p.id_product = sa.id_product AND IFNULL(pac.id_product_attribute, 0) = sa.id_product_attribute) INNER JOIN ps_category_product cp ON (p.id_product = cp.id_product) ORDER BY IFNULL(p.quantity, 0) <= 0, IFNULL(p.quantity, 0) <= 0 AND FIELD(sa.out_of_stock, 1) DESC, p.position DESC, p.id_product DESC', + 'SELECT p.id_product, sa.out_of_stock FROM (SELECT p.id_product, p.id_manufacturer, SUM(sa.quantity) as quantity, p.condition, p.weight, p.price, psales.quantity as sales, p.on_sale, p.date_add, cp.position FROM ps_product p LEFT JOIN ps_product_attribute pa ON (p.id_product = pa.id_product) LEFT JOIN ps_product_attribute_combination pac ON (pa.id_product_attribute = pac.id_product_attribute) LEFT JOIN ps_stock_available sa ON (p.id_product = sa.id_product AND IFNULL(pac.id_product_attribute, 0) = sa.id_product_attribute) LEFT JOIN ps_product_sale psales ON (psales.id_product = p.id_product) INNER JOIN ps_category_product cp ON (p.id_product = cp.id_product)) p LEFT JOIN ps_product_attribute pa ON (p.id_product = pa.id_product) LEFT JOIN ps_product_attribute_combination pac ON (pa.id_product_attribute = pac.id_product_attribute) LEFT JOIN ps_stock_available sa ON (p.id_product = sa.id_product AND IFNULL(pac.id_product_attribute, 0) = sa.id_product_attribute) INNER JOIN ps_category_product cp ON (p.id_product = cp.id_product) ORDER BY IFNULL(p.quantity, 0) <= 0, IFNULL(p.quantity, 0) <= 0 AND FIELD(sa.out_of_stock, 1) DESC, p.position DESC, p.id_product DESC', $this->adapter->getQuery() ); } diff --git a/upgrade/upgrade-3.14.0.php b/upgrade/upgrade-3.14.0.php new file mode 100644 index 000000000..494d5bf97 --- /dev/null +++ b/upgrade/upgrade-3.14.0.php @@ -0,0 +1,32 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) + */ +if (!defined('_PS_VERSION_')) { + exit; +} + +function upgrade_module_3_14_0(Ps_Facetedsearch $module) +{ + // Add availabilility to allowed types + Db::getInstance()->execute( + 'ALTER TABLE `' . _DB_PREFIX_ . 'layered_category` + CHANGE `type` `type` ENUM(\'category\',\'id_feature\',\'id_attribute_group\',\'availability\',\'condition\',\'manufacturer\',\'weight\',\'price\',\'extras\') NOT NULL;'); + + return true; +} diff --git a/views/templates/admin/add.tpl b/views/templates/admin/add.tpl index 4096abad9..f6bc62ed6 100644 --- a/views/templates/admin/add.tpl +++ b/views/templates/admin/add.tpl @@ -111,6 +111,36 @@ + +
  • +
    + +
    +
    + {l s='Product extras filter' d='Modules.Facetedsearch.Admin'} +
    +
    + +
    + {call get_limit_select element="layered_selection_extras"} +
    +
    +
    + +
    + +

    {l s='Checkbox' d='Modules.Facetedsearch.Admin'}

    +
    +
    +
  • +