News:

Looking for documentation? Take a look on our wiki

Main Menu

how can i have a specific url on a product

Started by alex4842, May 10, 2016, 09:22:05 AM

Previous topic - Next topic

alex4842

Hello i would like to ask how is it possible to make a product to have a specific url. I want my products to have the url that i fill in alias only. I don't want  the ? with the category id, to increase the SEO.

franzpeter

You would need to link every product into Joomla menu, so it would use the Joomla routing. But depending on the amount of products is a time consuming procedure and you need to take care if you delete or add a new product in Virtuemart to synchronize your Joomla menu entries.

alex4842

Thank you franzpeter for your reply :) Yes i was thinking of that but as you say it is time consuming because i have too many products. Thank you again for the reply

Ghost

If you want product URLs to only have product alias (e.g. example.com/product-alias), you need this setup:

Make sure SEF is enabled (in Joomla config, VM config and SEF plugin). And rewriting to remove index.php from URL.
Create a homepage menu item with type VirtueMart Category or Frontpage.
In VM SEO settings, disable "Use product link suffix" and "Use full category tree for product links". Be aware that when disabling these options you can't have duplicate product and/or category names because that will cause issues. And that categories will also have flat links as well (e.g. example.com/category/subcategory will turn into example.com/subcategory). If you want full category URLs while using these settings, I can show you a core hack.

betterlead

Hi Ghost.
That would be most interesting, if not to hard to fix.

/Cheers
Live site runs on Joomla 3.9.24 & VM 3.8.6 10373

PHP: 7.3.26

Milbo

betterlead, just play a bit with the options.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Ghost

Quote from: betterlead on June 01, 2016, 12:38:12 PM
Hi Ghost.
That would be most interesting, if not to hard to fix.

/Cheers

If you want to keep full category URLs when using flat product URLs, change this:
if($this->full) {
if($parent_ids = $catModel->getCategoryRecurse($virtuemart_category_id,$catMenuId)){

$parent_ids = array_reverse($parent_ids) ;
}
} else {
$parent_ids[] = $virtuemart_category_id;
}

to this
if($parent_ids = $catModel->getCategoryRecurse($virtuemart_category_id,$catMenuId)){

$parent_ids = array_reverse($parent_ids) ;
}

in router.php.

Milbo

Hmmm but this looks like the $this->full condition is wrong and should be another variable, or? I mean "Use full category tree for product links" should show the categories, even we disable "Use product link suffix"
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/