Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to create a 'Tell A Friend' link?


ChrisW123

Recommended Posts

I've gotten rid of "Tell a friend" box and instead want to create an image link to tell_a_friend.php. Sounds simple enough but tell a friend requires the product ID in order to work and I can't figure out how to pass it!

 

Can someone help me? Here's what I've tried:

 

<tr>
   <td align="right" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_TELL_A_FRIEND) . '">' . tep_image(DIR_WS_IMAGES . 'prod_tellafriend.gif', 'Tell a friend about this product!') . '</a>'; ?></td>
</tr>

 

This didn't work so I added this extra code to the target page:

 

....tep_href_link(FILENAME_TELL_A_FRIEND . '?pID=' . $HTTP_GET_VARS['products_id']

 

Didn't work, so I added this below it, sort of like how the tell_a_friend box works:

 

<?php tep_draw_hidden_field('products_id', $HTTP_GET_VARS['products_id']) . tep_hide_session_id(); ?>

 

This doesn't help either. Any ideas?

 

-Chris.

Link to comment
Share on other sites

You could check using isset if the array parameter is set ($HTTP_GET_VARS['products_id']) before processing or displaying the image link.

Link to comment
Share on other sites

  • 2 weeks later...
You could check using isset if the array parameter is set ($HTTP_GET_VARS['products_id']) before processing or displaying the image link.

 

Hi enigma,

 

I do check the product ID using that, but I'm trying to figure out the code I need to get the link to work. All of the formats above that I've tried don't seem to work. I get "Unable to find that product!" when I click the link. So I'm missing the correct way to pass the ID on.

 

:( Anybody know the correct code to use?

Link to comment
Share on other sites

I've gotten rid of "Tell a friend" box and instead want to create an image link to tell_a_friend.php.  Sounds simple enough but tell a friend requires the product ID in order to work and I can't figure out how to pass it! 

 

Can someone help me?  Here's what I've tried:

 

<tr>
? ?<td align="right" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_TELL_A_FRIEND) . '">' . tep_image(DIR_WS_IMAGES . 'prod_tellafriend.gif', 'Tell a friend about this product!') . '</a>'; ?></td>
</tr>

 

This didn't work so I added this extra code to the target page:

 

....tep_href_link(FILENAME_TELL_A_FRIEND . '?pID=' . $HTTP_GET_VARS['products_id']

 

Didn't work, so I added this below it, sort of like how the tell_a_friend box works:

 

<?php tep_draw_hidden_field('products_id', $HTTP_GET_VARS['products_id']) . tep_hide_session_id(); ?>

 

This doesn't help either.  Any ideas?

 

-Chris.

 

 

I see several issues here:

 

1) you need to append the products_id to the tep_href_link, not a hidden field

2) when naming the parameter, check the file it takes you to ... it wants products_id, not pId

 

let us know how it works when you have made these changes ...

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

I see several issues here:

 

1) you need to append the products_id to the tep_href_link, not a hidden field

2) when naming the parameter, check the file it takes you to ... it wants products_id, not pId

 

let us know how it works when you have made these changes ...

 

Thanks Monika... Here's what I changed it to:

 

<td align="right" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_TELL_A_FRIEND, 'products_id=' . $product_info['products_id']) . '">' . tep_image(DIR_WS_IMAGES . 'prod_tellafriend.gif', 'Tell a friend about this product!') . '</a>'; ?></td>

 

Works great now! -Chris.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...