Problem with SEF URL of products in main page of VM (no categories in url)

Started by umbcel, February 22, 2026, 17:33:39 PM

Previous topic - Next topic

umbcel

Hi,
I had this problem that was driving me crazy, even though I had followed all the instructions and set up VM correctly.

So I decided to take the hard route, modifying the code and creating an override for the affected file.
I created the override in the HTML folder of my site template (Yootheme Pro 5).

In this folder, I created the following folder and subfolder structure:
  com_virtuemart
         |_____ sublayouts

I then copied the bs5-products.php file from mywebsitepath\\components\com_virtuemart\sublayouts into the newly created sublayouts subfolder.
I then modified the code as follows:

Line 83:
<a title="<?php echo $product->product_name ?>" href="<?php echo JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' $product->virtuemart_product_id '&virtuemart_category_id=' $product->virtuemart_category_id); ?>">
Line 107:
<h2 class="vm-product-title text-center pb-2 mb-0"><?php echo HTMLHelper::link (JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' $product->virtuemart_product_id '&virtuemart_category_id=' $product->virtuemart_category_id), $product->product_name); ?></h2>
Line 124:
<a class="btn btn-secondary w-100 mt-3" href="<?php echo JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' $product->virtuemart_product_id '&virtuemart_category_id=' $product->virtuemart_category_id); ?>" title="<?php echo $product->product_name?>"><?php echo vmText::'COM_VIRTUEMART_PRODUCT_DETAILS' ); ?></a>
I don't know if this is the best way to fix the problem, but everything works perfectly now.

I hope this can help other people who are going crazy with the same problem I had.