Jump to content
  • 0

Wyświetlenie kategorii nadrzędnej na stronie kategorii


314otr

Question

Dzień dobry,

Stworzyłem moduł który wyświetla na stronie kategorii podkategorie i chciałbym rozszerzyć tę funkcjonalność o możliwość wyświetlenia kategorii nadrzędnej.

Posiłkując się znalezionymi na forum wpisami stworzyłem kod:

public function hookDisplayCategoryNavigation($params)
    {
        if (isset($params['current_category']) && !empty($params['current_category']['id_parent'])) {
          $parent_category = new Category ((int) $params['current_category']['id_parent']);
          if (Validate::isLoadedObject($parent_category)) {
                $this->context->smarty->assign(array(
                    "parent_category" => $parent_category,
                    "parent_category_name"   =>  $parent_category->name,
                    "parent_category_description"   => $parent_category->description,
                ));
            }
        }

Niestety nie udało mi się osiągnąć pożądanego efektu.

Podejrzewam, że przyczyna tkwi w:

print_r($category)

zwraca:

Array
(
	[nleft] => 5
	....

natomiast:

print_r($parent_category)

zwraca:

Category Object
(
	[id] => 2
	...

Proszę w skazanie sposobu, aby można było się odwoływać do wartości zmiennej

$parent_category

poprzez:

$parent_category.name

 

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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...