Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Categories links linking to other pages that just a category


rickard_l

Recommended Posts

Hi is it possible to make the links that one can create in the Category side of the site go elsewhere instead of just to that specific Category...

 

I mean, this is what OSc creates when I made a link

www.example.com/index.php?cPath=35

 

Instead can i make it go to...

 

www.example.com/somepage.php

 

??

Link to comment
Share on other sites

Use a url rewrite rule in .htaccess file ?

I am thinking it might have something to do with the index.php but I don't know. I am just guessing.

 

What is an url rewrite rule?

Link to comment
Share on other sites

Yes, it is possible. One method is to edit the includes/boxes/categories.php file, trap the id for the category you want to change and use a different url for it. This works fine but if the category id's change, it will cause the code to fail unless it is changed again. The code would be something like the following, where 46 is the category id you want to link elsewhere

	if ($counter == '46')
  $categories_string .= tep_href_link(FILENAME_SOME_OTHER_PAGE) . '">';
else
  $categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">';

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Thank you very much Jack. :)

I added it around line 57, I have great categories so mine is a little modified).As I was linking externally I removed the tep_href_link and my final code look like this-

if ($counter == '65')

$categories_string .= ("http://www.externalsite.com/catalog") . '">';

else

$categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">';

/*$categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new);

$categories_string .= '">';*/

 

thanks again, I would not have gotten it without your help.

Link to comment
Share on other sites

Hi,

using this code

 

if ($counter == '65')

$categories_string .= ("http://www.externalsite.com/catalog") . '">';

else

$categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">';

 

is it possible to added a 2nd and different external link?

 

I have tried to repeat it but without success.

 

Basically this is what I would like to happen

counter ==65 goes to url external 1

and counter ==40 goes to url external 2

 

thanks for any help that can be given.

Link to comment
Share on other sites

is it possible to added a 2nd and different external link?

 

try something like

 

f ($counter == '65')
 $categories_string .= ("http://www.externalsite.com/catalog") . '">';
else if ($counter == 'xx')
 $categories_string .= 'http://  .... ">';
else if ($counter == 'yy')
 $categories_stirng .= 'http:// ... ">';
else
$categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">';

 

and just repeat the 'else if' structure as often as you need.

Link to comment
Share on other sites

thank you that worked :)

 

if ($counter == '65')

$categories_string .= ("http://www.externalsite.com/catalog") . '">';

else if ($counter == 'xx')

$categories_string .= ("http://www.externalsite2.com/catalog") . '">';

else if ($counter == 'yy')

$categories_string .= ("http://www.externalsite3.com/catalog") . '">';

else

$categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">';

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...