News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

GetProduct in my Plugin gives me no SEO friendly url back

Started by Kuubs, June 20, 2024, 12:18:39 PM

Previous topic - Next topic

Kuubs

Hello,

Does anyone know how i can get a friednly SEO url?

$productOrderA = $productModel->getProduct($prodid);
$productModel->addImages([$productOrderA]);

JURI::root() .$productOrderA->link //This gives me index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=30&virtuemart_category_id=3





Hwo can i make it a normal url? so /shop/product-url

Because when I use JRoute::_(JURI::root() .$productOrderA->link), it still gives me the internal url.. Can someone help me?

Jumbo!

SEF URLs can only be generated by calling the function from the Joomla front end. Joomla Admin Router can not generate SEF URLs. Here is a complete solution.

if (JFactory::getApplication()->isClient('site')) {
$url = JRoute::_($productOrderA->link, true, false, true);
} else {
$url = JUri::root() . $productOrderA->link;
}


Ghost

Use JRoute::link('site', $productOrderA->link) to build frontend URLs from backend. But VM does not support this. Removing this line from router.php could fix it:
if (!VmConfig::isSite()) return $segments;Some other changes may be needed.