Jump to content
Sign in to follow this  
stevel

Embed Links with SID in Description

Recommended Posts

hello steve,

 

thanks alot for this useful contrib, unfortunately it do not works correctly in my shop. the link it generates works and it adds the correct SID but it kills all stuff that's in the shopping cart.

the reason is the "?" after the products_id. there should be a "&" instead:

catalog/product_info.php?products_id=8?osCsid=07add970c0ffd0d102d71f3828de1a31

 

i tried to fix the code by myself but i had no luck.

maybe you have an idea?

 

thanks alot!

 

robert

Edited by RobertW

Share this post


Link to post
Share on other sites

Hi Steve,

 

in the description of contri 2905 it says:

...

Without this contribution, such links would not have the osCid added where required.

...

 

I fail to understand why in the case of a normal HTML link (<a href="">...</a>) an osCsid is neccessary or would be required.

 

I might eg have a very long FAQ/info-page(several screenheights high) that I want to cut into several other pages, please don't ask me why I may not want to scroll extensive long pages:).

 

Image the case that I might want visitors to go from infopage1 to infopage2 to infopage3 and maybe back to infopage2 etc. which is easily possible with "normal" forward/backward HTML-links.

 

Is it just because osC is set-up that way or what?

 

Reason is that I only just discovered the following:

If visitors refuse cookies.

Put a product in the cart.

If they now go to another page, click on a normal <a href="">-link (osC does not generate an osCsid) what happens is that the cart-content gets deleted (lost) and they will have to fill-up again, which is rather unfriendly.

 

Is this because osC cannot distinguish between types of links (PHP versus HTML) or is there any other reason that it works the way it does?

 

BTW, the contribution is downloaded but I have not yet had the time to look closer.


"If you're working on something new, then you are necessarily an amateur."

Share this post


Link to post
Share on other sites

In links that are generated by osC itself, the function tep_href_link is called. This checks to see if the session cookie was accepted. If not, then it appends the osCid to the generated URL.

 

If you are embedding text in a PHP page manually, you can always add a call to tep_href_link yourself. But if the text come from the database, such as a product description or a FAQ that is managed, then you have no opportunity to do so - it's just raw HTML that is passed through.

 

My contribution makes it possible to add the osCid value when required for links that are embedded in text that comes from the database.

 

So if your FAQ text comes from a database, this contribution is useful to you. If you are creating the pages manually, just do something like this:

 

<a href="<?php echo tep_href_link("FAQp2.php"); ?>">Page 2</a>

Share this post


Link to post
Share on other sites

Hi Steve,

 

My contribution makes it possible to add the osCid value when required for links that are embedded in text that comes from the database.

Got that meanwhile. Thanks anyway.

 

So for shopowners who use eg Dreamweaver or FP or similar and who use therefore standard HTML-links in their descriptions (or info-pages which are not recorded into the db) I will have to make an extra note somewhere in my documentation.

 

Your contribution cannot be adapted to cope with those links (<a href="">) because they do not come from the db?

 

You do not know the existence of another contribution or way to tackle this problem?


"If you're working on something new, then you are necessarily an amateur."

Share this post


Link to post
Share on other sites

I showed you how to handle links that are "hand-coded". You don't need a contrib for that.

 

In Dreamweaver, what I do is enter the link normally. I then go to code view and insert the PHP code around the link to call tep_href_link, as I showed above.

Share this post


Link to post
Share on other sites

Hi Steve,

 

I got a question too. Not directly about your contribution, but more about the sid's in general. You seem to know how it works, so I hope you ca help me understand.

 

I allways understood that if the users browser is set to block cookies, the tep_href_link() function detects it and adds the sid to the url. Trying to check this I set my browsers to block all cookies and removed the tep_href_link() function from the contact_us page link. But to my suprise the same sid still appears on all links. Also on the one I remove the tep_href_link() from! And the cart isn't emptied when I click the link.

 

Does that make sense to you?

 

Thanks!

 

Paul


Please do not PM me for support, I will not respond anyway.

Share this post


Link to post
Share on other sites
I showed you how to handle links that are "hand-coded". You don't need a contrib for that.

 

In Dreamweaver, what I do is enter the link normally.  I then go to code view and insert the PHP code around the link to call tep_href_link, as I showed above.

O.K understand.

I was just trying to find an easy way to make it simple for ppl who are not php-savvy.

Will give them a sample howto.

Thanks anyway.


"If you're working on something new, then you are necessarily an amateur."

Share this post


Link to post
Share on other sites

Thank you for taking the time to create a contrib for this! You solved my problem, and it was a snap to install! :-)

Share this post


Link to post
Share on other sites

