Author Topic: Browser Page Title for Top Level Category  (Read 2406 times)

ZoBabe

  • Beginner
  • *
  • Posts: 32
Browser Page Title for Top Level Category
« 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

thePHPfactory

  • Beginner
  • *
  • Posts: 7
    • thePHPfactory - Joomla Extensions and Modules
Re: Browser Page Title for Top Level Category
« Reply #1 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:
Code: [Select]
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

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10070
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Browser Page Title for Top Level Category
« Reply #2 on: January 04, 2016, 15:16:52 pm »
This is added and available in the svn and in the membership version (early access)
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/