Jump to content

Categoria prodotto


jesper03

Recommended Posts

Buongiorno a tutti, avrei bisogno di un aiuto riguardo agli id delle categorie.

In sostanza dato un prodotto che supponiamo appartenere alla seguente sequenza di categorie:

Cat1 -> Sub1 -> Sub2 -> Prodotto

Io avrei bisogno di verificare se "Prodotto" appartiene a "Cat1".

Sono riuscito ad arrivare al massimo fino a "Sub2" tramite $product->id_category_default.

Esiste un modo per farlo.

Grazie.

Link to comment
Share on other sites

Ho risolto in questo modo:

Nel file CategoryController.php ho aggiunto nella funzione initContent()

'parent_category_chain' => $this->category->getParentsCategories()
E poi nel file product-list.tpl(o in qualsiasi altro file tpl)con questo loop è possibile controllare tutta la sequenza di categorie a cui appartiene la categoria corrente
{foreach $parent_category_chain as $parent_category_node}
...
{/foreach}
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...