Author Topic: How to get the category-name in the url?  (Read 360 times)

Lockerbie

  • Jr. Member
  • **
  • Posts: 102
How to get the category-name in the url?
« on: May 20, 2017, 21:21:19 pm »
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:
Code: [Select]
        // 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!

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 572
  • Software Developer {PHP, JavaScript, jQuery, ...}
    • www.virtueplanet.com
  • VirtueMart Version: 3.2.2
Re: How to get the category-name in the url?
« Reply #1 on: May 22, 2017, 11:47:45 am »
You should use

Code: [Select]
$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

  • Jr. Member
  • **
  • Posts: 102
Re: How to get the category-name in the url?
« Reply #2 on: May 22, 2017, 20:40:15 pm »
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

  • Beginner
  • *
  • Posts: 1
  • A beginner
    • tarifas jazztel adsl fijo y movil
  • Skype Name: xabiperez
Re: How to get the category-name in the url?
« Reply #3 on: May 25, 2017, 13:51:28 pm »
Thanks i was looking for that