Add to Menu

Use VirtueMart product name as menu item title

4 months 6 days ago #78063

Toni56's Avatar Toni56

When I add an article to menu, the plugin uses the title of the article as the title of the menu item, but not with VirtueMart. Could you please extend the functionality to use the product name/alias as menu item title/alias?

4 months 6 days ago #78064

Peter van Westen's Avatar Peter van Westen Admin

This should already work. What version of Joomla and VM are you running?

4 months 5 days ago #78065

Toni56's Avatar Toni56

Peter van Westen wrote:

This should already work. What version of Joomla and VM are you running?

Joomla 3.8.5 + VirtueMart 3.2.4
Joomla 3.8.5 + VirtueMart 3.2.12

Confidential information:
(hidden)

4 months 5 days ago #78070

Peter van Westen's Avatar Peter van Westen Admin

Yes, this only works with the English database.
This is because of the stupid way VM has structured it's databases, making it near impossible to make this work as a dynamic solution.

There are no plans to change this.

4 months 5 days ago #78074

Toni56's Avatar Toni56

Peter van Westen wrote:

Yes, this only works with the English database.
This is because of the stupid way VM has structured it's databases, making it near impossible to make this work as a dynamic solution.

There are no plans to change this.

You're right. It's hard because it's in the XML but in PHP you can get the current VM language easily.
Maybe a simple change of the language suffix would do the trick
if (isset($template->dbselect->table))
		{
			if($template->urlparams->option=='com_virtuemart')
			{
				if (!class_exists( 'VmConfig' )) require(JPATH_ADMINISTRATOR .'/components/com_virtuemart/helpers/config.php');
				$vmconfig = VmConfig::loadConfig();
				$vmlang = $vmconfig::$vmlang;
				if($vmlang != 'en_gb') $template->dbselect->table = preg_replace('/en_gb$/', $vmlang, $template->dbselect->table);
			}

I don't want push it too hard, it's just a notice for non-english users :)
Have a nice day

4 months 5 days ago #78076

Peter van Westen's Avatar Peter van Westen Admin

Yes, I know how to get the current language table. But that requires messing around in php.
Add to Menu is set up in a way that support for components (and there views) is controlled via the xml files.
Want support for an extra extension? Just create a new xml file for it.

For the multi-language support for VM, I'd have to make specific exceptions only for VM, and dirty up the whole process.
That might be something I would be tempted to do for extensions that are stable, good and honour the Joomla approach of doing things.
But not for an extension like VM (read: not a fan).

4 months 5 days ago #78087

Toni56's Avatar Toni56

Peter van Westen wrote:

Yes, I know how to get the current language table. But that requires messing around in php.
Add to Menu is set up in a way that support for components (and there views) is controlled via the xml files.
Want support for an extra extension? Just create a new xml file for it.

For the multi-language support for VM, I'd have to make specific exceptions only for VM, and dirty up the whole process.
That might be something I would be tempted to do for extensions that are stable, good and honour the Joomla approach of doing things.
But not for an extension like VM (read: not a fan).

:) understood