Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to link to a product the proper way


Zuncan

Recommended Posts

Posted

Hi!

 

I was just wondering how to link to a product the proper way so the session dont get lost.

 

I want to display some productimages on the indexpage. And when someone klicks on the productimage they gets sent to the product info page.

 

What code shall I use for that?

 

I tryed:

<a href="http://www.mysite.com/product_info.php?products_id=95">

<IMG SRC="images/image.jpg" border="0">

</a>

 

but that is NOT the proper way. Please help me out.

 

/Zuncan

So what?! Who care in a hundred years anyway?

Posted

An easy way to do that is to get the featured products contribution. All the code is already set up for you and you can put that anywhere you want to, not just in a column. Then you can add and change products whenever you feel like it from your admin area and show as many or as few as you want.

 

 

or you can use something like

<a href="<?php echo tep_href_link('index.php', 'cPath=21')?>"><img src="images/image.jpg"></a>

 

cpath= being the path to the catagory you want to link to or if you want to link to a product change index.php to product_info.php and cpath to the part that points to your product ie: the products_id=95

Wendy James

 

Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.

Posted

Hmm..

 

Just cant get it to work. I did just as you said.

 

This is the code that I tryed:

 

<a href="<?php echo tep_href_link('product_info.php', 'products_id=439')?>">

<IMG SRC="images/image.jpg">

</a>

 

But then I only get a big error:

Parse error: parse error, unexpected T_STRING in /home/userC/c0071500/public_html/amorspilar.se/includes/languages/english/index.php on line 58

 

Please help me out..

 

/Zuncan

So what?! Who care in a hundred years anyway?

Posted

You put the code in your language file?

 

The link needs to go on your catalog/index.php file, not the language file.

Wendy James

 

Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.

Posted

yep. I put it where my welcometext is. thats why. Is that totally wrong?

So what?! Who care in a hundred years anyway?

Posted

Yup, it's wrong. It needs to go on the catalog/index.php file where you want it to show up.

Wendy James

 

Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.

Posted

aha.. didnt think it made any differens.. Thanks for the help! I try it right away.

 

/Zuncan

So what?! Who care in a hundred years anyway?

Posted

Wow! It worked just fiiine. Thanks man! You just made my day!

 

/Zuncan

So what?! Who care in a hundred years anyway?

Posted

Welcome =)

Wendy James

 

Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.

Posted
Welcome =)

 

Hey Wendy,

 

This was exactly what I needed also...thanks!

 

Can you tell me how to get rid of the purple and blue border around the images I am linking to?

 

I have searched the stylesheet with no luck...what am I missing?

 

Thanks again

 

Slater

Posted
You put the code in your language file?

 

The link needs to go on your catalog/index.php file, not the language file.

 

 

Hello,

 

Glad you guys are talking about this. I just realized today that my images on my home page in the center window (my welcome image with hyperlink) is not holding a session when some one buys something and goes to the home page and clicks on it.

 

Qestion for you? I only want the image to show up on the home page, where the welcome message is. Will this show up on every page that uses index.php if I put the image in that file?

 

What is the best way?

 

Thank you.

Posted

Slater... lol put border="0" in the tag =) just saying incase someone else wants to know

 

pura, index.php is actually 3 pages in one. You can put an image on the page that will only show up on any one of those three areas. Tell me which section and I will try and get you aproximate area to put the code in.

 

Index, when you first go on the site.

the page you go to when you click on a main catagory link

the page that lists of all products in a catagory

Wendy James

 

Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.

Posted
Slater... lol put border="0" in the tag =) just saying incase someone else wants to know

 

pura, index.php is actually 3 pages in one. You can put an image on the page that will only show up on any one of those three areas. Tell me which section and I will try and get you aproximate area to put the code in.

 

Index, when you first go on the site.

the page you go to when you click on a main catagory link

the page that lists of all products in a catagory

 

 

Wendy,

 

First of all let me tell you having someone like you who is able to respond to peoples questions so fast is a gift!

 

On the home page, I have cleared away all the New Products for April, and I have remove all the default text that is listed in my languages file. So when you go to the home page right now, it is blank.

 

I have two images that I would like to have links on both to go to my two main catagories.

 

Your statement leads me to wonder, what will be displaed when someone is in a catagory and they decide to click on the tree, Top.

 

Perhaps you can offer us, and those who browse this form later on the trick to all three?

 

I am not sure how broad your skill set is, but if you would be so kind you mind looking at this topic.

 

http://www.oscommerce.com/forums/index.php?showtopic=148211

 

This one has got me really stumped.

Posted

I actually solved this issue today, and it really was not as hard as I thought. The solution to my problem was to edit

 

<td class="main"><?php echo TEXT_MAIN; ?></td>

 

which was on line 339 of my /catalog/index.php

 

In stead of editing that line, I just added my new line of code like this right underneath it.

 

<td class="main"><a href="<?php echo tep_href_link('index.php', 'cPath=57')?>"><img src="images/jellybean.gif" WIDTH=165 HEIGHT=103 BORDER=0 ALT=""></a></td> :thumbsup:

Posted

Btw, adding the file directly into your catalog/index.php is not needed. Here is some example code I use directly in the text under TEXT_MAIN in catalog/includes/languages/english/index.php

 

<a href="' . tep_href_link('product_info.php?products_id=52') . '">' . tep_image('images/image.jpg', 'Just a simple image description') . '</a>

 

Hope that helps someone atleast.

Kenneth S

--------------

Customer "Are you a real programmer?"

Me "No, but I did stay at a Holiday Inn Express last night"

Archived

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

×
×
  • Create New...