Jump to content
Sign in to follow this  
stevel

Embed Links with SID in Description

Recommended Posts

Hello Steve,

thanks for the contribution. It is exactly what I need as I would like links to other products within the product description of different products.

So I installed it exactly as instructed. But I am getting a 404 error and the following url in the address bar http://www.krecs.com/product_info.php/cPat...d/206?$sid

the following code is what has been entered into the description.

<p>Buy the Album <a href="%%http://www.krecs.com/Shop/product_info.php?cPath=21_31&products_id=206%%">HERE</a></p>

Any help is much apprciated.

Thanks

Christian


On your last day only you will have to approve or disaprove of how your life has been.

Share this post


Link to post
Share on other sites

Ok I tried again and this time the result url was

http://www.krecs.com/Shop/%%http://www.kre...ducts_id=1333%%

the code was

<p>Buy the Album<a href="%%http://www.krecs.com/Shop/product_info.php?products_id=1333%%"> HERE</a></p>

It seems that the url from the database isn't being parsed at all by the function. I checked the product_info.php and the changes there were correct.

Thanks


On your last day only you will have to approve or disaprove of how your life has been.

Share this post


Link to post
Share on other sites

Two mistakes:

 

1. The delimiters are %%+ and %%- - you forgot the + and -

2. You don't put the http:, etc., in the URL. Just the page name as if you were coding an argument to tep_href_link.

 

So, you would want:

 

<p>Buy the Album <a href="%%+product_info.php?cPath=21_31&products_id=206%%-">HERE</a></p>

Share this post


Link to post
Share on other sites

Thanks so much Steve works perfectly now.

That's what I get for trying to do more when I'm over tired.


On your last day only you will have to approve or disaprove of how your life has been.

Share this post


Link to post
Share on other sites

Hi,

 

Does this contibution compare words in a description page with a predefined list which has a URL to the product.

 

I want to have auto internal catalog links when creating descriptions. I want to type in a description and when a certain word comes up e.g. Ford Mustang, it creates a link out of the words Ford Mustang and points the link to the Ford Mustang page.

 

If not then does anyone know of an alternative.

Share this post


Link to post
Share on other sites

This contribution does nothing at all like that. You could use it to create such links manually while preserving the user session ID, but you would have to recognize while typing the description that you wanted to do that.

 

What you're asking for is feasible, but would be a lot of overhead if the processing happened when the page was displayed.

Share this post


Link to post
Share on other sites

Hi

 

I am so happy to find this contribution. I wanted to use it in other places too.

 

I wanted to do with Information pages.

 

I edited info_pages.php and changed

 

<?php echo stripslashes("$page_check[pages_html_text]"); ?>

 

to become

 

<?php echo embedded_href_replace($page_check['pages_html_text']); ?>

 

but the link does not work.

 

The first information page displays but when I click the link which looks like this in the page

 

<a href="%%+info_pages.php?pages_id=21%%-">open source</a>

 

the link keeps the %%

 

..../%%+info_pages.php?pages_id=21%%-

 

and so I get page not found.

 

 

Any clues?

 

 

Also I wanted to for this for Articles too but could not even find a line I thought was the one to change :)

 

 

thanks

 

Kym

Edited by FlyingKites

Kym

Projects Director @ ozEworks.com

Share this post


Link to post
Share on other sites

I assume that in your retyping of the line that changed, you got the original somewhat wrong. I don't think it looked exactly like that originally.

 

What you did should have worked. You did add the require line also? The function is not being called.

 

Are you sure there is only one place in info_pages.php where this text is echoed? Look for more that also need to be edited.

Share this post


Link to post
Share on other sites

HI

 

The original info_pages.php says

 

<tr>

<td class="main"><?php echo stripslashes("$page_check[pages_html_text]"); ?></td>

</tr>

 

There is only one place it has this.


Kym

Projects Director @ ozEworks.com

Share this post


Link to post
Share on other sites

For the article manager contrib, in article_info.php, change:

<p><?php echo stripslashes($article_info['articles_description']); ?></p>

to

<p><?php echo embedded_href_replace($article_info['articles_description']); ?></p>

 

Which Information Pages contrib are you using?

Share this post


Link to post
Share on other sites

Hmm - very odd coding in that contrib. It'll take me a couple of days to figure this out as I will have to install it on a test store. Offhand, I can't see why it wouldn't work.

Share this post


Link to post
Share on other sites

Thanks for going to that trouble.

 

In the meantime, I conquered the Newsdesk contribution. This is fun :)

 

As an aside, someone also gave me a way to create pages using straight php. But of course we all know how to do that manually but it not appealing to clients. The thing is that he also pointed me to an offline page creator contribution

http://www.oscommerce.com/community/contributions,2614

which seems like a neat way to add extra content as php code and remain SID happy that may be useful for site owners who are a little more au fait with computers.


Kym

Projects Director @ ozEworks.com

Share this post


