Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7550663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:16:17+00:00 2026-05-30T10:16:17+00:00

I’m working on a magento site (Magento ver. 1.5.1.0) – Plese note in answering

  • 0

I’m working on a magento site (Magento ver. 1.5.1.0) – Plese note in answering I am new to Magento.
I am trying to get an option to sort by bestsellers I have managed to do this by adding local files to override the core files as follows:

httpdocs/app/code/local/Mage/Catalog/Block/Product/List/Toolbar.php:

 public function getAvailableOrders()
{
    //return $this->_availableOrder;
    //Custom Order list Edit
    $this->_availableOrder = array(
        'qty_ordered' => $this->__('Best Sellers'),
        'entity_id' => $this->__('Latest arrivals'),
        'name' => $this->__('Name'),
        'price' => $this->__('Price')
    );
    //Custom Available Order -Edit finish
    return $this->_availableOrder;
}

And httpdocs/app/design/frontend/default/localsite/template/catalog/product/list/toolbar.phmtl:

<fieldset class="sort-by">
    <label><?php echo $this->__('Sort by') ?></label>
    <select onchange="setLocation(this.value)">
        <option value="<?php echo $this->getOrderUrl('entity_id', 'desc') ?>"<?php if($this->isOrderCurrent('entity_id') && $this->getCurrentDirection() == 'desc'): ?> selected="selected"<?php endif; ?>>
            Newest Products
        </option>
        <option value="<?php echo $this->getOrderUrl('qty_ordered', 'desc') ?>"<?php if($this->isOrderCurrent('qty_ordered') && $this->getCurrentDirection() == 'desc'): ?> selected="selected"<?php endif; ?>>
            Best Sellers
        </option>
        <option value="<?php echo $this->getOrderUrl('price', 'asc') ?>"<?php if($this->isOrderCurrent('price') && $this->getCurrentDirection() == 'asc'): ?> selected="selected"<?php endif; ?>>
            Lowest Price
        </option>
        <option value="<?php echo $this->getOrderUrl('price', 'desc') ?>"<?php if($this->isOrderCurrent('price') && $this->getCurrentDirection() == 'desc'): ?> selected="selected"<?php endif; ?>>
            Highest Price
        </option>
        <option value="<?php echo $this->getOrderUrl('name', 'asc') ?>"<?php if($this->isOrderCurrent('name') && $this->getCurrentDirection() == 'asc'): ?> selected="selected"<?php endif; ?>>
            Name A-Z
        </option>
        <option value="<?php echo $this->getOrderUrl('name', 'desc') ?>"<?php if($this->isOrderCurrent('name') && $this->getCurrentDirection() == 'desc'): ?> selected="selected"<?php endif; ?>>
            Name Z-A
        </option>
    </select>
</fieldset>

This works in the sense that I now have a bestsellers sort option which sorts in the same way as the bestsellers on the dashboard. Unfortunately the bestsellers section of the dashboard and consequently my sort list is entirely wrong.

Does anyone know how to fix this or failing that does anyone know another attribute I can sort by to achieve the same result – if I go to Dashboard>reports>products>Products Ordered I can get the order I want with a wide date range – any way to recreate this in the sort options.

Is there a list of available sort options out there somewhere?

******************UPDATE*******************

I have now noticed that the products listed in the bestsellers are all older products. The last 100 or so products which have been added are not included in the bestsellers list. These same products are also listed seperately if I sort by a to Z either in the dashboard or using the above sort option so that they go new products A to Z followed by older products A to Z. Any ideas what could be causing this?

Any tips, advice, help much appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T10:16:19+00:00Added an answer on May 30, 2026 at 10:16 am

    Since catalog products don’t have an attribute called qty_ordered, you’ll not have much luck that way. Whatever ordering you’re seeing happen is either a secondary sorting column in action or the natural order coming from the database.

    The backend uses the Mage_Reports module for view counts and the like. The most obvious way of getting to your goal seems to be adding a custom attribute to your products and writing an event observer to update it when sales are made. If you make sure to set “Used for Sorting in Product Listing” it should be available for sorting automagically without having to override any core classes.

    Other than that, the only things I can think of involve a lot of complicated class overrides that would very likely break something on upgrade.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I want use html5's new tag to play a wav file (currently only supported
I have a French site that I want to parse, but am running into
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to select an H1 element which is the second-child in its group
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.