News:

Support the VirtueMart project and become a member

Main Menu

view Category Improvement for menu title SEO

Started by Digi-web, April 28, 2015, 11:23:05 AM

Previous topic - Next topic

Digi-web

Hello,
There are many people who wish to have a title in the menu item of a category menu while displaying all the categories.
Without setting a specific category right now the title is not set ( if a category is selected it is).

Note: this fix is about displaying the title in the Page Display -> Browser Page Title

I have modified the code in the com_virtuemart/views/category/view.html.php

public function setTitleByJMenu($app){
      $menus   = $app->getMenu();
      $menu  = $menus->getActive();

      $title = 'VirtueMart Category View';
      if ($menu) $title = $menu->title;
      
      //added
      if( !empty($menu) ){
         
         $menu_params =json_decode($menu->params);
         if($menu_params->page_title){
            $title = $menu_params->page_title;
         }
      }

      // Check for empty title and add site name if param is set
      if (empty($title)) {
         $title = $app->getCfg('sitename');
      }
      elseif ($app->getCfg('sitename_pagetitles', 0) == 1) {
         $title = vmText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title);
      }
      elseif ($app->getCfg('sitename_pagetitles', 0) == 2) {
         $title = vmText::sprintf('JPAGETITLE', $title, $app->getCfg('sitename'));
      }

      return $title;
   }

Finally i believe this fix should be implemented on setTitleByJMenu not mater what programming concept was based because the menu title override should be above all other settings in a menu.
Custom Joomla - Virtuemart Development and Templates
Website: http://www.digi-web.gr

Milbo

Could it be that the
if ($menu) $title = $menu->title;

does not work anylonger in j3?
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Digi-web

#2
Hello i forgot to mention the title is about the Browser Page Title in page display card.

So to recap:
a)  the title of the menu works, if i have a menu that is called main the title will be "main - website name"
b) if i would put a browser page title a custom title "my new title" without the fix it would still be "main - website name" and with the fix it would be "my new title - website name" REGARDLESS if i have chosen a category in the menu module or not.
Custom Joomla - Virtuemart Development and Templates
Website: http://www.digi-web.gr