├── i18n
└── en_US.csv
├── registration.php
├── etc
├── module.xml
└── di.xml
├── README.md
├── composer.json
└── Plugin
├── Product
└── ProductList
│ └── Toolbar.php
└── Model
└── Config.php
/i18n/en_US.csv:
--------------------------------------------------------------------------------
1 | Relevance,Relevance
2 | "Price : High to Low","Price : High to Low"
3 | "Price : Low to High","Price : Low to High"
4 |
--------------------------------------------------------------------------------
/registration.php:
--------------------------------------------------------------------------------
1 |
2 |
9 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # magento2-advanced-sorting
2 | Magento 2 Module that adds sorting by name, priority and price within the Catalog view Toolbar sorting dropdown instead of having to toggle ASC/DESC using the up and down arrows.
3 |
4 | ## Quick Info
5 |
6 | * This module is for advanced users, theme developers. There are no settings or options at this time to enable or disable per store view
7 | * This module cannot be install directly from github yet. We are working on setting it up for composer.
8 |
9 | ## Coming Soon
10 | * Options to enable/disable at a store view level.
11 | * More customizations.
12 |
13 | ## Help
14 | If you come across any bugs or issues please use the issue tracker
15 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "linchpin/magento2-advanced-sorting",
3 | "description": "Magento 2 Module that adds sorting by name, priority and price within the sorting dropdown instead of having to toggle using the up and down arrow.",
4 | "type": "magento2-module",
5 | "version": "1.0.0",
6 | "license": [
7 | "OSL-3.0",
8 | "AFL-3.0"
9 | ],
10 | "authors": [
11 | {
12 | "name": "Linchpin",
13 | "role": "Developer"
14 | }
15 | ],
16 | "require": {
17 | "php": "~5.6.0|7.0.2|7.0.4|~7.1.0"
18 | },
19 | "autoload": {
20 | "files": [ "registration.php" ],
21 | "psr-4": {
22 | "Linchpin\\AdvancedSorting\\": ""
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/etc/di.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Plugin/Product/ProductList/Toolbar.php:
--------------------------------------------------------------------------------
1 | getCurrentOrder();
28 | $result = $proceed($collection);
29 |
30 | if ($currentOrder) {
31 | if ($currentOrder == 'price_desc') {
32 | $subject->getCollection()->setOrder('price', 'desc');
33 | } elseif ($currentOrder == 'price_asc') {
34 | $subject->getCollection()->setOrder('price', 'asc');
35 | }
36 | }
37 |
38 | return $result;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/Plugin/Model/Config.php:
--------------------------------------------------------------------------------
1 |