├── Block
└── Adminhtml
│ └── Attribute
│ └── Edit
│ └── Options
│ ├── Options.php
│ ├── PaginationTrait.php
│ ├── Text.php
│ └── Visual.php
├── CHANGELOG.md
├── LICENSE
├── LICENSE.md
├── README.md
├── composer.json
├── etc
├── di.xml
└── module.xml
├── registration.php
└── view
└── adminhtml
├── requirejs-config.js
├── templates
└── catalog
│ └── product
│ └── attribute
│ ├── options.phtml
│ ├── text.phtml
│ └── visual.phtml
└── web
├── css
└── source
│ └── _module.less
└── js
└── pager.js
/Block/Adminhtml/Attribute/Edit/Options/Options.php:
--------------------------------------------------------------------------------
1 |
5 | *
6 | * @category Qoliber
7 | * @package Qoliber_AttributeOptionPager
8 | */
9 |
10 | declare(strict_types=1);
11 |
12 | namespace Qoliber\AttributeOptionPager\Block\Adminhtml\Attribute\Edit\Options;
13 |
14 | class Options extends \Magento\Eav\Block\Adminhtml\Attribute\Edit\Options\Options
15 | {
16 | use PaginationTrait;
17 |
18 | /** @var string */
19 | protected $_template = 'Qoliber_AttributeOptionPager::catalog/product/attribute/options.phtml';
20 | }
21 |
--------------------------------------------------------------------------------
/Block/Adminhtml/Attribute/Edit/Options/PaginationTrait.php:
--------------------------------------------------------------------------------
1 |
5 | *
6 | * @category Qoliber
7 | * @package Qoliber_AttributeOptionPager
8 | */
9 |
10 | declare(strict_types=1);
11 |
12 | namespace Qoliber\AttributeOptionPager\Block\Adminhtml\Attribute\Edit\Options;
13 |
14 | use Magento\Eav\Model\Entity\Attribute\AbstractAttribute;
15 | use Magento\Eav\Model\ResourceModel\Entity\Attribute\Option\Collection;
16 |
17 | trait PaginationTrait
18 | {
19 | /** @var int */
20 | protected static int $defaultPage = 1;
21 |
22 | /** @var int */
23 | protected static int $defaultLimit = 20;
24 |
25 | /** @var int[] */
26 | protected static array $limit = [20, 30, 50, 100, 200];
27 |
28 | /**
29 | * Retrieve option values collection
30 | *
31 | * It is represented by an array in case of system attribute
32 | *
33 | * @param AbstractAttribute $attribute
34 | * @return array|Collection
35 | */
36 | protected function _getOptionValuesCollection(AbstractAttribute $attribute)
37 | {
38 | if ($this->canManageOptionDefaultOnly()) {
39 | return $this->_universalFactory->create(
40 | $attribute->getSourceModel()
41 | )->setAttribute(
42 | $attribute
43 | )->getAllOptions();
44 | } else {
45 | return $this->_attrOptionCollectionFactory->create()->setAttributeFilter(
46 | $attribute->getId()
47 | )->setPositionOrder(
48 | 'asc',
49 | true
50 | )->setPageSize($this->getRequest()->getParam('limit') ?? static::$defaultLimit)
51 | ->setCurPage($this->getRequest()->getParam('page') ?? static::$defaultPage)
52 | ->load();
53 | }
54 | }
55 |
56 | /**
57 | * Preparing values of attribute options
58 | *
59 | * @param AbstractAttribute $attribute
60 | * @param array|Collection $optionCollection
61 | * @return array
62 | */
63 | protected function _prepareOptionValues(
64 | AbstractAttribute $attribute,
65 | $optionCollection
66 | ): array
67 | {
68 | $type = $attribute->getFrontendInput();
69 | if ($type === 'select' || $type === 'multiselect') {
70 | $defaultValues = explode(',', $attribute->getDefaultValue() ?? '');
71 | $inputType = $type === 'select' ? 'radio' : 'checkbox';
72 | } else {
73 | $defaultValues = [];
74 | $inputType = '';
75 | }
76 |
77 | $values = [];
78 | $isSystemAttribute = is_array($optionCollection);
79 | if ($isSystemAttribute) {
80 | $values = $this->getPreparedValues($optionCollection, $isSystemAttribute, $inputType, $defaultValues);
81 | } else {
82 | $optionCollection->setPageSize($this->getRequest()->getParam('limit'));
83 | $values = array_merge(
84 | $values,
85 | $this->getPreparedValues($optionCollection, $isSystemAttribute, $inputType, $defaultValues)
86 | );
87 | }
88 |
89 | return $values;
90 | }
91 |
92 |
93 | /**
94 | * @param array|Collection $optionCollection
95 | * @param bool $isSystemAttribute
96 | * @param string $inputType
97 | * @param array $defaultValues
98 | * @return array
99 | */
100 | private function getPreparedValues(
101 | $optionCollection,
102 | bool $isSystemAttribute,
103 | string $inputType,
104 | array $defaultValues
105 | ): array
106 | {
107 | $values = [];
108 | foreach ($optionCollection as $option) {
109 | $bunch = $isSystemAttribute ? $this->_prepareSystemAttributeOptionValues(
110 | $option,
111 | $inputType,
112 | $defaultValues
113 | ) : $this->_prepareUserDefinedAttributeOptionValues(
114 | $option,
115 | $inputType,
116 | $defaultValues
117 | );
118 | foreach ($bunch as $value) {
119 | $values[] = new \Magento\Framework\DataObject($value);
120 | }
121 | }
122 |
123 | return $values;
124 | }
125 |
126 | /**
127 | * @return array|mixed|null
128 | */
129 | public function getOptionValues()
130 | {
131 | $values = $this->_getData('option_values');
132 | if ($values === null) {
133 | $values = [];
134 |
135 | $attribute = $this->getAttributeObject();
136 | $optionCollection = $this->_getOptionValuesCollection($attribute);
137 | if ($optionCollection) {
138 | $values = $this->_prepareOptionValues($attribute, $optionCollection);
139 | }
140 |
141 | $this->setData('option_values', $values);
142 | }
143 |
144 | return $values;
145 | }
146 |
147 | /**
148 | * @return int
149 | */
150 | public function getCurrentPageNumber(): int
151 | {
152 | if ($this->getRequest()->getParam('page')) {
153 | return (int)$this->getRequest()->getParam('page');
154 | }
155 | return static::$defaultPage;
156 | }
157 |
158 | /**
159 | * @return int
160 | */
161 | public function getCurrentPageSize(): int
162 | {
163 | if ($this->getRequest()->getParam('limit')) {
164 | return (int)$this->getRequest()->getParam('limit');
165 | }
166 | return static::$defaultLimit;
167 | }
168 |
169 | /**
170 | * @return int[]
171 | */
172 | public function getLimits(): array
173 | {
174 | return static::$limit;
175 | }
176 |
177 | /**
178 | * @return int
179 | */
180 | public function getMaxPageCount(): int
181 | {
182 | $attribute = $this->getAttributeObject();
183 | return $this->_attrOptionCollectionFactory->create()->setAttributeFilter(
184 | $attribute->getId()
185 | )->setPageSize($this->getRequest()->getParam('limit') ?? static::$defaultLimit)
186 | ->getLastPageNumber();
187 |
188 | }
189 |
190 | /**
191 | * @param int $limit
192 | * @param int $pageNumber
193 | * @return string
194 | */
195 | public function getNextUrl(int $limit, int $pageNumber): string
196 | {
197 | $requestParams = $this->getRequest()->getParams();
198 | $requestParams['page'] = $pageNumber;
199 | $requestParams['limit'] = $limit;
200 | return $this->getUrl('*/*/*', $requestParams);
201 | }
202 | }
203 |
--------------------------------------------------------------------------------
/Block/Adminhtml/Attribute/Edit/Options/Text.php:
--------------------------------------------------------------------------------
1 |
5 | *
6 | * @category Qoliber
7 | * @package Qoliber_AttributeOptionPager
8 | */
9 | namespace Qoliber\AttributeOptionPager\Block\Adminhtml\Attribute\Edit\Options;
10 |
11 | class Text extends \Magento\Swatches\Block\Adminhtml\Attribute\Edit\Options\Text
12 | {
13 | use PaginationTrait;
14 |
15 | /** @var string */
16 | protected $_template = 'Qoliber_AttributeOptionPager::catalog/product/attribute/text.phtml';
17 | }
18 |
--------------------------------------------------------------------------------
/Block/Adminhtml/Attribute/Edit/Options/Visual.php:
--------------------------------------------------------------------------------
1 |
5 | *
6 | * @category Qoliber
7 | * @package Qoliber_AttributeOptionPager
8 | */
9 | namespace Qoliber\AttributeOptionPager\Block\Adminhtml\Attribute\Edit\Options;
10 |
11 | class Visual extends \Magento\Swatches\Block\Adminhtml\Attribute\Edit\Options\Visual
12 | {
13 | use PaginationTrait;
14 |
15 | /** @var string */
16 | protected $_template = 'Qoliber_AttributeOptionPager::catalog/product/attribute/visual.phtml';
17 | }
18 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Change Log
2 |
3 | ## Version 1.0.6
4 | * fix jump-to-page directly
5 |
6 | ## Version 1.0.5
7 | * add support for text/visual swatches
8 |
9 | ## Version 1.0.4
10 | * Fix requireconfig js load error
11 |
12 | ## Version 1.0.3
13 | * Checking if attribute default value is null, happens with 3rd party attribute import
14 |
15 | ## Version 1.0.2
16 | * adding sort order field to attribute options
17 | * adding CHANGELOG.md file
18 |
19 | ## Version 1.0.1
20 | * code updates
21 |
22 | ## Version 1.0.0
23 | * initial module release
24 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Open Software License v. 3.0 (OSL-3.0)
2 | This Open Software License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work:
3 |
4 | Licensed under the Open Software License version 3.0
5 |
6 | 1) Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following:
7 |
8 | a) to reproduce the Original Work in copies, either alone or as part of a collective work;
9 |
10 | b) to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work;
11 |
12 | c) to distribute or communicate copies of the Original Work and Derivative Works to the public, with the proviso that copies of Original Work or Derivative Works that You distribute or communicate shall be licensed under this Open Software License;
13 |
14 | d) to perform the Original Work publicly; and
15 |
16 | e) to display the Original Work publicly.
17 |
18 | 2) Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works.
19 |
20 | 3) Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work.
21 |
22 | 4) Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license.
23 |
24 | 5) External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c).
25 |
26 | 6) Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work.
27 |
28 | 7) Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer.
29 |
30 | 8) Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation.
31 |
32 | 9) Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including "fair use" or "fair dealing"). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c).
33 |
34 | 10) Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware.
35 |
36 | 11) Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License.
37 |
38 | 12) Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License.
39 |
40 | 13) Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable.
41 |
42 | 14) Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
43 |
44 | 15) Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You.
45 |
46 | 16) Modification of This License. This License is Copyright © 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Open Software License" or "OSL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under " or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process.
47 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | # QOLIBER EXTENSIONS USER LICENSE
2 |
3 | You can view and download the most recent version of these conditions at [qoliber.com/license](https://qoliber.com/license) at any time.
4 |
5 | By using any of our products or purchasing a product from Fiero Group Sp. z o.o. (the "licensor"), operating under the Qoliber brand, you (the "licensee") agree to comply with the following terms and conditions for using this product.
6 |
7 | ## Definitions
8 | * **Product**: Software, scripts, documentation, and other materials produced or supplied by Qoliber Extensions, owned by Fiero Group Sp. z o.o. based in Poland.
9 | * **License Agreement**: Also referred to as convention, agreement, or conditions.
10 | * **End Product**: A (customized) implementation of the product, typically for eCommerce or other public-facing websites, like a single installation on Magento or other platforms.
11 |
12 | ## In Simple Terms
13 | In summary, you need a license for **each** publicly accessible store using our **Product**.
14 |
15 | You **can** purchase it on behalf of your client, charge them, and customize it as needed for their website.
16 |
17 | Our one-off products have a **30-day refund** policy, no questions asked.
18 |
19 | Our **support subscriptions** are non-refundable and billed annually.
20 |
21 | You **cannot** redistribute any portion of the product, either commercially or for free, in any form.
22 |
23 | ## 1. General License Terms
24 |
25 | ### 1.1 License Rights
26 |
27 | 1.1.1 A license grants you, the licensee, ongoing, non-exclusive, worldwide rights to use the selected Qoliber Product.
28 | 1.1.2 By purchasing the software, you agree to the terms and conditions outlined in this agreement, and you commit to using the software strictly according to these terms.
29 | 1.1.3 The agreement is activated once you order the Product, download it from the licensor’s website, from code repositories like GitHub or GitLab, or receive it via email.
30 | 1.1.4 The license gives you the right to use the software in a single End Product or for private use, provided all other terms are met. A separate license must be purchased for each additional platform installation.
31 | 1.1.5 The software can be used on non-production environments for development or testing purposes.
32 | 1.1.6 You are allowed to modify, alter, or create derivative works from the Product. However, any resulting work is subject to the terms of this license, and a new license is required for the resulting End Product.
33 |
34 | ### 1.2 Ownership
35 |
36 | 1.2.1 You can develop one End Product for a client and transfer that single End Product, along with the license, to your client for a fee.
37 | 1.2.2 You cannot sell the End Product to anyone other than a single client, at which point the license is transferred to the client.
38 | 1.2.3 The ownership of a license can only be transferred once, and must be done by notifying us via email with the necessary license and contact information of the new owner.
39 | 1.2.4 Redistribution of the Product as stock, in a tool, as part of a SaaS platform, a template, or with source files is strictly prohibited. You cannot redistribute the Product even with modifications, either for free or commercially.
40 |
41 | > If you plan to use the Product in any way that involves redistribution or resale, please contact us to discuss custom license terms.
42 |
43 | ### 1.3 Refund
44 |
45 | 1.3.1 You may request a full refund within 30 days after the purchase, provided access to the code has been granted.
46 | 1.3.2 Once a refund is processed, you must delete all copies of the Product, and your access to our support systems will be revoked. Support and upgrade subscriptions are non-refundable.
47 |
48 | ### 1.4 Copyright
49 |
50 | 1.4.1 Fiero Group Sp. z o.o. is the copyright holder of the software and its documentation. The software and parts thereof are protected by copyright law. Any breach of these terms will be prosecuted under applicable law.
51 | 1.4.2 Contributions made by third parties to the Product will become part of the Product. The contributor waives any intellectual property rights unless otherwise agreed upon prior to the contribution.
52 | 1.4.3 The licensee must retain all copyright information within the software and documentation unchanged.
53 | 1.4.4 The licensor reserves the right to publicly display a selection of users of the Product.
54 |
55 | ### 1.5 Liabilities
56 |
57 | 1.5.1 The licensor cannot be held responsible for damages, including lost profits or indirect damages, caused by the licensee’s or its agents’ use of the software.
58 | 1.5.2 The licensor will not be held liable for prosecution or damages arising from unlawful use of the Software.
59 |
60 | ### 1.6 Breach and Termination
61 |
62 | 1.6.1 If the licensee fails to comply with the terms of this license agreement, the software license will be revoked.
63 | 1.6.2 Reproduction or distribution of the software without the licensor's permission, even if it is non-commercial, is considered a breach of this agreement and will be prosecuted under applicable laws.
64 | 1.6.3 The licensor reserves the right to modify the license agreement at any time.
65 | 1.6.4 This license agreement remains valid until it is terminated. The licensor can terminate the license if the agreement is breached. The licensee may terminate the agreement by deleting all copies of the software. Continued use of the software is not allowed after termination.
66 | 1.6.5 In the event of a license breach, the licensor will send a termination notice. The licensee agrees to cease use and pay any costs (including legal fees) required to enforce the termination and recover any damages.
67 | 1.6.6 This agreement is governed by Polish law. Any disputes will be exclusively handled by the courts in Poland, excluding other jurisdictions.
68 | 1.6.7 If the licensee continues using the software after termination, they agree to an injunction and payment of all costs to enforce the termination and recover damages.
69 |
70 | ## 2. Qoliber License Terms
71 |
72 | 2.1 A Qoliber License covers a single installation with unlimited storeviews and domains.
73 | 2.2 The license can also be used on unlimited development or staging environments as long as they are related to the same business entity or End Product.
74 | 2.3 At least one domain connected to the production installation must be provided to the licensor.
75 | 2.4 Any changes to the linked domain must be reported to the licensor.
76 | 2.5 A single license cannot cover multiple businesses or legal entities. Systems integrators must buy a separate license for each client.
77 | 2.6 Product updates and support are included with the Qoliber license.
78 |
79 | ## 3. Yearly Support and Upgrade Subscription
80 |
81 | 3.1 The Yearly support is subscription-based.
82 | 3.2 This plan includes access to the support team and software updates for the duration of the subscription.
83 | 3.3 Each subscription lasts for one (1) year.
84 | 3.4 Subscriptions may be canceled at any time, but must be done before the end of the current term.
85 | 3.5 After cancellation, the subscription remains active until the end of the current term, and no refunds are provided.
86 | 3.6 Invoices for renewal are sent one month before the end of the current term. Failure to pay within 28 days will result in suspension of the license.
87 | 3.7 The lifetime license it **not** subscription based
88 |
89 | ## 4. Multi Year Support and Upgrade Package
90 |
91 | 4.1 The Multi Year Support and Upgrade Package is a one-time purchase covering several years of service.
92 | 4.2 It includes access to support and software updates for the duration of the package.
93 | 4.3 Multi Year Support Packages are non-refundable.
94 |
95 | Copyright © Fiero Group Sp. z o.o. 2012-present. All rights reserved.
96 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 
2 | 
3 | 
4 | 
5 | 
6 |
7 | ### Magento 2 Attribute Options Pagination
8 |
9 | Simple Magento 2 module that adds pagination to attribute options in admin panel.
10 |
11 | [](https://freeimage.host/i/5r8Sf9)
12 |
13 | Installation (in your Magento 2 directory):\
14 | **THIS PACKAGE REQUIRES COMPOSER 2.x**
15 | ```bash
16 | composer require qoliber/m2-attribute-pagination --ignore-platform-reqs
17 | ```
18 |
19 | activate the module:
20 | ```bash
21 | php bin/magento module:enable Qoliber_AttributeOptionPager
22 | ```
23 |
24 | And run upgrade command:
25 | ```bash
26 | php bin/magento setup:upgrade
27 | ```
28 |
29 | Module should work out-of-the box
30 |
31 | ### Tested on:
32 | - Magento 2.3.6 Open Source
33 | - Magento 2.3.7 Open Source
34 | - Magento 2.4.2 Open Source
35 | - Magento 2.4.3 Open Source
36 | - Magento 2.4.7 Open Source
37 |
38 | If there are issues / problems, please open an issue within the repository or submit a pull request.
39 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "qoliber/m2-attribute-pagination",
3 | "version": "2.0.1",
4 | "source": {
5 | "type": "git",
6 | "url": "git@github.com:qoliber/m2-attribute-pagination.git",
7 | "reference": "master"
8 | },
9 | "authors": [
10 | {
11 | "name": "qoliber",
12 | "email": "info@qoliber.com"
13 | }
14 | ],
15 | "license": "MIT",
16 | "autoload": {
17 | "files": [
18 | "registration.php"
19 | ],
20 | "psr-4": {
21 | "Qoliber\\AttributeOptionPager\\": ""
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/etc/di.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
14 |
15 |
17 |
18 |
20 |
21 |
--------------------------------------------------------------------------------
/etc/module.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/registration.php:
--------------------------------------------------------------------------------
1 |
5 | *
6 | * @category Qoliber
7 | * @package Qoliber_AttributeOptionPager
8 | */
9 |
10 | use Magento\Framework\Component\ComponentRegistrar;
11 |
12 | ComponentRegistrar::register(
13 | \Magento\Framework\Component\ComponentRegistrar::MODULE,
14 | 'Qoliber_AttributeOptionPager',
15 | __DIR__
16 | );
17 |
18 |
--------------------------------------------------------------------------------
/view/adminhtml/requirejs-config.js:
--------------------------------------------------------------------------------
1 | var config = {
2 | map: {
3 | '*': {
4 | attributeOptionPager: 'Qoliber_AttributeOptionPager/js/pager'
5 | }
6 | }
7 | };
8 |
--------------------------------------------------------------------------------
/view/adminhtml/templates/catalog/product/attribute/options.phtml:
--------------------------------------------------------------------------------
1 |
5 | *
6 | * @category Qoliber
7 | * @package Qoliber_AttributeOptionPager
8 | */
9 |
10 | use Qoliber\AttributeOptionPager\Block\Adminhtml\Attribute\Edit\Options\Options;
11 |
12 | /** @var $block Options */
13 | $stores = $block->getStoresSortedBySortOrder();
14 | ?>
15 |
140 |
--------------------------------------------------------------------------------
/view/adminhtml/templates/catalog/product/attribute/text.phtml:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * @category Qoliber
11 | * @package Qoliber_AttributeOptionPager
12 | */
13 | // phpcs:disable PHPCompatibility.Miscellaneous.RemovedAlternativePHPTags.MaybeASPOpenTagFound
14 | /** @var $block \Qoliber\AttributeOptionPager\Block\Adminhtml\Attribute\Edit\Options\Text */
15 |
16 | $stores = $block->getStoresSortedBySortOrder();
17 | ?>
18 |
141 |
--------------------------------------------------------------------------------
/view/adminhtml/templates/catalog/product/attribute/visual.phtml:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * @category Qoliber
11 | * @package Qoliber_AttributeOptionPager
12 | */
13 | // phpcs:disable PHPCompatibility.Miscellaneous.RemovedAlternativePHPTags.MaybeASPOpenTagFound
14 | /** @var $block \Qoliber\AttributeOptionPager\Block\Adminhtml\Attribute\Edit\Options\Text */
15 |
16 | $stores = $block->getStoresSortedBySortOrder();
17 | ?>
18 |
151 |
--------------------------------------------------------------------------------
/view/adminhtml/web/css/source/_module.less:
--------------------------------------------------------------------------------
1 | .attribute-pager {
2 | margin-bottom: 18px;
3 | }
4 |
--------------------------------------------------------------------------------
/view/adminhtml/web/js/pager.js:
--------------------------------------------------------------------------------
1 | define([
2 | 'jquery'
3 | ], function ($) {
4 | "use strict";
5 | return function (config) {
6 | $(".attribute-pager-limit").on('change', function () {
7 | let option = $(this).find("option:selected");
8 | let redirect = $(option).data('url');
9 | if (redirect !== undefined) {
10 | window.location.href = redirect;
11 | }
12 | });
13 |
14 | $(".attribute-pager-current").on('blur', function () {
15 | let page = $(this).val();
16 | if (page < $(this).attr('min')) {
17 | page = $(this).attr('min');
18 | }
19 | if (page > $(this).attr('max')) {
20 | page = $(this).attr('max');
21 | }
22 | let redirect = $(this).data('url').replace('page/0', 'page/' + page)
23 | if (redirect !== undefined && redirect != window.location.href) {
24 | window.location.href = redirect;
25 | }
26 | });
27 |
28 | $('.attribute-pager-btn').on('click', function() {
29 | let redirect = $(this).data('url');
30 | console.log(redirect);
31 | if (redirect !== undefined) {
32 | window.location.href = redirect;
33 | }
34 | });
35 | };
36 | });
37 |
38 |
--------------------------------------------------------------------------------