Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Category URL from zen_href_link

Category URL from zen_href_link

Locked

Views: 11,441

Results 1 to 14 of 14
This thread is locked. New replies are disabled.
12 Oct 2007, 1:21 PM
#1
digger149 avatar

digger149

New Zenner

Join Date:
Jun 2007
Posts:
10
Plugin Contributions:
0

Category URL from zen_href_link

Hello,

I am trying to set up a series of footer links on my pages using product and category IDs. I am using zen_href_link() to get the full url from the ID - it works for products, but I cant get it to work for categories. Can anyone tell me what parameters to use in zen_href_link when the only info I have to pass to it is the category ID ?

Many thanks

12 Oct 2007, 1:55 PM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Category URL from zen_href_link

Are these static hard links for the footer?

12 Oct 2007, 3:00 PM
#3
digger149 avatar

digger149

New Zenner

Join Date:
Jun 2007
Posts:
10
Plugin Contributions:
0

Re: Category URL from zen_href_link

Both.
I have set up a database table, foot_links which contains link text, plus either product.id, category.id or fixed url.
In tpl_footer I then read the table and create the url link.
Creating the product url like this
$url = zen_href_link(zen_get_info_page($links->fields['product']) , 'products_id=' . $links->fields['product'] . $product_url_add, 'NONSSL', false);

Works fine, but I cant figure out how to get the category url using this function.

12 Oct 2007, 3:20 PM
#4
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Category URL from zen_href_link

Have a look at includes/functions/functions_categories.php and possibly categories_name

12 Oct 2007, 4:14 PM
#5
digger149 avatar

digger149

New Zenner

Join Date:
Jun 2007
Posts:
10
Plugin Contributions:
0

Re: Category URL from zen_href_link

Many thanks, found the answer. In case anyone is looking and wants to know, the function should be

$url = zen_href_link('index', zen_get_path($links->fields['category']));

22 Jun 2009, 10:03 PM
#6
gezuvor avatar

gezuvor

New Zenner

Join Date:
Apr 2007
Location:
Orange County, CA
Posts:
88
Plugin Contributions:
2

Re: Category URL from zen_href_link

Is it possible to specify a certain category? If I wanted to create a link as above, but have it go directly to cPath=123, how would that be coded?

23 Jun 2009, 1:33 AM
#7
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Category URL from zen_href_link

gezuvor:

If I wanted to create a link as above, but have it go directly to cPath=123, how would that be coded?
use the href="index.php?main_page=index&cPath=123"
This for a relative hard code link

23 Jun 2009, 6:49 AM
#8
gezuvor avatar

gezuvor

New Zenner

Join Date:
Apr 2007
Location:
Orange County, CA
Posts:
88
Plugin Contributions:
2

Re: Category URL from zen_href_link

I am using that now, but it's not smart enough to discern between http and https pages, so the links in my categories sidebox are always http and my header/footer "hard links" are https when accessed from a secure page. I'm trying to use more elegant programming to allow these new links to behaving in a more native ZC fashion...

23 Jun 2009, 9:49 AM
#9
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Category URL from zen_href_link

gezuvor:

the links in my categories sidebox are always http
Exactly as this should be - - one usually does not want to run the catalog as htpps

gezuvor:

my header/footer "hard links" are https when accessed from a secure page
Would have to see this in action

24 Jun 2009, 1:37 PM
#10
gezuvor avatar

gezuvor

New Zenner

Join Date:
Apr 2007
Location:
Orange County, CA
Posts:
88
Plugin Contributions:
2

Re: Category URL from zen_href_link

I will call you with the access information and post the results back here for others...

28 Feb 2010, 6:48 PM
#11
chrismarie avatar

chrismarie

New Zenner

Join Date:
Apr 2009
Location:
Chicago, IL
Posts:
45
Plugin Contributions:
0

Re: Category URL from zen_href_link

I'm having the same issue as gezuvor with a hard coded category link in my footer. My link is written exactly as kobra suggested, but when accessed from secure pages, it's https:// and from non-secure it's http:// like it should be. Did you guys get it sorted?

I'm running 1.3.8a btw, and I'd give you a link to the site, but it's not live yet.

1 Mar 2010, 4:07 AM
#12
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Category URL from zen_href_link

chrismarie,

Start you own thread with what you issue is ad it is not clear from what you posted

18 Mar 2010, 9:04 PM
#13
chrismarie avatar

chrismarie

New Zenner

Join Date:
Apr 2009
Location:
Chicago, IL
Posts:
45
Plugin Contributions:
0

Re: Category URL from zen_href_link

chrismarie:

I'm having the same issue as gezuvor with a hard coded category link in my footer. My link is written exactly as kobra suggested, but when accessed from secure pages, it's https:// and from non-secure it's http:// like it should be. Did you guys get it sorted?

gezuvor:

I am using that now, but it's not smart enough to discern between http and https pages, so the links in my categories sidebox are always http and my header/footer "hard links" are https when accessed from a secure page. I'm trying to use more elegant programming to allow these new links to behaving in a more native ZC fashion...

gezuvor's last post said that he would post the solution if he got it figured out, I was just asking if he had as my problem is the exact same as what he described.

20 Jul 2010, 5:23 PM
#14
chrismarie avatar

chrismarie

New Zenner

Join Date:
Apr 2009
Location:
Chicago, IL
Posts:
45
Plugin Contributions:
0

Re: Category URL from zen_href_link

I stumbled back upon this thread searching for something else and realized that I never posted the solution for a nonssl hard-coded category link:

<?php echo '<a href="' . zen_href_link(FILENAME_DEFAULT, 'cPath=2', 'NONSSL') . '">Link to Category 2</a>'; ?>

I'm sure it's completely obvious, but I hope it helps someone.