News:

Looking for documentation? Take a look on our wiki

Main Menu

Have one Category Link to External Website

Started by treodude, August 05, 2015, 12:07:48 PM

Previous topic - Next topic

treodude

Hi Virtuemart,

My boss has the wish to have one Category link to an external website.

I found this topic http://forum.virtuemart.net/index.php?topic=70400.0 which describes the exact same problem however, it is for VM 1.1 .

Does anybody have a solution for this? Or know in what file to look?

Thanks in advance and kind regards,

Treodude
VM 3.0.8
Joomla 3.4.3

balai

Category link pointing to external url is contradicting

You either have to hack the categories module to set your url or use the menus to create an external url menu item

treodude

I'm aware that it is sort of contradicting. I don't mind if I have to hack the module, similar to in the topic I mention. Any idea?

PRO

where do you want the link from?

category module?

category list?


for example CATEGORY MODULE

$caturl = JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id='.$category->virtuemart_category_id);
// i added this
if ($category->virtuemart_category_id ==CATEGORY-ID){$caturl='WWW.THIS-WHERE-TO-GO.COM';}


balai

An alternative to avoid hacking is to create a category for that purpose and use the joomla's redirects to redirect to another url when somebody clicks on it

treodude

This is also a good solution. I created a category 'AircoPompOnline.nl', form which I took the URL and created a redirect. However, the redirect does not kick in when I click on the category.

In the attachement I have the settings. At Source URL / Bron URL, it says: https://edsclassic.nl/index.php?option=com_virtuemart&view=category&virtuemart_category_id=262&Itemid=174

Any ideas what is preventing the redirect from happening?

PRO

redirect will not work unless the link is a 404

treodude

In that case; back to hacking the Category List.

In which file is the Category List created? This can already help tremendously.

PRO


balai

Quote from: treodude on August 07, 2015, 13:50:12 PM
In that case; back to hacking the Category List.

In which file is the Category List created? This can already help tremendously.

Why? There are so many ways to redirect a page
Using mod_rewrite in .htaccess
using a joomla extension
http://extensions.joomla.org/category/site-management/url-redirection

Studio 42

I have a simplier idea not needing any hacks, only redirect.
Use category description and check if this have http for eg. at begin.
YOU can use meta desc, if you prefer, because in all case this get redirect.
if( substr($category->category_description,0,4) === 'http') {
    // code for link ?>
    <a href="<?php echo $category->category_description ?>"><?php echo $category->category_name ?></a>
<?php }

treodude

Hi to all,

First of all, sorry for the time gap (No internet for the past week)

Quote from: balai on August 07, 2015, 17:18:30 PM
Quote from: treodude on August 07, 2015, 13:50:12 PM
In that case; back to hacking the Category List.

In which file is the Category List created? This can already help tremendously.

Why? There are so many ways to redirect a page
Using mod_rewrite in .htaccess
using a joomla extension
http://extensions.joomla.org/category/site-management/url-redirection


Sorry if I wasnt clear enough. I meant that on THIS page https://edsclassic.nl/index.php?option=com_virtuemart&view=virtuemart&productsublayout=0&Itemid=174 the category 'Aircopomponline.nl' should redirect hence it has been clicked on.

Quote from: balai on August 07, 2015, 17:18:30 PM
Quote from: treodude on August 07, 2015, 13:50:12 PM
In that case; back to hacking the Category List.

In which file is the Category List created? This can already help tremendously.

Why? There are so many ways to redirect a page
Using mod_rewrite in .htaccess
using a joomla extension
http://extensions.joomla.org/category/site-management/url-redirection


I tried using native Joomla redirect; no succes
I tried ReDJ; still nothing

.htaccess I am still trying to use, but I have not figured out how.

Quote from: Studio 42 on August 07, 2015, 22:16:49 PM
I have a simplier idea not needing any hacks, only redirect.
Use category description and check if this have http for eg. at begin.
YOU can use meta desc, if you prefer, because in all case this get redirect.
if( substr($category->category_description,0,4) === 'http') {
    // code for link ?>
    <a href="<?php echo $category->category_description ?>"><?php echo $category->category_name ?></a>
<?php }

I have forced SSL, so it should be https. For the rest, I do not know what you are talking about, sorry.

Kind regards

Studio 42

for redirecting inside category:
Use category description and put your link in it.
chekc if the description is a link
If yes then
$app = JFactory::getApplication();
$link =$category->category_description;
$app->redirect($link);

If you need to replace directly and not redirect the link, then my answer before is the right one.

Else check for your internal link to category in .htaccess, and redirect is valid too.

treodude

Quote from: Studio 42 on August 18, 2015, 17:31:58 PM
for redirecting inside category:
Use category description and put your link in it.
chekc if the description is a link
If yes then
$app = JFactory::getApplication();
$link =$category->category_description;
$app->redirect($link);

If you need to replace directly and not redirect the link, then my answer before is the right one.

Else check for your internal link to category in .htaccess, and redirect is valid too.


Where do I need to put the 
$app = JFactory::getApplication();
$link =$category->category_description;
$app->redirect($link);  ???