1

I am working on catalog search but on result page price filter in not working I have used following code on filter.phtml

<ol>

    <?php foreach ($this->getItems() as $_item): ?>

        <li>

            <?php if (($_item->getCount() > 0) && (strpos($_SERVER['REQUEST_URI'],'catalogsearch') === false)): ?>

            <a href="<?php echo $this->urlEscape($_item->getUrl()) ?>"><?php echo $_item->getLabel() ?></a>

            <?php 



            elseif(strpos($_SERVER['REQUEST_URI'],'catalogsearch') == true): //afegitó 

                $category = Mage::getResourceModel('catalog/category_collection')->addFieldToFilter('name', $_item->getLabel());

                $cat_det=$category->getData();

                $category_id=$cat_det[0][entity_id];



            ?>

            <a href="<?php echo $_SERVER['REQUEST_URI']?>&cat=<?php echo $category_id ?>"><?php echo $_item->getLabel() //afegitó ?></a>

            <?php else: echo $_item->getLabel() ?>

            <?php endif; ?>

            (<?php echo $_item->getCount() ?>)

        </li>

    <?php endforeach ?>

    </ol>

And result is showing like this enter image description here

Please anyone provide me solution..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.