VirtueMart Forum

VirtueMart 2 + 3 => 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!