#StackBounty: #magento-2.1 #sorting #php-7 How to convert Magento 2 Sort By Dropdown to Horizontal List

Bounty: 50

I was trying to Convert Magento 2 Drop down to Horizontal list.

Code Path:

/app/design/frontend/Vendor/Theme/Magento_Catalog/templates/product/list/toolbar/sorter.phtml

Actual Code:

getAvailableOrders() as $_key => $_order): ?> " isOrderCurrent($_key)): ?> selected="selected" > escapeHtml(__($_order)) ?>

What I tried :


Did some research on this and found this LINK

But Couldn’t able to find the Solution. Please help me on this.

Actual Display

Actual Display

Expected Result : On Click Products should sort according to the selection

Expected

Sorter.phtml File

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile

?>
<?php
/**
 * Product list toolbar
 *
 * @var $block MagentoCatalogBlockProductProductListToolbar
 */
use MagentoCatalogModelProductProductListToolbar;
?>
<?php if ($block->getCurrentDirection() == 'desc'): ?> <a title="<?= /* @escapeNotVerified */ __('Set Ascending Direction') ?>" href="#" class="action sorter-action sort-desc" data-role="direction-switcher" data-value="asc"> <span><?= /* @escapeNotVerified */ __('Set Ascending Direction') ?></span> </a> <?php else: ?> <a title="<?= /* @escapeNotVerified */ __('Set Descending Direction') ?>" href="#" class="action sorter-action sort-asc" data-role="direction-switcher" data-value="desc"> <span><?= /* @escapeNotVerified */ __('Set Descending Direction') ?></span> </a> <?php endif; ?> </div>


Get this bounty!!!

Leave a Reply