Jump to content

HOw to Display CATEGORY name?


blietzkrieg

Recommended Posts

Hi Guys! I need help on how to display the current category name on a certain tpl file. I mean im using another module and i want to display the category on top of its block.

On the image i try to put it on top before the CLEAR ALL BUTTON but inside that block. Its not the categories block by the way and its on a different .tpl file thats why i was having problem on what variable i call to display it out.


I hope you could help me on this problem guys.


Thanks.

39285_hAjhkAKb9shVHJAoFthh_t

Link to comment
Share on other sites

look at the code from blockcategories hookLeftColumn:

       $this->currentCategoryId = NULL;
       if (isset($_GET['id_category']))
       {
           $cookie->last_visited_category = intval($_GET['id_category']);
           $this->currentCategoryId = intval($_GET['id_category']);
       }
       if (isset($_GET['id_product']))
       {            
           if (!isset($cookie->last_visited_category) OR !Product::idIsOnCategoryId(intval($_GET['id_product']), array('0' => array('id_category' => $cookie->last_visited_category))))
           {
               $product = new Product(intval($_GET['id_product']));
               if (isset($product) AND Validate::isLoadedObject($product))
                   $cookie->last_visited_category = intval($product->id_category_default);
           }
           $this->currentCategoryId = intval($cookie->last_visited_category);
       }    



if your module is hooked after blockcategories you may use intval($cookie->last_visited_category) for id_category
if before (or you want it to be independent) - use above code.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...