Jump to content

[question]show category tree like drop down selection box


Afshin

Recommended Posts

hi . I want to show categories like dropdown box in prestashop module or template frontend ..

I used this code but it doesn't work correctly .

echo '           
'.$this->l('Select category:').'

';
       $categories = Category::getCategories(intval($cookie->id_lang), false);
       Category::recurseCategory($categories, $categories[0][1], 1, ($this->getFieldValue($obj, 'id_category_default') ? $this->getFieldValue($obj, 'id_category_default') : Tools::getValue('id_category', 1)));
       echo '            





how can I do this ?

thanks :)

Link to comment
Share on other sites

anybody don't know ? i want show prestashop categories in backend module , like product backend page ... adminproduct .. select between categories with select box .. ... but only i can show subcategories of home category .. not all of subcategories l. help me please

Link to comment
Share on other sites

hi , I also check this :

$depth = 1; // when depth =1 it works

/* Construct categories tree */
    $categTree = Category::getRootCategory()->recurseLiteCategTree(intval($depth));



when $depth =1; it works but it does not work when depth is more than 1 .

why ? how can I get all categories and sub categories ?

Link to comment
Share on other sites

  • 8 months later...

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