Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Links Manager Question


zathrus

Recommended Posts

Hi everyone

 

I'm not sure if this is a bug, or a user mistake in adding the links, or if the script just isn't behaving how "I thought it would." (the words of doom in a programmers world)

 

All the links look fine in the database www.whatever.com (I hope that's a real site someday) but on the site they show up with the extra path of http://sitethat-we-arebuilding.com/catalog...ww.whatever.com

 

I installed the patch, but it doesn't change this.

I looked through the code a while too and my eyes have not opened yet you could say.

 

Has anyone run into this problem before? It's consistant with every link added, but the value stored in the database and when you check the admin is correct. (so it's coming from the display probably from catalog/exchange_links.php)

 

Thanks anyone for your help.

Jonathan

Link to comment
Share on other sites

<?php

   $link_link_query = tep_db_query("select l.link_title, l.link_description, l.link_url, c.link_category_name from " . TABLE_EXCHANGE_LINKS_LINKS . " l, " . TABLE_EXCHANGE_LINKS_CATEGORIES . " c where l.link_category_id = c.link_category_id and c.link_category_id = '" . $lPath . "' and l.link_status = '1' order by l.link_title");

   //$link_link_query = tep_db_query("select * from " . TABLE_EXCHANGE_LINKS_LINKS . " l where l.link_category_id = '" . $lPath .  "'");



   echo '          <tr>' . "n";

   echo '            <td><table border="0" width="100%" cellspacing="0" cellpadding="2">' . "n";



   //links under category

   $rows = 0;

   while($link_links_data = tep_db_fetch_array($link_link_query)) {

     $rows++;

     if($rows == 1) {

       echo '              <tr>' . "n";

       echo '                <td align="left" class="smallText" style="width: ' . $width . '" valign="top"><a name="' . $link_links_data['link_category_id'] . '"></a><br> :: <a href="' . tep_href_link(FILENAME_EXCHANGE_LINKS . '#' . $link_links_data['link_category_id'], '', NONSSL, false) . '" class="subCatLinks">' . $link_links_data['link_category_name'] . '</a></td>' . "n";

       echo '              </tr>' . "n";

     }



     echo '              <tr>' . "n";

     echo '                <td align="left" class="smallText" style="width: ' . $width . '" valign="top"><br> » <a href="' . $link_links_data['link_url'] . '" class="exLinkTitle" target="_blank">' . $link_links_data['link_title'] . '</a><br><div align="justify">' . $link_links_data['link_description'] . '</div><a href="' . $link_links_data['link_url'] . '" class="exLinkURL" target="_blank">' . $link_links_data['link_url'] . '</a></td>' . "n";

     echo '              </tr>' . "n";

   }

?>

This is the section from catalog/exchange_links.php that displays the list of links. Have you worked with this module before? This looks like the problem might be in another file (at first glance anyway)

 

More specifically (from exchange_links.php) this line would be it if this file was the problem.

right from <a href to >

 <td align="left" class="smallText" style="width: ' . $width . '" valign="top"><br> » <a href="' . $link_links_data['link_url'] . '" class="exLinkTitle" target="_blank">' . $link_links_data['link_title'] . '</a><br><div align="justify">' . $link_links_data['link_description'] . '</div><a href="' . $link_links_data['link_url'] . '" class="exLinkURL" target="_blank">' . $link_links_data['link_url'] . '</a></td>' . "n";

Link to comment
Share on other sites

Okay...one more request. :) Is there a URL where I can see the output while I'm looking at the code?

 

It has bee a long time since I added a links manager to my site ...I am not sure this is the same one I have....What contrib is this?

Link to comment
Share on other sites

Well, I was about to post but I just figured it out (took long enough)

 

I wonder what you had in mind though.

$Id: exchange_links.php, v0.2 2003/05/02 Exp $

 

Links Manager for OSC v0.2

line 192

The specific line I thought it might be

adding

http://

between the double and single quotes,

 

 <a href"'http://' rest of the code

Did it for both links in that row and it works fine

 

Weird

