VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: EvanGR on January 08, 2019, 12:25:07 PM

Title: Get current page URL, without the parameters?
Post by: EvanGR on January 08, 2019, 12:25:07 PM
Hello,

I want to get the current page URL, excluding the parameters...
e.g. /mycategory/mysubcategory?param=1
The above, without the bold part.

Reason: I want to create custom page variation links with my own parameters.

I want to do it from the product category view file, if that makes any difference (it shouldn't).

Any ideas?

Thanks
Title: Re: Get current page URL, without the parameters?
Post by: AH on January 08, 2019, 13:16:23 PM
You can use the base joomla methods

https://api.joomla.org/cms-3/classes/Joomla.CMS.Uri.Uri.html#method_base (https://api.joomla.org/cms-3/classes/Joomla.CMS.Uri.Uri.html#method_base)
Title: Re: Get current page URL, without the parameters?
Post by: PRO on January 08, 2019, 22:41:50 PM
$jinput = JFactory::getApplication()->input;
$category=$jinput->getInt('virtuemart_category_id', 0);


$category_url = JRoute::_ ( 'index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $category , FALSE);
Title: Re: Get current page URL, without the parameters?
Post by: EvanGR on January 09, 2019, 08:53:46 AM
Thank you!