Jump to content

[question]show category tree like drop down selection box


Afshin
 Share

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 :)

Share this post


Link to post
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

Share this post


Link to post
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 ?

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More