(no wonder silly couldn't find it, I was looking for a php error, but it was an html error)

Hmm, do we let the author know?

 

thanks for the replies

I appreciate it

Link to comment
Share on other sites

Congratulations Jonathan! Good job on fixing your problem.

 

If you haven't already, I would get in touch with the author and let him know what you have found.

Link to comment
Share on other sites

Hi Jonathan,

 

Oops, sorry I joined in a bit late. Thanks a whole lot for taking time to look into the code.

 

Actually, the problem lies in the user adding the links... they're supposed to include the 'http://' prefixed to the url they submit. I think the following code change would make sure they add the 'http://' before the url. At least, it would act as a reminder, till I can come up with some url validation code.

 

In file /catalog/includes/modules/link_submit_details.php,

 

at around line 50, replace

  if ($is_read_only == true) {

   echo $submit_link['link_address'];

 } elseif ($error == true) {

   if ($entry_url_error == true) {

     echo tep_draw_input_field('url') . ' ' . ENTRY_LINKS_ADDRESS_ERROR;

   } else {

     echo $url . tep_draw_hidden_field('url');

   }

 } else {

   echo tep_draw_input_field('url', $submit_link['link_address']) . ' ' . ENTRY_LINKS_ADDRESS_TEXT;

 }

 

with,

 

  if ($is_read_only == true) {

   echo $submit_link['link_address'];

 } elseif ($error == true) {

   if ($entry_url_error == true) {

     echo tep_draw_input_field('url') . ' ' . ENTRY_LINKS_ADDRESS_ERROR;

   } else {

     echo $url . tep_draw_hidden_field('url');

   }

 } else {

   echo tep_draw_input_field('url', 'http://' . $submit_link['link_address']) . ' ' . ENTRY_LINKS_ADDRESS_TEXT;

 }

 

 

and at around line 155, replace

 

  if ($is_read_only == true) {

   echo $submit_link['link_reciprocal'];

 } elseif ($error == true) {

   if ($entry_reciprocal_error == true) {

     echo tep_draw_input_field('reciprocal') . ' ' . ENTRY_LINKS_RECIPROCAL_PAGE_ERROR;

   } else {

     echo $reciprocal . tep_draw_hidden_field('reciprocal');

   }

 } else {

   echo tep_draw_input_field('reciprocal', $submit_link['link_reciprocal']) . ' ' . ENTRY_LINKS_RECIPROCAL_PAGE_TEXT;

 }

 

with,

 

  if ($is_read_only == true) {

   echo $submit_link['link_reciprocal'];

 } elseif ($error == true) {

   if ($entry_reciprocal_error == true) {

     echo tep_draw_input_field('reciprocal') . ' ' . ENTRY_LINKS_RECIPROCAL_PAGE_ERROR;

   } else {

     echo $reciprocal . tep_draw_hidden_field('reciprocal');

   }

 } else {

   echo tep_draw_input_field('reciprocal', 'http://' . $submit_link['link_reciprocal']) . ' ' . ENTRY_LINKS_RECIPROCAL_PAGE_TEXT;

 }

 

You can see the code in action at, http://www.salehut.com/exchange_links_submit.php

 

Thanks again :-),

VJ

Link to comment
Share on other sites

thanks

I'll need to put that in.

and put a nice reminder in for all future users (....... grrrr)

 

probably won't play with this again until monday

 

thanks a lot vj (are you the contributor?)

 

Jonathan

Link to comment
Share on other sites

  • 2 months later...

VJ

 

Where exactly would I apply the http:// update in the admin > links > new links page?

 

Currently site URL and reciprocol page would cause issues if the entry was made with http:// prefix omitted.

 

Can't find the equivalent to

/catalog/includes/modules/link_submit_details.php

in the admin section...

 

It is not a major issue as it is admin only but a would be nice to have.

 

Thanks

Link to comment
Share on other sites

Hi everyone

 

I'm not sure if this is a bug, or a user mistake in adding the links, or if the script just isn't behaving how "I thought it would."  (the words of doom in a programmers world)

 

All the links look fine in the database www.whatever.com (I hope that's a real site someday) but on the site they show up with the extra path of http://sitethat-we-arebuilding.com/catalog...ww.whatever.com

 

It's real!! Point you browser to www.whatever.com. I was redirected to www.beargear.com. Cool! :lol:

 

Regards,

Piotr

Link to comment
Share on other sites

Where exactly would I apply the http:// update in the admin > links > new links page?  

 

Here's a quickfix you could try:

 

In /admin/exchange_links_links.php,

 

replace this code (around line 235),

 

            <td class="main"><?php echo tep_draw_input_field('link_url', $cInfo->link_url, 'maxlength="255"', true); ?></td>

 

with,

 

            <td class="main"><?php echo tep_draw_input_field('link_url', (isset($cInfo->link_url)) ? $cInfo->link_url : 'http://', 'maxlength="255"', true); ?></td>

 

and this code (around line 280),

 

            <td class="main"><?php echo tep_draw_input_field('link_reciprocal', $cInfo->link_reciprocal, 'maxlength="255"'); ?></td>

 

with,

 

            <td class="main"><?php echo tep_draw_input_field('link_reciprocal', (isset($cInfo->link_reciprocal)) ? $cInfo->link_reciprocal : 'http://', 'maxlength="255"'); ?></td>

 

By the way, I'm working on a newer version of this links program now. I hope to get it done in a couple of weekends (hopefully!).

 

HTH,

VJ

Link to comment
Share on other sites

VJ,

Now we are both on the same song sheet :wink:

 

The admin http:// inclusions work perfectly.

Perhaps an inclusion for your next release?

 

You are a superstar, thanks for this contribution and your assistance.

 

Thomas

Link to comment
Share on other sites

I just tried to install this and in admin Im getting all kinds of erroes..

 

Right now Im getting this

When clicking:

 

LINKS:

 

Site Title Status Action

TEXT_DISPLAY_NUMBER_OF_RECS Page 0 of 0

ALso the Add Link? Image isn't in the package..

 

Categories

 

Link Categories Search:

Name Status Action

Fatal error: Call to undefined function: tep_array_merge() in /usr/local/psa/home/vhosts/stoprust.net/httpdocs/admin/exchange_links_categories.php on line 296

 

 

Help ?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...