Sarathlal N

Replace Sort by “Position” text on toolbar to Sort By “Default” – Magento 1

The Magento offer a neat toolbar in Catalog index pages to filter products with various options. In default, there is a sorting option according to varoius product attributes.

We can easily customize this sorting option in Toolbar from back end. We can add or remove product attribute for sorting by defining attribute scope and there visibility.

But Magento add a general sorting option, sort by “Position” in its toolbar. This is a wired setting for Magento newbies like me. But basically this sorting means, we can provide a number (position) for each product in back end and can sort product according to this number from toolbar.

But in my latest Magento customization, my client request to replace this Sort by “Position” with Sort by “Default”. They just want to change that text “Position” with “Default”. That is enough.

So to achieve this change, now we are going to edit core feature of Magento code. So to avoid update issues, first copy Config.php in app\code\core\Mage\Catalog\Model\ to app\code\local\Mage\Catalog\Model\ folder with same Directory structure.

Then replace

$options = array(
 'position' => Mage::helper('catalog')->__('Position')
);

with

$options = array(
 'position' => Mage::helper('catalog')->__('Default')
);

in getAttributeUsedForSortByArray() function.

This will replace text “Position” with “Default” in Sort by section in Magento toolbar.

Looking for a skilled WordPress/WooCommerce developer? I'm currently available for freelance, contract, or full-time remote opportunities! Let's create something amazing together. Send me a quick message, and I'll respond within 24 hours!

Recent Posts

  1. Automating Code Linting with GitHub Actions for WordPress Plugins
  2. Comprehensive Guide to Linting PHP, JavaScript, and CSS in WordPress Plugins Using Composer
  3. The Ultimate Guide to Indexing in Database Design
  4. Understanding 'update_meta_cache' in WordPress - When to Use It, When Not to, and Its Impact on Database Queries
  5. A Guide to Configuring JavaScript and SCSS Paths in WordPress Plugins with @wordpress/scripts

Your Questions / Comments

If you found this article interesting, found errors, or just want to discuss about it, please get in touch.