File path:
app/design/frontend/<vendor_name>/<theme_name>/Magento_Catalog/templates/product/list/toolbar/sorter.phtml
I want to alter Sorting options as
Name to Alphabets ASC, Alphabets DESC
Price to Price highest First , Price Lowest First
I have tried below solution :
<option value="<?php echo 'name&product_list_dir=asc'; ?>"<?php if($this->isOrderCurrent('name') && $this->getCurrentDirection() == 'asc'): ?> selected="selected"<?php endif; ?>>
<?php echo $block->escapeHtml(__("Alphabetical A-Z")) ?>
</option>
<option value="<?php echo 'name&product_list_dir=desc'; ?>"<?php if($this->isOrderCurrent('name') && $this->getCurrentDirection() == 'desc'): ?> selected="selected"<?php endif; ?>>
<?php echo $block->escapeHtml(__("Alphabetical Z-A")) ?>
</option>
Issue: When ajax is being called URL created like this –
?product_list_order=price%26product_list_dir%3Ddesc` instead of `?product_list_order=price&product_list_dir=desc
Best Answer
Here's My solution which works for me
Path(for theme) : /../app/design/frontend//Magento_Catalog/templates/product/list/toolbar/sorter.phtml
Try it if you have any doubt ask me. Thank you.