i have a problem with the sorting by price in my website http://makemydrink.com/. Since their are many configurable products and simple products, i'm facing a problem in sorting.So i'll be gratefull if somebody helps me.

This is my toolbar.phtml code:

<div class="sort-by">
            <div class="sort-by toolbar-switch">
                <div class="toolbar-title">
                    <label><?php echo $this->__('Sort By') ?></label>            
                    <select onchange="setLocation(this.value)" class="sortby" name="sortby">                          
                    <option value="<?php echo $this->getOrderUrl('price', 'asc') ?>"<?php if($this->isOrderCurrent('price') && $this->getCurrentDirection()=='asc' ): ?> selected="selected"<?php endif; ?>>Price                       </option>               
                <?php if($this->getCurrentDirection() == 'asc'): ?>
                    <a href="<?php echo $this->getOrderUrl('price', 'asc') ?>" title="<?php echo $this->__('Set Ascending Direction') ?>"><img src="<?php echo $this->getSkinUrl('images/i_desc_arrow.gif') ?>" alt="<?php echo $this->__('Set Ascending Direction') ?>" class="v-middle" /></a>
                <?php else: ?>
                    <a href="<?php echo $this->getOrderUrl('price', 'desc') ?>" title="<?php echo $this->__('Set Descending Direction') ?>"><img src="<?php echo $this->getSkinUrl('images/i_asc_arrow.gif') ?>" alt="<?php echo $this->__('Set Descending Direction') ?>" class="v-middle" /></a>
                <?php endif; ?>

and i also edited toolbar.php as

$this->_availableOrder = array('price'=>__('Price'));

1 Answer 1


I see that most of your configurable products (probably all of them - I didn't check) have the base price (the price when an option is not selected) set to 0.00.
The price is increased only when you select an option.
The sorting for the product list is done on the base price for configurable products.
Since all your products have the same price, there is no way to predict what the actual order is going to be, but the chance of having them in the order determined by the default selected value is almost 0.
If you want to keep this current approach (with a default option selected) I think you should modify the way the price index is built to take into account your default option.

Let's take this product for example. If you select from the Drink Size option Choose an Option you will see that the price changes to 0.00. This means that the base price you set for the configurable product is 0. Only after selecting an option the price changes.
When listing the products and sorting by price, the price that is taken into consideration for the sorting is the base price for configurable products. Again, in your case is 0. So when calling order by price, because all products have the same price there is no way to predict how the list will be sorted. This may depend from a MySQL version to an other.
To overcome this, you can either set a base price to the configurable products or change the way that the price indexer works to take into consideration your default selected Drink Size.
I hope I was a little bit clearer now.

  • I didn't understand marius....
    – user4391
    Feb 4, 2014 at 10:51
  • @user4391. See my update. It was too long to fit in a comment.
    – Marius
    Feb 4, 2014 at 11:18
  • maurius, what i mean is, makemydrink.com/whisky.html here u can see that i am using only one option 'sort by price'. and this is not working.
    – user4391
    Feb 5, 2014 at 11:41
  • @user4391. I just explained (twice) why is not working. I don't have other words to explain it.
    – Marius
    Feb 5, 2014 at 12:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.