maintain session ID while creating links using FCKEditor

// save this file as embed_href.php

<?php
// Embed Links with SID in Description
// osCommerce contribution
//
// 2005-03-02
// Steve Lionel
// Released under the GNU General Public License

function ehr_eval($matches)
{
$parts = explode(‘?’,$matches[2],2);
if (count($parts) == 0) {
$p1 = $parts;
$p2 = ”;
} else {
$p1 = $parts[0];
$p2 = $parts[1];
}
$matches[2] = tep_href_link($p1,$p2);
return $matches[2];
}

// Look for %%+someurl%%- in the argument – replace it with
// the output of tep_href_link(someurl)
//
function embedded_href_replace($string)
{
$output = stripslashes($string);
$output = preg_replace_callback(“/(%%\+)(.*)(%%-)/U”, “ehr_eval”, $output);
return $output;
}
?>

USE INSTRUCTIONS

Edit your product description in admin to include a normal link to a product page. (Note that product descriptions are just HTML.)  For example, you might have a line such as the following:

<p>We also have this shirt in a <a href=”product_info.php?products_id=123″>long-sleeved version</a>.</p>

Now change the href text, inside the quotes, placing the string %%+ after the leading quote and %%- before the trailing quote.  The above example would then become:

<p>We also have this shirt in a <a href=”%%+product_info.php?products_id=123%%-“>long-sleeved version</a>.</p>

Updated the catalog and you’re done!

You can have as many of these as you want in the description text, and the value between the %%+ and %%- can be anything that could be passed to tep_href_link().  When the product description is displayed for the customer, links tagged in this way are passed through tep_href_link which will expand it and add the osCid session ID if required.

You can use this feature in other contexts in your store – any place where text is extracted from the database it could be used.  Just add the require line and replace the stripslashes call with one to embedded_href_replace. (The function does a stripslashes internally.)

for more information check:

http://www.oscommerce.com/community/contributions,2905/page,31