Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * @category design_default
- * @package Mage
- * @copyright Copyright (c) 2004-2007 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- *
- */
- /**
- * Template for filter items block
- * Coded by Adam Martin (www.tweakmag.com)
- *
- *
- * @see Mage_Catalog_Block_Layer_Filter
- */
- ?>
- <?php
- //control the way that the layered navigation attributes present themselves
- //either dropdown list or default methd (ordered list)
- $attributeName = $this->getName();
- $itemcountthreshold = 0; // you can change this
- $itemcount = $this->getItemsCount();
- $displayitemcount = false; //set to true/false to display item count in brackets
- /*if($itemcount > $itemcountthreshold){
- $attributeName = "Overthreshold";
- }*/
- if($itemcount > $itemcountthreshold && !($attributeName == 'Category')){
- $attributeName = 'Overthreshold';
- }
- if(!function_exists("_displayOrderedlist")){
- function _displayOrderedlist($atts,$displayitemcount){
- echo '<ol>';
- foreach($atts->getItems() as $_item){
- //echo '<li><a href="'.$_item->getUrl().'">'.$_item->getLabel().'</a>';
- echo '<li class="filter-category-list"><a href="'.$_item->getUrl().'">'.$_item->getLabel().'</a>';
- if($displayitemcount){
- echo ' ('.$_item->getCount().')';
- }
- echo '</li>';
- }
- echo '</ol>';
- }
- }
- if(!function_exists("_displayDropdown")){
- function _displayDropdown($atts,$displayitemcount){
- echo '<select id="layered-select" class="select" name="layered-select" onchange="if (this.selectedIndex > 0) location.href=this[this.selectedIndex].value;">';
- //echo '<option selected="selected">Select</option>';
- /* Home page filters */
- /* If current url == Home page, redirect active filters to the all-products page with current filters still active */
- if ($_SERVER['REQUEST_URI'] == '/') {
- echo '<option selected="selected">By ' .Mage::helper('catalog')->__($atts->getName()). '</option>'; // Print attribute name instead of "select"
- echo '<option value=""> ---------- </option>'; // Adding separator
- foreach ($atts->getItems() as $_item) { ?>
- <option value="/all-products.html?
- <?php
- echo $_item->getFilter()->getAttributeModel()->getAttributeCode(); // Getting attribute code (name identifier)
- echo '=';
- echo $_item->getValueString(); // Getting attribute value number
- ?>
- ">
- <?php
- echo $_item->getLabel();
- if($displayitemcount){
- echo ' ('.$_item->getCount().')';
- }
- echo '</option>';
- }
- } else {
- /* End home page filters */
- /* Filters on category pages */
- echo '<option selected="selected">By ' .Mage::helper('catalog')->__($atts->getName()). '</option>'; // Print attribute name instead of static "select"
- echo '<option value=""> ---------- </option>'; // Adding separator
- foreach ($atts->getItems() as $_item){
- echo '<option value="'.$_item->getUrl().'">';
- echo $_item->getLabel();
- if($displayitemcount){
- echo ' ('.$_item->getCount().')';
- }
- echo '</option>';
- }
- /* End category page filters */
- }
- echo '</select>';
- }
- }
- switch ($attributeName) {
- case 'Shoe Size':
- case 'Overthreshold':
- _displayDropdown($this,$displayitemcount);
- break;
- default:
- _displayOrderedlist($this,$displayitemcount);
- break;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement