News:

Support the VirtueMart project and become a member

Main Menu

How to get the category-name in the url?

Started by Lockerbie, May 20, 2017, 21:21:19 PM

Previous topic - Next topic

Lockerbie

Hello,

I'm trying to get nice clean urls for the categories in the frontPage of the VM-shop. Since we use CustomFiltersPro, we can't link this directly to the mainmenu, but in a hidden menu, as advised in the CF manual.
The main link to the shop (with the cf-module) is now: https://website.com/toebehoren/onderdelen. (The part 'toebehoren' being just a button without link.)
When a category is chosen in the cf-module, you'll get an url like: https://website.com/zoeken-in-webshop/bonneville-t100
But unfortunate, the category-view-images and links in the shop-FrontPage, didn't lead to the right pages.

So I've been trying to set the right links in template/html/com_virtuemart/sublayouts/categories.php at line 64:
        // Category Link
        $caturl = JRoute::_ ( 'index.php/zoeken-in-webshop?virtuemart_category_id=' . $category->virtuemart_category_id);

This does lead to the right pages, but the urls could be better, I guess. Now I'll get something like: https://website.com/zoeken-in-webshop/toebehoren/onderdelen?virtuemart_category_id=20

Please, can anyone tell me how to get rid of the 'virtuemart_category_id'-part and get the right categoryname instead?

Joomla! 3.7.1 / VM 3.2.2 / CF-Pro 2.5.0

Jumbo!

You should use

$caturl = JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $category->virtuemart_category_id);

Make sure you have menu item for VirtueMart category page. Now enable SEF URL option in Joomla Global Configuration. That's it.

Lockerbie

Thanks for your reply.

The url you suggest is the original one, but because of the structure we use with the Custom Filters, this doesn't lead to the right pages, even when I make menu-items for the categories.
NB: the VM-frontpage shows images of the subcategories, so the urls have to lead to the right subcategorypages.
The JRoute I have right now (see above), leads to these pages, but the urls aren't as nice with the 'virtuemart_category_id=20'-part in it.

xabiperezip