Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How can I create a link to a category


Guest

Recommended Posts

Hi

This seems like it should be a really simple thing to do but fort the life of me I can't figure it out!

 

 

All I want to do is make the category images that I have place on my LivingStyle.co.ukhome page link to the category. The problem I am getting is that the links I have put there do not create an osCsid which I need to give each user a unique basket.

 

At the moment a user who clicks the linked images gets an osCsid on the next page but if they then return to the index page (catalog home page)and again follow an image link they get a new osCid.

 

the code that I am using is pure html which I know is wrong. shown here for your amusement

<A Href =http://www.livingstyle.co.uk/catalog/index.php/cPath/33><img src="http://www.livingstyle.co.uk/catalog/images/thumbs/corfetn.jpg" border="0" alt="UK Fireplace Collection">

<P>I know I should be using tep_href_link but I have searched everywhere to find out how to correctly implement this and have drawn a blank.

 

My best guess was

<a href="' . tep_href_link(FILENAME_DEFAULT, 'cPath=' 33 ')">'

 

Is there ANYONE who could help me write a link that will maintain session for this I am at my wits end now...

 

Please Help

Link to comment
Share on other sites

<a href="' . tep_href_link(FILENAME_DEFAULT, 'cPath=33') . '">'

 

Think this should do the trick, pay attention to the single and double quotes ...

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

I think this may work a little better :)

 

<a href="<?php echo tep_href_link(FILENAME_DEFAULT, 'cPath=33'); ?>">link</a>

 

Matti

Link to comment
Share on other sites

Hi I tried both of your suggestions and I get a parse error for both of them. I have put my links in the define main text section of catalog/includes/languages/english/index.php

like so

 

define('TEXT_MAIN', '<font size="3"face="verdana" Color="Red">Main Categories...</font> <Table width="100% Cellpading="7"><TR><TD align="center">

<A Href =http://www.livingstyle.co.uk/catalog/index.php/cPath/33>

<img src="http://www.livingstyle.co.uk/catalog/images/thumbs/corfetn.jpg" border="0" alt="UK Fireplace Collection"><BR><font size="2"face="verdana">Fireplaces</font></a></TD>

 

and I simply swapped my <A Href =http://www.livingstyle.co.uk/catalog/index.php/cPath/33>

for each of the above codes.

 

It must be me, Have I put the links in the wrong place or something?

Link to comment
Share on other sites

define('TEXT_MAIN', '<font size="3"face="verdana" Color="Red">Main Categories...</font> <Table width="100%" Cellpadding="7"><TR><TD align="center">
<a href="' . tep_href_link(FILENAME_DEFAULT, 'cPath=33') . '"><img src="http://www.livingstyle.co.uk/catalog/images/thumbs/corfetn.jpg" border="0" alt="UK Fireplace Collection"><BR><font size="2" face="verdana">Fireplaces</font></a></TD>');

 

Some quotes seemed to be missing in other sections too, this code works (tested on my site :D)

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

yup - I wasn't thinking language file :blink: - so Carine is much closer :)

 

This works for me:

 

<a href="' . tep_href_link(FILENAME_DEFAULT, 'cPath=33') . '">link</a>

 

Matti

Link to comment
Share on other sites

Thank you both

 

When you say some quotes missing in other sections too can you give me a clue as to where to start looking and what i,m looking for.. sounds pathetic I know but I have no idea about php and I am learning it as I try to do something any more help would be most appreciated!

Link to comment
Share on other sites

Look at the first link I posted - that works fine if posted directly into the main file's HTML - the links that work for you are in a language define (HTML within PHP) - this is already contained in quotes - therefore when php is introduced within the HTML the quotes must be closed and the php concantenated (periods), then reopened for the remaining HTML - marked in red below :)

 

define('TEXT_MAIN',? ' Your text here<a href="' . tep_href_link(FILENAME_DEFAULT, 'cPath=33') . '">link</a>the rest of your text');

 

When you make a link within regular HTML things are a little different - you must

also use 'echo':

 

? ? ? <tr>

? ? ? ? <td class="main"><a href="<?php echo? tep_href_link(FILENAME_DEFAULT, 'cPath=33'); ?>">link</a></td>

? ? ? </tr>

 

Matti

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...