ikuzyk
Total Posts: 60
Joined: 2007-08-09
Ternopil, Ukraine
hello Black Cat
class “last” already assigned to menu items
to assign “first” class in your
app / code / core / Mage / Catalog / Block / Navigation . php
in drawItem function replace
public function drawItem ( $category , $level = 0 , $last = false )
with
public function drawItem ( $category , $level = 0 , $first = false , $last = false )
and replace
$htmlChildren .= $this -> drawItem ( $child , $level + 1 , ++ $j >= $cnt );
with
$htmlChildren .= $this -> drawItem ( $child , $level + 1 , $j == 0 , ++ $j >= $cnt );
next after
if ( $last ) { $html .= ' last' ; }
add
if ( $first ) { $html .= ' first' ; }
thats it
hope its help
Signature
while (!success ){ try() ; }
Posted: June 4 2008
| top
| # 1
ecommerce-store
Total Posts: 181
Joined: 2008-04-16
Roma
Please help black cat to resolve, interest mee too.
Signature
- Creazione e personalizzazione Ecommerce Magento
- Hosting ottimizzato per Magento
- Template grafici magento
- Moduli Magento
- Guarda i nostri lavori http://www.ecommerce-store.it/shop/portfolio
_________________________________________________________
http://www.ecommerce-store.it - Hosting - Template e Moduli per Magento
Posted: June 8 2008
| top
| # 3
crius
Total Posts: 623
Joined: 2007-10-16
Denmark
Okay, it’s not beautiful, but this will add first and last classes to level 0 categories in the menu:
In app/design/frontend/default/default/catalog/navigation/top.phtml replace this:
<?php foreach ( $this -> getStoreCategories () as $_category ): ?> <?php echo $this -> drawItem ( $_category ) ?> <?php endforeach ?>
with this:
<?php $_categories = $this -> getStoreCategories (); $i = 1 ; foreach ( $_categories as $_category ) { echo $this -> drawItem ( $_category , 0 , ( $i == $_categories -> count ()), ( $i == 1 )); $i ++; } ?>
In app/code/Mage/Catalog/Block/Navigation.php, add the parameter $first=false to the drawItem function, and in that function, add this just above the code that adds the last class:
if ( $first ) { $html .= ' first' ; }
Signature
Anders Rasmussen | Crius
criuscommerce.com Magento extensions
crius.dk Magento services (in Danish)
Posted: June 9 2008
| top
| # 4
crius
Total Posts: 623
Joined: 2007-10-16
Denmark
Are you sure you have changed:
public function drawItem ( $category , $level = 0 , $last = false )
to
public function drawItem ( $category , $level = 0 , $last = false , $first = false )
and added
if ( $first ) { $html .= ' first' ; }
?
Signature
Anders Rasmussen | Crius
criuscommerce.com Magento extensions
crius.dk Magento services (in Danish)
Posted: June 10 2008
| top
| # 6
crius
Total Posts: 623
Joined: 2007-10-16
Denmark
I don’t understand what you are saying, but you should make sure the order of last, first is correct as shown above.
You can post your code and I will take a look at it.
Signature
Anders Rasmussen | Crius
criuscommerce.com Magento extensions
crius.dk Magento services (in Danish)
Posted: June 10 2008
| top
| # 8
ecommerce-store
Total Posts: 181
Joined: 2008-04-16
Roma
Sorry guys i have do all that Igor and Ander tell us but i have only the “first” link the “last” link don’t appear. No idea?
Signature
- Creazione e personalizzazione Ecommerce Magento
- Hosting ottimizzato per Magento
- Template grafici magento
- Moduli Magento
- Guarda i nostri lavori http://www.ecommerce-store.it/shop/portfolio
_________________________________________________________
http://www.ecommerce-store.it - Hosting - Template e Moduli per Magento
crius
Total Posts: 623
Joined: 2007-10-16
Denmark
I tried putting your files in my installation and it works, so I can’t figure out what the problem is.
We can try to do some debugging on your installation. After the echo line, add this line: echo $i; echo $_categories->count();
Then tell me what menu items and numbers are printed in the browser. You can just post the menu html here.
Signature
Anders Rasmussen | Crius
criuscommerce.com Magento extensions
crius.dk Magento services (in Danish)
Black Cat
Total Posts: 2859
Joined: 2008-02-14
Gonnesa/ Cagliari (Italy)
Here. The class appears “first” but not that “last”
< div class= "header-nav-container" > < div class= "header-nav" > < h4 class= "no-display" > Category Navigation :</ h4 > < ul id = "nav" > < li onmouseover = "toggleMenu(this,1)" onmouseout = "toggleMenu(this,0)" class= "level0 first parent" > < a href = "http://127.0.0.1/magento3/bed-and-bath" >< span > Furniture </ span ></ a > < ul class= "level0" > < li class= "level1" > < a href = "http://127.0.0.1/magento3/bed-and-bath/living-room" >< span > Living Room </ span ></ a > </ li > < li class= "level1 last" > < a href = "http://127.0.0.1/magento3/bed-and-bath/bedroom" >< span > Bedroom </ span ></ a > </ li > </ ul ></ li > 24 < li onmouseover = "toggleMenu(this,1)" onmouseout = "toggleMenu(this,0)" class= "level0 parent" > < a href = "http://127.0.0.1/magento3/electronics" >< span > Electronics </ span ></ a > < ul class= "level0" > < li class= "level1" > < a href = "http://127.0.0.1/magento3/electronics/cellphones" >< span > Cell Phones </ span ></ a > </ li > < li onmouseover = "toggleMenu(this,1)" onmouseout = "toggleMenu(this,0)" class= "level1 parent" > < a href = "http://127.0.0.1/magento3/electronics/digital-cameras" >< span > Cameras </ span ></ a > < ul class= "level1" > < li class= "level2" > < a href = "http://127.0.0.1/magento3/electronics/digital-cameras/accessories" >< span > Accessories </ span ></ a > </ li > < li class= "level2 last" > < a href = "http://127.0.0.1/magento3/electronics/digital-cameras/digital-cameras" >< span > Digital Cameras </ span ></ a > </ li > </ ul ></ li > < li class= "level1 last" > < a href = "http://127.0.0.1/magento3/electronics/laptops" >< span > Laptops </ span ></ a > </ li > </ ul ></ li > 34 < li onmouseover = "toggleMenu(this,1)" onmouseout = "toggleMenu(this,0)" class= "level0 parent" > < a href = "http://127.0.0.1/magento3/apparel" >< span > Apparel </ span ></ a > < ul class= "level0" > < li class= "level1" > < a href = "http://127.0.0.1/magento3/apparel/shirts" >< span > Shirts </ span ></ a > </ li > < li onmouseover = "toggleMenu(this,1)" onmouseout = "toggleMenu(this,0)" class= "level1 parent" > < a href = "http://127.0.0.1/magento3/apparel/shoes" >< span > Shoes </ span ></ a > < ul class= "level1" > < li class= "level2" > < a href = "http://127.0.0.1/magento3/apparel/shoes/mens-s-shoes" >< span > Mens </ span ></ a > </ li > < li class= "level2 last" > < a href = "http://127.0.0.1/magento3/apparel/shoes/women-s-shoes" >< span > Womens </ span ></ a > </ li > </ ul ></ li > < li class= "level1 last" > < a href = "http://127.0.0.1/magento3/apparel/college-hoodies" >< span > Hoodies </ span ></ a > </ li > </ ul ></ li > 4454 </ ul > </ div >
Signature
---- Antonio Carboni ----
Maintainer Traduzione Italiana
Magento Webdesigner e Consulente Magento
E-Commerce Specialist di Magenio Team
Community ITA su Facebook
Autore dei libri Magento Guida al Design e Magento Guida pratica all’uso
crius
Total Posts: 623
Joined: 2007-10-16
Denmark
It seems there’s a problem when you have categories that are not active, but I can’t figure out how to solve it. In your example, there’s 3 categories, but $_categories->count() says 4.
Signature
Anders Rasmussen | Crius
criuscommerce.com Magento extensions
crius.dk Magento services (in Danish)