News:

Support the VirtueMart project and become a member

Main Menu

Browser Page Title for Top Level Category

Started by ZoBabe, April 23, 2015, 07:03:03 AM

Previous topic - Next topic

ZoBabe

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

thePHPfactory

#1
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;
}

http://thephpfactory.com
Home of Auctions Factory, Love Factory and many other Joomla! Extensions

Milbo

This is added and available in the svn and in the membership version (early access)
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/