Pages

Monday 16 July 2012

Sort by product like featured product, a to z,z to a,lowest price, height price,oldest,newest, at product list page in magento

Please Go at this directory for changing some thing new: template/catalog/product/list/toolbar.phtml:

find code at this location default magento:
.......................................................................
<fieldset class="sort-by">
        <label><?php echo $this->__('Sort by') ?></label>
        <select onchange="setLocation(this.value)">
        <?php foreach($this->getAvailableOrders() as $_key=>$_order): ?>
            <option value="<?php echo $this->getOrderUrl($_key, 'asc') ?>"<?php if($this->isOrderCurrent($_key)): ?> selected="selected"<?php endif; ?>>
                <?php echo $_order ?>
            </option>
        <?php endforeach; ?>
        </select>
        <?php if($this->getCurrentDirection() == 'desc'): ?>
            <a href="<?php echo $this->getOrderUrl(null, 'asc') ?>"><img src="<?php echo $this->getSkinUrl('images/sort_desc_arrow.gif') ?>" alt="<?php echo $this->__('Set Ascending Direction') ?>" class="v-middle" /></a>
        <?php else: ?>
            <a href="<?php echo $this->getOrderUrl(null, 'desc') ?>"><img src="<?php echo $this->getSkinUrl('images/sort_asc_arrow.gif') ?>" alt="<?php echo $this->__('Set Descending Direction') ?>" class="v-middle" /></a>
        <?php endif; ?>
    </fieldset>
......................................................... 
 Replace this code
++++++++++++++++++++++++++++++++++++++++++++++++
<fieldset class="sort-by">
        <label><?php echo $this->__('Sort by') ?></label>
        <select onchange="setLocation(this.value)">
            <option value="<?php echo $this->getOrderUrl('position', 'asc') ?>"<?php if($this->isOrderCurrent('position') && $this->getCurrentDirection() == 'asc'): ?> selected="selected"<?php endif; ?>>
                Featured
            </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>
            <option value="<?php echo $this->getOrderUrl('entity_id', 'desc') ?>"<?php if($this->isOrderCurrent('entity_id') && $this->getCurrentDirection() == 'desc'): ?> selected="selected"<?php endif; ?>>
                Newest to Oldest
            </option>
            <option value="<?php echo $this->getOrderUrl('entity_id', 'asc') ?>"<?php if($this->isOrderCurrent('entity_id') && $this->getCurrentDirection() == 'asc'): ?> selected="selected"<?php endif; ?>>
                Oldest to Newest
            </option>
        </select>
    </fieldset>
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
it will work perfectly i am sure  

No comments:

Post a Comment