Link to post
Share on other sites

FlyingKites, I installed the InfoPages contrib in my test store and made this edit:

 

<?php echo embedded_href_replace("$page_check[pages_html_text]"); ?>

I also added the require line for embed_href.php after the require for application_top. It worked fine. Note that I left the quotes in the argument - I'm not sure why they did it that way but it does work.

Share this post


Link to post
Share on other sites

Hi

 

Well I had a great time making a great mess.

 

After getting what you said to do in place it still did not work and I could not work out why. Guess what? It turned out that the page I was trying to do was an Index page which gets called from index.php so I had to change that too.

 

Now I am off to do more testing and changes.

 

thanks


Kym

Projects Director @ ozEworks.com

Share this post


Link to post
Share on other sites

Okay. Well I have conquered:

 

1. Product descriptions

2. Articles

3. Info-pages

4. FAQDesk

 

but I am stuck on Newsdesk.


Kym

Projects Director @ ozEworks.com

Share this post


Link to post
Share on other sites

Aw, c'mon. It isn't that hard!

 

In newsdesk_info.php, this is the line you want to change:

<?php echo stripslashes($product_info_values['newsdesk_article_description']); ?>

 

The rest is left as an exercise for the reader.

Share this post


Link to post
Share on other sites

Hi

 

Newsdesk is a complicated contribution. There are also several programs related to newdesk that need to change and several lines within it as you can have the link in the summary description as well as the long one. But for the program that displays the full listing that you referenced I had changed to:

 

<php? echo embedded_href_replace($product_info_values['newsdesk_article_description']); ?>

 

It is acting like the function is not called.


Kym

Projects Director @ ozEworks.com

Share this post


Link to post
Share on other sites

Well, the first thing I would do is change this code to start out as:

 

<?php echo '$$' . embedded_href_replace( ...

and see if that's really the line that is being executed. More than once I've been fooled into thinking I knew which line was the issue only to find it was something else.

 

You could also throw in some calls to var_dump for variables of interest (such as $product_info_values) or even in the embedded_href_replace function itself to see just what is going on.

 

I'm not going to install newsdesk to debug this.

Share this post


Link to post
Share on other sites

Hi guys,

 

This is an excellent contribution! I have it working great for the product descriptions - but now I am trying to figure out how to get it working properly with the Customer Testimonials contribution - I want the product names in the testimonials to link to their respective products.

 

I added the code in the database for quite a few of the testimonials - but somewhere in the script that runs the testimonials box I am missing how to call the correct script to strip the slashes and cause the link to work.

 

I'm guessing it has to be in one of these two files:

modules/customer_testimonials

<table border="0" cellspacing="0" cellpadding="2" width="100%">
<?php
 if (sizeof($testimonial_array) == '0') {
?>
 <tr>
<td class="main"><?php echo TEXT_NO_TESTIMONIALS; ?></td>
 </tr>
<?php
 } else {
for($i=0; $i<sizeof($testimonial_array); $i++) {
?>
 <tr>
<td valign="top" class="main">
<?php
$info_box_contents = array();
$info_box_contents[] = array('align' => 'left', 'text' => 'Testimonial by <b>' . $testimonial_array[$i]['author']);
new contentBoxHeading($info_box_contents);

if ($testimonial_id != '') {
	  $testimonials_list = '<p><a href="'. tep_href_link(FILENAME_CUSTOMER_TESTIMONIALS, '', 'NONSSL'). '">'. TEXT_LINK_TESTIMONIALS. '</a>';
}
else {
	$testimonials_list = '';
}

$info_box_contents = array();
if ($testimonial_array[$i]['url_title'] == '') {
	$testimonial_array[$i]['url_title'] = TEXT_LINK_TO_PAGE;
}

if (empty($testimonial_array[$i]['url'])) {
$info_box_contents[][] = array('align' => 'left',
							   'params' => 'class="smallText" width="100%" valign="top"',
							   'text' => $testimonial_array[$i]['testimonial']. $testimonials_list);
} elseif (substr($testimonial_array[$i]['url'], 0, 7) == 'mailto:') {
$info_box_contents[][] = array('align' => 'left',
							   'params' => 'class="smallText" width="100%" valign="top"',
							   'text' => $testimonial_array[$i]['testimonial'].'<br><br><a target="_blank" href="'. $testimonial_array[$i]['url'] . '"><b>'. substr($testimonial_array[$i]['url'], 7). '</b></a>'. $testimonials_list);
} else {
$info_box_contents[][] = array('align' => 'left',
							   'params' => 'class="smallText" width="100%" valign="top"',
							   'text' => $testimonial_array[$i]['testimonial'].'<br><br><a target="_blank" href="'. $testimonial_array[$i]['url'] . '"><b>'. $testimonial_array[$i]['url_title']. '</b></a>'. $testimonials_list);
}
new contentBox($info_box_contents);
?>
</td>
 </tr>
<?php
  if (($i+1) != sizeof($testimonial_array)) {
?>
 <tr>
<td colspan="2" class="main"> </td>
 </tr>
<?php
  }
}
 }
?>
</table>

 

Or - boxes/customer_testimonials

?>
<!-- customer testimonials //-->
<?php
 if ($random_testimonial = tep_random_select("select * FROM " . TABLE_CUSTOMER_TESTIMONIALS . " WHERE status = 1 ORDER BY rand() LIMIT 1")) {
?>
	  <tr>
		<td>
<?php
$info_box_contents = array();
$info_box_contents[] = array('align' => 'left',
							 'text'  => BOX_HEADING_CUSTOMER_TESTIMONIALS
							);
new TestimonialsBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_CUSTOMER_TESTIMONIALS, '', 'NONSSL'));