Steve, I haven't tried your contribution yet but it looks like just what I need. I need to be able to guide my customers to certain technical information within my site when they hit a certain category or product. A quick question - Does this work with SEO URL contribution by Chemo? I suspect there are no conflicts, but thought I'd check to be sure.

 

Thanks

Share this post


Link to post
Share on other sites

Sorry, I have no idea. My contrib just calls tep_href_link the way it's done all throughout osC, so I can't imagine how there could be a conflict. It's very easy to try out and remove if it doesn't work for you.

Share this post


Link to post
Share on other sites

Just wondering if anyone tried it with MS1?

 

Where the instructions say: 2. Replace the line (120):

 

<p><?php echo stripslashes($product_info['products_description']); ?></p>

 

My code goes like this:

<p><?php echo stripslashes($product_info_values['products_description']); ?></p>


Petter - Arktisk Pudder

Share this post


Link to post
Share on other sites

Thanks Steve,

 

I'll give it a go on my testing server :thumbsup:


Petter - Arktisk Pudder

Share this post


Link to post
Share on other sites

Hi,

 

This looks like it could be perfect for what I need. I have a real problem at the moment where the person that wrote http://ftpupload.bpweb.net/catalog/index.php?cPath=41 used that left menu without calling tep_href_link and I am trying to fix it and spending hours with a headache on it. Is there any way of integrating this contribution to work with this file that is called from the root directory rather than the product listings?

 

Any help would really be appreciated, code is shown for the menu below:

 

if ($ifsearch == "search" && $from == "0" && $categories_id != "57" && $categories_id != "21" && $categories_id != "65" && $categories_id != "59" )

{

?>

<tr><td style="padding-left: 12px;" <? if ($categorylist == $cPath) {?> bgcolor="#dcdcdc"<? } ?>>

<? echo "<a href=\"/catalog/advanced_search_result.php?keywords=&categories_id=21&inc_subcat=1&manufacturers_id=&pfrom=$from&pto=$to&dfrom=&dto=&x=0&y=0&cPath=$categories_id\">Cars up to ?$to</a></td></tr>";

}

 

if ($ifsearch == "search" && $from != "0" && $categories_id != "57" && $categories_id != "21" && $categories_id != "65" && $categories_id != "59" )

{

?>

<tr><td style="padding-left: 12px;" <? if ($categorylist == $cPath) {?> bgcolor="#dcdcdc"<? } ?>>

<? echo "<a href=\"/catalog/advanced_search_result.php?keywords=&categories_id=21&inc_subcat=1&manufacturers_id=&pfrom=$from&pto=$to&dfrom=&dto=&x=0&y=0&cPath=$categories_id\">Cars between ?$from and ?$to</td></tr>";

}

 

if ($ifsearch != "search" && $categories_id != "57" && $categories_id != "21" && $categories_id != "65" && $categories_id != "59" )

{

?>

<tr><td style="padding-left: 12px;" <? if ($categorylist == $cPath) {?> bgcolor="#dcdcdc"<? } ?>>

<? echo "<a href=\"/catalog/index.php?cPath=$categories_id\">$categories_name</td></tr>";

Share this post


Link to post
Share on other sites

See my earlier replies in this thread. If you have hardcoded links from the PHP (or HTML), you don't need my contribution - you can do it by inserting your own tep_href_link call. For example, change:

<? echo "<a href=\"/catalog/index.php?cPath=$categories_id\">$categories_name</td></tr>";

to:

<? echo "<a href=\"" . teo_href_link("/catalog/index.php","?cPath=$categories_id") . "\">$categories_name</td></tr>";

(Hope I didn't make a syntax error here.)

Share this post


Link to post
Share on other sites

Steve, I had some problem with the hardcoded code that you posted, so I did like this instead

<a href="' . tep_href_link('sitemap.php') . '">Site map</a>

 

Should work fine, shouldn't it?

 

// Fredrik

Share this post


Link to post
Share on other sites

Hi Steve:

 

Just thought I'd let you know that I installed your contribution and it does work well with product descriptions, but it doesn't seem to work on the category level, which is what I need it for most. It apparently prepends the %%+ and appends the %%- to the url, giving a 404 error. It does the OSCid OK though.

 

Any ideas what might be happening here?

 

I am running ms2.2, and installed the call to your function in application.top for convenience, and I added the function like so :

 

<?php echo embedded_href_replace($category['categories_description']); ?></td>

 

Thanks a lot for your help.

Share this post


Link to post
Share on other sites

redrum, yes, that's fine.

 

I see I mistakenly wrote teo_href_link instead of tep_href_link.

 

AJ, let me think about that and I'll get back to you.

Edited by stevel

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×