Untitled
unknown
plain_text
a year ago
2.7 kB
4
Indexable
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ // @codingStandardsIgnoreFile ?> <?php /** * Product list toolbar * * @var $block \Magento\Catalog\Block\Product\ProductList\Toolbar */ use Magento\Catalog\Model\Product\ProductList\Toolbar; ?> <div class="position-relative text-right toolbar-sorter sorter w-100"> <div class="w-100 text-uppercase sort_item"> <?= /* @escapeNotVerified */ __('Sort By : ') ?> <select class="sorter-options" id="sortBy"> <?php foreach ($block->getAvailableOrders() as $_key => $_order): ?> <?php if($_key=="salediscount"){ ?> <option value="<?php echo $block->getPagerUrl(array('product_list_order'=>'salediscount', 'product_list_dir'=>'desc')) ?>"<?php if($block->isOrderCurrent($_key) && $block->getCurrentDirection() == 'desc'): ?> selected="selected"<?php endif; ?>>Discount</option> <?php } elseif($_key=="price"){ ?> <option value="<?php echo $block->getPagerUrl(array('product_list_order'=>'price', 'product_list_dir'=>'desc')) ?>"<?php if($block->isOrderCurrent($_key) && $block->getCurrentDirection() == 'desc'): ?> selected="selected"<?php endif; ?>>Price - High to Low</option> <option value="<?php echo $block->getPagerUrl(array('product_list_order'=>'price', 'product_list_dir'=>'asc')) ?>"<?php if($block->isOrderCurrent($_key) && $block->getCurrentDirection() == 'asc'): ?> selected="selected"<?php endif; ?>>Price - Low to High</option> <?php } else {?> <option value="<?php echo $block->getPagerUrl(array('product_list_order'=>$_key)) ?>" <?php if ($block->isOrderCurrent($_key)): ?> selected="selected" <?php endif; ?> > <?= ($_key=='position' ? 'Bestseller' : $block->escapeHtml(__($_order))) ?> </option> <?php } endforeach; ?> </select> <div class="no-display"> <?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> <script type="text/javascript"> require(["jquery"],function($) { $( "#sortBy" ).change(function() { var url=""; $( "#sortBy option:selected" ).each(function() { url = $( this ).val(); }); window.location.href = url; });}); </script> </div> </div>
Editor is loading...
Leave a Comment