VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: treodude on August 05, 2015, 12:07:48 PM

Title: Have one Category Link to External Website
Post by: treodude on August 05, 2015, 12:07:48 PM
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
Title: Re: Have one Category Link to External Website
Post by: balai on August 05, 2015, 12:18:40 PM
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
Title: Re: Have one Category Link to External Website
Post by: treodude on August 05, 2015, 15:00:17 PM
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?
Title: Re: Have one Category Link to External Website
Post by: PRO on August 05, 2015, 15:14:17 PM
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';}
Title: Re: Have one Category Link to External Website
Post by: treodude on August 07, 2015, 10:05:55 AM
I would like the link to come from the category list. I.e. from this page https://www.edsclassic.nl/index.php?option=com_virtuemart&view=virtuemart&productsublayout=0&Itemid=174
Title: Re: Have one Category Link to External Website
Post by: balai on August 07, 2015, 10:17:49 AM
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
Title: Re: Have one Category Link to External Website
Post by: treodude on August 07, 2015, 12:08:31 PM
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?
Title: Re: Have one Category Link to External Website
Post by: PRO on August 07, 2015, 13:17:56 PM
redirect will not work unless the link is a 404
Title: Re: Have one Category Link to External Website
Post by: 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.
Title: Re: Have one Category Link to External Website
Post by: PRO on August 07, 2015, 16:23:45 PM
WHICH CATEGORY LIST? FROM WHERE? WHAT PAGE?

http://forum.virtuemart.net/index.php?topic=130985.msg451441#msg451441
Title: Re: Have one Category Link to External Website
Post by: 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
Title: Re: Have one Category Link to External Website
Post by: 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 }
Title: Re: Have one Category Link to External Website
Post by: treodude on August 18, 2015, 12:11:14 PM
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
Title: Re: Have one Category Link to External Website
Post by: 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.
Title: Re: Have one Category Link to External Website
Post by: treodude on August 20, 2015, 13:30:43 PM
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);  ???
Title: Re: Have one Category Link to External Website
Post by: treodude on August 20, 2015, 14:09:35 PM
I Got The Solution!

I used .htaccess in the end, with coding as;

RewriteEngine on
RewriteCond %{QUERY_STRING} virtuemart_category_id=262
RewriteRule (.*) https://www.aircopomponline.nl? [R=301,L]

virtuemart_category_id=262 relates to the category that is to be the link
https://www.aircopomponline.nl? is the target URL, the ? strips off the whole query (If not, you would go to the category on this site with VM ID 262)

Thanks for all the support, consider this one solved!

Kind regards

Treodude
Title: Re: Have one Category Link to External Website
Post by: balai on August 21, 2015, 09:33:30 AM
This is like trying to go to US from Europe through China.
Plz ask someone on how to do a simple redirect. It is a quite easy and basic process
Title: Re: Have one Category Link to External Website
Post by: Studio 42 on August 21, 2015, 15:47:14 PM
Hi,
I think, we should apply penality, when a user don't try a solution :)
Title: Re: Have one Category Link to External Website
Post by: Bald0921 on August 24, 2015, 11:08:36 AM
You have to crack the class module to configure your web site or use the menu to create external links menu item.
Samsung Galaxy S6 cover (http://www.casesam.co.uk/product-slimline-gel-protection-case-for-samsung-galaxy-s6-56.html)
Samsung Galaxy S6 case (http://www.casesam.co.uk/product-eiffel-tower-protective-shell-for-samsung-galaxy-s6-52.html)