1

I have a problem with the sort order of the text swatches. I use text swatches for configurable products (clothing with sizes)

On the manage swatch tab of the attribute I have the following options in this order: 92,98,104,110,116,122,128,134,140

in the layered navigation block the swatches show up in the exact order. on my category and product pages the sort order changes. I have one product showing the swatches option like: 134,140,92,98,110,122 and another product shows: 134,92,98,104,140

How is this possible and how can I change this?

0

Looking at an update to the bug noted by Bilal in the comments, it looks like this is a known issue which might be fixed in 2.3:

https://github.com/magento/magento2/issues/7441

  • I think it is fixed in 2.3 (although I'm using 2.3.1). I migrated a 1.8.1 store and the attributes weren't ordered. By opening the attribute (as shown above), changing an order, saving, then re-ordering and saving again, the attributes are sorted and displayed correctly. – PedroKTFC Jun 5 '19 at 10:46
0

You can sort attribute option from backend side, Please check below screenshot

enter image description here

enter image description here

You can see that it is working as excepted. After drag attribu Magento, Please run below command in magento root directory

php bin/magento cache:clean
php bin/magento cache:flush
php bin/magento indexer:reindex
-1

Yo! Yo! Find a Solution!

Open File

vendor/magento/module-configurable-product/Model/ResourceModel/Attribute/OptionSelectBuilder.php

Add Below code on after line no. 93
)->joinInner( ['attribute_option' => $this->attributeResource->getTable('eav_attribute_option')], 'attribute_option.option_id = entity_value.value', [] )->order('attribute_option.sort_order ASC'

enter image description here

Note: You need to set position of swatch in admin

Also see
Swatch Option Not showing ASC order in Magento2

  • minus point! So sad! but it is working fine. i retested it. – Jugal Kishor Nov 20 '19 at 5:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.