VirtueMart Forum

VirtueMart 2 + 3 + 4 => Security (https) / Performance / SEO, SEF, URLs => Topic started by: ZoBabe on April 23, 2015, 07:03:03 AM

Title: Browser Page Title for Top Level Category
Post by: ZoBabe on April 23, 2015, 07:03:03 AM
Though most categories work OK by using the Meta Title setting in the VirtueMart Product Categoies, the top level category, to list all categories (Category ID 0, I guess) has no interface for that. The menu link only seems to want to show whatever the actual name of the link is in the Joomla menu, and completely ignores the Meta Title setting.
  I was unable to find a satisfactory answer for this in the forums, so I'll just post my annoying spit-and-duct-tape solution for now. I do hope a more elegant answer presents itself, so please post if you know!

VM: 3.0.8
Joomla: 3.4.1

\components\com_virtuemart\views\category\view.html.php

at approximately line 279

         $title = $this->setTitleByJMenu($app);

Replace with:
         $title = 'Whatever you actually would like your top category level browser page title to be';

This will get overwritten by updates, so keep an eye on it.
  Better suggestions greatly appreciated!
  Z
Title: Re: Browser Page Title for Top Level Category
Post by: thePHPfactory on December 28, 2015, 13:53:50 PM
The problem still remains. This should be fixed in the product (since any update will delete any modifications we do)

The solution is to take into account the Page title we set in the Menu Item

The way to do this is:

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

$title = 'VirtueMart Category View';
iif ($menu) $title = ($menu->params->get('page_title',''))?$menu->params->get('page_title',''):$menu->title;
// $title = $this->params->get('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;
}

Title: Re: Browser Page Title for Top Level Category
Post by: Milbo on January 04, 2016, 15:16:52 PM
This is added and available in the svn and in the membership version (early access)