Jump to content

Edit History

tommcmur

tommcmur


updated to include file name

any way to order the categories so that they appear alphabetically?

Figured it out:

in mkd_categories_homepage.php change this code:                     

  $categoryData = array(

                            'id' => $category->id,
                            'name' => $category->name,
                            'url' => $category->getLink(),
                            'imagePath' => _THEME_CAT_DIR_ . $category->getLinkRewrite($category->id, $currentLangCode) . $category->id . '.jpg',                       
                            'description' => $category->description,
                            'productCount' => $productCount
                        );

to this:

                        $categoryData = array(
                            'name' => $category->name,
                            'id' => $category->id,
                            'url' => $category->getLink(),
                            'imagePath' => _THEME_CAT_DIR_ . $category->getLinkRewrite($category->id, $currentLangCode) . $category->id . '.jpg',                       
                            'description' => $category->description,
                            'productCount' => $productCount
                        );

and just before the following code:

       

$this->context->smarty->assign(array(
            'selectedCategories' => isset($selectedCategories) ? $selectedCategories : array(),
            'title' => isset($title) ? $title : '',
            'legend' => isset($legend) ? $legend : '',
        ));

in mkd_categories_homepage.php add

     

  sort($selectedCategories);

This sorts the array alphabetically.
        

tommcmur

tommcmur

any way to order the categories so that they appear alphabetically?

Figured it out:

Change this code:                     

  $categoryData = array(

                            'id' => $category->id,
                            'name' => $category->name,
                            'url' => $category->getLink(),
                            'imagePath' => _THEME_CAT_DIR_ . $category->getLinkRewrite($category->id, $currentLangCode) . $category->id . '.jpg',                       
                            'description' => $category->description,
                            'productCount' => $productCount
                        );

to this:

                        $categoryData = array(
                            'name' => $category->name,
                            'id' => $category->id,
                            'url' => $category->getLink(),
                            'imagePath' => _THEME_CAT_DIR_ . $category->getLinkRewrite($category->id, $currentLangCode) . $category->id . '.jpg',                       
                            'description' => $category->description,
                            'productCount' => $productCount
                        );

and just before the following code:

       

$this->context->smarty->assign(array(
            'selectedCategories' => isset($selectedCategories) ? $selectedCategories : array(),
            'title' => isset($title) ? $title : '',
            'legend' => isset($legend) ? $legend : '',
        ));

in mkd_categories_homepage.php add

     

  sort($selectedCategories);

This sorts the array alphabetically.
        

tommcmur

tommcmur

any way to order the categories so that they appear alphabetically?

×
×
  • Create New...