Move Tell-A-Friend FormLast Update: 23rd August, 2005
Article ID: 42



Introduction

The Tell-A-Friend form, which provides the customer a possibility to email someone regarding a product, can be moved to another location on the product information page (product_info.php) or on any other page if a product ID is known.

Solution

The following code block can be copied to a different location on the product information page, or on any other page if the $products_id value is replaced with a valid product ID.

<?php echo tep_draw_form('tell_a_friend', tep_href_link(FILENAME_TELL_A_FRIEND, '', 'NONSSL', false), 'get') . osc_draw_input_field('to_email_address', '', 'size="10"') . ' ' . tep_image_submit('button_tell_a_friend.gif', BOX_HEADING_TELL_A_FRIEND) . osc_draw_hidden_field('products_id', $_GET['products_id']) .tep_hide_session_id() . '</form>'; ?>


If you just want the tell-a-friend graphic to show without the email box use this code:

<?php echo tep_draw_form('tell_a_friend', tep_href_link(FILENAME_TELL_A_FRIEND, '', 'NONSSL', false), 'get') . ' ' . tep_image_submit('button_tell_a_friend.gif', BOX_HEADING_TELL_A_FRIEND) . osc_draw_hidden_field('products_id', $_GET['products_id']) .tep_hide_session_id() . '</form>'; ?>


It is important to use the project tep_* functions to build the form, to make sure the customers session is kept intact when cookies have been disabled.


The above code produces the following raw HTML syntax which can be copied and used outside the osCommerce installation but may regenerate the customer a new session ID when cookies have been disabled.

Raw HTML

<form name="tell_a_friend" action="http://www.my-server.com/osCommerce/tell_a_friend.php" method="get">
<input type="text" name="to_email_address" size="10">
<input type="image" src="includes/languages/english/images/buttons/button_tell_a_friend.gif" border="0" alt="Tell A Friend" title=" Tell A Friend ">
<input type="hidden" name="products_id" value="###PRODUCT ID###"><br>Tell someone you know about this product.</form>


The ###PRODUCT ID### string above needs to be replaced with a value product ID.

 

 

Trademark Policy | Copyright Policy | Sitemap

Copyright © 2000-2005 osCommerce. All rights reserved.