$testimonial = substr($random_testimonial['testimonials_html_text'], 0, 100);

$info_box_contents = array();
$info_box_contents[] = array('align' => 'left',
							 'text'  => '<a href="' . tep_href_link(FILENAME_CUSTOMER_TESTIMONIALS, 'testimonial_id=' . $random_testimonial['testimonials_id']) .  '">' . $testimonial . '...<br>Read more...</a><br><b>~'.$random_testimonial['testimonials_title'].' '.$random_testimonial['testimonials_last_name'].'</b>'
							 );
new TestimonialsBox($info_box_contents);
?>
		</td>
	  </tr>
<?php
 }
?>

 

Do you guys have any ideas on how to get this working?

 

Thanks in advance :D


~Tracy
 

Share this post


Link to post
Share on other sites

I had a problem which I couldn't find the answer in previous posts, or more likely couldn't understand the information :blink:

 

First... my store is at this location http://www.mystore.com/store

 

In my description, I entered the following to link to a picture NOT in my store

<img src=%%+http://www.mystore.com/Access/steps/ph03s.jpg%%-></a><BR>Click to view larger images</font>

when I view the fisished page, the image is not shown. On viewing the image location I get

hxxp://www.mystore.com/store/http://www.mystore.com/Access/steps/ph03.jpg?osCsid=cbc9ec6b14c05839783a083427ab6756

 

hxxp=http

After a bit of messing about, I found if I enter my code as

<img src=%%+../Access/steps/ph03s.jpg%%->

everything works fine :) This is probably obvious to some, but had me stumped for a while :(


____________________________________________________________________

____________________________________________________________________

Share this post


Link to post
Share on other sites
Hi guys,

 

This is an excellent contribution! I have it working great for the product descriptions - but now I am trying to figure out how to get it working properly with the Customer Testimonials contribution - I want the product names in the testimonials to link to their respective products.

 

I added the code in the database for quite a few of the testimonials - but somewhere in the script that runs the testimonials box I am missing how to call the correct script to strip the slashes and cause the link to work.

 

Do you guys have any ideas on how to get this working?

 

Thanks in advance :D

 

Ok - I have managed to get it working. In case anyone else wants to try this - here is what I did:

 

In the catalog/customer_testimonials.php page I changed:

 'testimonial' => $testimonials['testimonials_html_text'],

to this:

'testimonial' => embedded_href_replace($testimonials['testimonials_html_text']),

 

That causes the embedded links to work properly on the page that shows a full testimonial (or the page that shows all of the testimonials).

 

The smaller infobox on the side of the page was a little trickier though,

I changed this:

$testimonial = substr($random_testimonial['testimonials_html_text'], 0, 100);

to this:

$testimonial = substr(embedded_href_replace($random_testimonial['testimonials_html_text']), 0, 200);

 

This does allow the links in the testimonials infobox to work - as long as where the testimonial gets cut off isn't in the middle of a link :( I'm not sure how to tell the substr function to not cut off if it's in between an <a href=> tag and that it has to wait until it hits the </a> to cut off. But at least it works for the most part now :)


~Tracy
 

Share this post


Link to post
Share on other sites

Hai Steve,

 

As a newbie I have a question about embedded links. I'm setting up a shop called www.siliconzone.nl

 

Many of the product I want in my database (it's still empty now), come from the open ICEcat database, they provide free URL's (and also XML code)

 

Now I want to embed the provided URL's in my product descriptions, but I can't make it work...

 

Maybe your contrib is not for embedding external URL links, but maybe you have a suggestion how to do this.

 

Any reply would be most welcome!!

 

Thank you in advance :thumbsup: ,

 

Richard

Share this post


Link to post
Share on other sites

Richard,

 

Sorry, I did not see your post until now as somehow my subscription to this topic got disabled.

 

The purpose of this contribution is to provide the equivalent of tep_href_link in text that is extracted from the database, and the only reason you'd need that is that you want to preserve the osCsid= value in the URL should your visitor not have the cookie set.

 

In the case of external links, just put the links in - description text is HTML so just put in a normal link in the text of your description. You don't need the function of this contribution for that.

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  

×