Try the Demo

Magento

eCommerce Software for Online Growth

Magento Forum

Our new hosted solution for small & emerging businesses
   
Here is code to control layered navigation
 
craichead
Jr. Member
 
Total Posts:  28
Joined:  2008-08-28
Greeley, CO
 

freakin’ awesome…

 
Magento Community Magento Community
Magento Community
Magento Community
 
squirrels
Sr. Member
 
Total Posts:  93
Joined:  2008-08-27
 

Thank you very much for the code! Now I have perfectly manageable layered navigations.

One problem though and I’m wondering if anyone else has experienced the same thing…
I have two websites with one store each and then two storeviews per store (for languages). My websites are basically the same but with different pricing and shipping methods, they share the same categories, attributes and products.
Now, the thing is that my layered navigation shows up just like it should on my default website but on my “second” website I can only see a few of the attributes, there seems to be no logic in what’s showing and what is not.
I was thinking that the url to my second website is different and so maybe the path to the attributes are not correct but then I shouldn’t see any attributes at all?! And all other connections are functioning like they should, it’s just the layered navigation that is not showing all it’s got.

This is quite strange (and annoying) - if anyone has any idea as to how I could solve this you would make me very very happy! smile

EDIT: Ok… So after an hour of looking and searching I realize there is a special cash for layered navigation. Ater refreshing that it works just like it should! Now I’m very very happy!  grin

 
Magento Community Magento Community
Magento Community
Magento Community
 
squirrels
Sr. Member
 
Total Posts:  93
Joined:  2008-08-27
 

Thanks again for the code!

Just a thought (from someone not very familiar with php) - would it be possible to change the text on the drop-downs “Please select” when on a certain store view. I would like to have one more language and I’m thinking that it should be doable with an if-sentence or something… But as I said - I’m not too good with these things. smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
Discovery
Enthusiast
 
Total Posts:  767
Joined:  2007-12-29
 

Thanks! Works a treat on .16 and the code is well documented. This should be an extension or part of the distro.

 Signature 

How to ask questions

 
Magento Community Magento Community
Magento Community
Magento Community
 
earthlytreasures
Jr. Member
 
Total Posts:  12
Joined:  2008-10-20
 

This is excellent, just what I was looking for. Do you know how this could be modified slightly so that the headers (e.g. size, colour etc) are given in the dropdown instead, like here:

http://www.bravissimo.com/products/clothing

Thanks smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
itognet
Jr. Member
 
Total Posts:  24
Joined:  2008-08-03
 

How to change “Please select” to something else ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
earthlytreasures
Jr. Member
 
Total Posts:  12
Joined:  2008-10-20
 

Exactly - so that ‘Please Select’ is different for each dropdown, so ‘Size’ or ‘Price’ and so on… ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Reborn Project
Sr. Member
 
Total Posts:  132
Joined:  2008-04-02
 

Display always price by dropdown dont work for me :o( where is my mistake ?

switch ($attributeName{
        
case 'price':
        case 
'Overthreshold':

           
_displayDropdown($this,$displayitemcount);
            break;
    
        default:
            
_displayOrderedlist($this,$displayitemcount);
            break;
    
}

 Signature 

Boutique féerique, fantasy et fantastique
Vente de bougies
bougie parfumée

 
Magento Community Magento Community
Magento Community
Magento Community
 
earthlytreasures
Jr. Member
 
Total Posts:  12
Joined:  2008-10-20
 

Ok, I’ve figured how to change the dropdown menu headers from ‘Please Select’ to something else, like Size, Colour etc…

Perhaps this will be useful for someone else. You need to find the line:

echo ‘<option selected="selected">Please select</option>’;

in filter.phtml and change it to:

echo ‘<option selected="selected">’.$atts->getName().’</option>’;

 
Magento Community Magento Community
Magento Community
Magento Community
 
Sensi
Sr. Member
 
Total Posts:  103
Joined:  2008-07-31
Paris, France
 
Unixversal - 14 October 2008 05:36 PM

Like replace “Please select” with something like this <?php echo $this->__('Please select') ?> and define it in the language file or anything similar...?

echo '<option selected="selected">'.Mage::helper('catalog')->__('Choose option...').'</option>';

 
Magento Community Magento Community
Magento Community
Magento Community
 
Discovery
Enthusiast
 
Total Posts:  767
Joined:  2007-12-29
 

Adding manufacturer logos..

This is a brill script, I had to add brand logos to it. The logos went into /media/catalog/logos and have the same names but with underscores. They is also gifs.

An extra procedure is added:

if(!function_exists("_displayBrands")){
        
function _displayBrands($atts,$displayitemcount){
            
echo '<ol>';
            foreach(
$atts->getItems() as $_item){
                $brand 
$_item->getLabel();
                
$brand str_replace(' ''_',$brand);
                echo 
'<div class="BrandNav"><a href="'.$_item->getUrl().'"><img vertical-align="middle" style="float: left; margin: 0 2px 2px 0;" src="/media/catalog/logos/'.$brand.'.gif"><li>'.$_item->getLabel();
                if(
$displayitemcount){
                    
echo ' ('.$_item->getCount().')';
                
}
                
echo '</a></div></li>';
            
}
            
echo '</ol>';
        
}
    }
The case selector gets an added switch:
case 'Manufacturer':
            
_displayBrands($this,$displayitemcount);
            break;

All works, however, I have not been able to align the logos with the text so they are all on the same center line. I have a single entry in the CSS for the above, ‘BrandNav’:

.BrandNav { clear: both; vertical-align: middle }

Also tried putting some inline code, but no joy in getting the horizontal alignment exactly how I wants it. Will do for the job in hand, but can some CSS wizz do it right?

 Signature 

How to ask questions

 
Magento Community Magento Community
Magento Community
Magento Community
 
thomasmore
Sr. Member
 
Total Posts:  80
Joined:  2008-10-21
 

Does anyone know how to style the drop down with css?

 
Magento Community Magento Community
Magento Community
Magento Community
 
JesperDK
Sr. Member
 
Avatar
Total Posts:  80
Joined:  2007-09-04
Denmark
 
earthlytreasures - 27 October 2008 02:43 AM

Ok, I’ve figured how to change the dropdown menu headers from ‘Please Select’ to something else, like Size, Colour etc…

Perhaps this will be useful for someone else. You need to find the line:

echo ‘<option selected="selected">Please select</option>’;

in filter.phtml and change it to:

echo ‘<option selected="selected">’.$atts->getName().’</option>’;

Hey,

Wondering if it would be possible to shoe the Label of the attribute instead of the Name? The Name is used at the backend, so it’s not necessarily the same we’d use in Front-end (especially not with more than one language). I’ve found $this->__($_filter->getName()) in view.phtml, but I’m not able to use that reference in filter.phtml.

Anyone able to help? smile

- Jesper

 
Magento Community Magento Community
Magento Community
Magento Community
 
Radi
Member
 
Total Posts:  38
Joined:  2008-07-24
 

Great post!

Where I can change the width from the pull down menu?

Thanks for the answer.

Radi

 
Magento Community Magento Community
Magento Community
Magento Community
 
thomasmore
Sr. Member
 
Total Posts:  80
Joined:  2008-10-21
 
Radi - 19 November 2008 03:09 AM

Great post!

Where I can change the width from the pull down menu?

Thanks for the answer.

Radi

THat’s what I’d want to know too. Anyone?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
 
© Copyright 2012 Magento Inc.
Privacy Policy|Terms of Service
Magento Community Count
701238 users|856 users currently online|497293 forum posts