Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Links Manager for osC v1.00


VJ

Recommended Posts

Jack,

 

I'm experiencing some difficulties with different languages. Everything seems to be fine in English version (I've been inserting all links in English), however if you switch language, the links categories are empty, even in admin. However all categories entered in English are available in other languages... Don't really know what to do at the moment, all language files have been inserted in all languages... Have a look here please.

 

Regards,

 

Alex

Umm, I'm not sure about this. I just checked and the code for loading based on language is in place so it should be working. I take it that other parts of your shop works when the language changes?

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

  • Replies 1.1k
  • Created
  • Last Reply

Top Posters In This Topic

Yes, averything else works fine in all languages. The strange thing is that all categories are there in all languages in shop and in admin too, just links are empty. All corresponding language files have been inserted in all language directories during install... any ideas will be much appreciated.

 

Alex

Absinthe Original Liquor Store

Link to comment
Share on other sites

Do the links appear in admin or are they not showing there too? If it is just on the shop side, try replacing all of the files on your shop side. Maybe you have a mixed set or a corrupted file. If they are not showing up in admin too, then I would suspect the database.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

I modified the link_listing.php for that it posts the flash.

 

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 class linkListingBox extends tableBox {
   function linkListingBox($contents) {
     $this->table_parameters = 'class="linkListing"';
     $this->tableBox($contents, true);
   }
 }
 
// Fonction of ManMachine of contributions "Flash Banners"
 function mm_output_flash_movie_for_link_manager($name, $movie, $width = '' , $height = '' , $background = '' , $parameters = '') {
   
   if(tep_not_null($width)) {
 $movie_width = 'width="'.$width.'"';
}
   
if(tep_not_null($height)) {
 $movie_height = 'height="'.$height.'"';
}

if(tep_not_null($parameters)) {
  $flash_movie = $movie . '?' . $parameters;
} else {
  $flash_movie = $movie;
}

$flash  = '<object type="application/x-shockwave-flash" data="'.$movie.'" '.$movie_width.' '.$movie_height.'>' . "\n";
$flash .= '<param name="movie" value="'.$flash_movie.'" />' . "\n";

if(tep_not_null($background)) {
  $flash .= '<param name="bgcolor" value="#'.$background.'" />' . "\n";	
} else {
  $flash .= '<param name="wmode" value="transparent" />' . "\n";
}

$flash .= '</object>' . "\n";

   return $flash;
 }
 
 // End Fonction of ManMachine of contributions "Flash Banners"
 
$listing_split = new splitPageResults($listing_sql, MAX_LINKS_DISPLAY, 'l.links_id');

 if ( ($listing_split->number_of_rows > 0) && ( (PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3') ) ) {
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
 <tr>
   <td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_LINKS); ?></td>
   <td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_LINKS_DISPLAY, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
 </tr>
</table>
<?php
 }

 $list_box_contents = array();

 for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
   switch ($column_list[$col]) {
     case 'LINK_LIST_TITLE':
       $lc_text = TABLE_HEADING_LINKS_TITLE;
       $lc_align = '';
       break;
     case 'LINK_LIST_URL':
       $lc_text = TABLE_HEADING_LINKS_URL;
       $lc_align = '';
       break;
     case 'LINK_LIST_IMAGE':
       $lc_text = TABLE_HEADING_LINKS_IMAGE;
       $lc_align = 'center';
       break;
     case 'LINK_LIST_DESCRIPTION':
       $lc_text = TABLE_HEADING_LINKS_DESCRIPTION;
       $lc_align = 'center';
       break;
     case 'LINK_LIST_COUNT':
       $lc_text = TABLE_HEADING_LINKS_COUNT;
       $lc_align = '';
       break;
   }

   if ($column_list[$col] != 'LINK_LIST_IMAGE') {
     $lc_text = tep_create_sort_heading($HTTP_GET_VARS['sort'], $col+1, $lc_text);
   }

   $list_box_contents[0][] = array('align' => $lc_align,
                                   'params' => 'class="linkListing-heading"',
                                   'text' => ' ' . $lc_text . ' ');
 }

 if ($listing_split->number_of_rows > 0) {
   $rows = 0;
   $listing_query = tep_db_query($listing_split->sql_query);
   while ($listing = tep_db_fetch_array($listing_query)) {
     $rows++;

     if (($rows/2) == floor($rows/2)) {
       $list_box_contents[] = array('params' => 'class="linkListing-even"');
     } else {
       $list_box_contents[] = array('params' => 'class="linkListing-odd"');
     }

     $cur_row = sizeof($list_box_contents) - 1;
  $openMode = (LINKS_OPEN_NEW_PAGE == 'True') ? 'blank' : 'self';

     for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
       $lc_align = '';

       switch ($column_list[$col]) {
         case 'LINK_LIST_TITLE':
           $lc_align = '';
           $lc_text = $listing['links_title'];
           break;
         case 'LINK_LIST_URL':
           $lc_align = '';
           $lc_text = '<a href="' . tep_get_links_url($listing['links_id']) . '" target="_' . $openMode . '">' . $listing['links_url'] . '</a>';
           break;
         case 'LINK_LIST_DESCRIPTION':
           $lc_align = '';
           $lc_text = $listing['links_description'];
           break;
         case 'LINK_LIST_IMAGE':
           $lc_align = 'center';
           if (tep_not_null($listing['links_image_url'])) {
	 
// Test of ManMachine of contributions "Flash Banners" changed for Links Manager (Koechler Estelle 17/06/05)
	 // Addition of the test if the image is a file flash or an image.
    if ( substr($listing['links_image_url'], -3, 3) == 'swf' ) {
        $size = getimagesize($listing['links_image_url']);
   $size[0] = $size[0]/3;
   $size[1] = $size[1]/3;
      	 $lc_text = '<a href="' . tep_get_links_url($listing['links_id']) . '" target="_' . $openMode . '">' . mm_output_flash_movie_for_link_manager( $listing['links_title'], $listing['links_image_url'] , $size[0]  , $size[1]) . '</a>';
  	 } else {
	 
// End Test of ManMachine of contributions "Flash Banners" changed for Links Manager (Koechler Estelle 17/06/05)              

$lc_text = '<a href="' . tep_get_links_url($listing['links_id']) . '" target="_' . $openMode . '">' . tep_links_image($listing['links_image_url'], $listing['links_title'], LINKS_IMAGE_WIDTH, LINKS_IMAGE_HEIGHT) . '</a>';
              }
   } else {
             $lc_text = '<a href="' . tep_get_links_url($listing['links_id']) . '" target="_' . $openMode . '">' . tep_image(DIR_WS_IMAGES . 'pixel_trans.gif', $listing['links_title'], LINKS_IMAGE_WIDTH, LINKS_IMAGE_HEIGHT, 'style="border: 3px double black"') . '</a>';
           }
           break;
         case 'LINK_LIST_COUNT':
           $lc_align = '';
           $lc_text = $listing['links_clicked'];
           break;
       }

       $list_box_contents[$cur_row][] = array('align' => $lc_align,
                                              'params' => 'class="linkListing-data"',
                                              'text'  => $lc_text);
     }
   }

   new linkListingBox($list_box_contents);
 } else {
   $list_box_contents = array();

   $list_box_contents[0] = array('params' => 'class="linkListing-odd"');
   $list_box_contents[0][] = array('params' => 'class="linkListing-data"',
                                  'text' => TEXT_NO_LINKS);

   new linkListingBox($list_box_contents);
 }

 if ( ($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) {
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
 <tr>
   <td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_LINKS); ?></td>
   <td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_LINKS_DISPLAY, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
 </tr>
</table>
<?php
 }
?>

I utilised a contribution of ManMachine : "Flash Banners". Now, the script functions well. I added the page in the contribution Link manager for those which want to use it. :thumbsup:

Link to comment
Share on other sites

Do the links appear in admin or are they not showing there too? If it is just on the shop side, try replacing all of the files on your shop side. Maybe you have a mixed set or a corrupted file. If they are not showing up in admin too, then I would suspect the database.

 

No, they don't appear in admin either, Categories do, but links don't. I was thinking about database, but not sure what to look for and where.

 

Alex

Absinthe Original Liquor Store

Link to comment
Share on other sites

In that case, the database is probably not being written to. Try submitting a link on your web site. If it shows up in admin, then the problem is with writing to the database in admin.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

OK I did some further testing and this is the result:

Link submitted on web site, English language on, added to admin with status pending. It doesn't appear in German, French or Spanish admin.

Link submitted on web site, German language on, added to German admin only, no status available.

Link submitted on web site, French language on, added to French admin only, no status available.

Same for the Spanish version.

No status of link is available in German, Spanish or French languages (missing text of status). Apart from that all buttons, text, everything looks fine. Categories added in English admin appear in all other languages.

 

Alex

Absinthe Original Liquor Store

Link to comment
Share on other sites

If you can add a link from the shop side and it works, whcih it does, and you can't add it from the admin side, then the files in admin have to be at fault.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

I can add the link from admin too, but it appears in corresponding language only, if added in English, it appears in English (both admin and web) but doesn't exist in other languages. If added (via admin or web, both works fine) from for example French version, it appears in French (both web and admin side) version only, doesn't exist in other languages.

 

I've downloaded V_1.08 again and uploaded all admin files, no change. If you in admin try to "edit link" in all other languages apart from English, the selection button for status is empty - no selection options. Could that be a lead?

 

Alex

Absinthe Original Liquor Store

Link to comment
Share on other sites

I just tried it and it worked fine. When you create a category, do you enter the information for all languages? It won't do it for you automatically.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Yes, when I create a category, I've enetered information for all languages, such as name and description. There is also sort order (0) and status (enable). It immediately appears in different languages in admin (shop too) with same descriptions and status. In Categories section of admin (all languages) you can change status or edit category, you can even see how many links are in each category. In Links section, it's empty. Also the select button for links status (all, pending approved, disabled) is empty. Button's there but no text in it.

 

Jack, this is driving me mad, I've checked everything, all files, all changes but I can see no mistake, could you please have a look at it for me?

 

Thanks very much for your time and help, much appreciated.

 

Alex

Absinthe Original Liquor Store

Link to comment
Share on other sites

Jack,

 

I think that the problem could be with admin/links.php file what you think?

The problem can't be with database if it works fine in English.

If Categories section works fine, it means that admin/link_categories.php file is OK, right?

So, when comparing link_categories.php and links.php I noticed that link_categories contains this string in few places:

$languages = tep_get_languages();
       for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
         $link_categories_name_array = $HTTP_POST_VARS['link_categories_name'];
         $link_categories_description_array = $HTTP_POST_VARS['link_categories_description'];

         $language_id = $languages[$i]['id'];

 

So, should similar looking string be found in links.php too? It's not there or at least not in mine.

 

Could you please point me the right direction? Where else could be the problem? Your help is much appreciated.

 

Alex

Absinthe Original Liquor Store

Link to comment
Share on other sites

I've set up a test site to see if the same failure occurs on it. I'm not sure if I can post the link here so I will PM it to you.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

  • 2 months later...

I installed the latest version of this contribution. I use an earlier version on another site without this problem.

 

When I view the links.php page in the store, it shows 5 columns for categories. This is throwing off the template for the store.

 

Is there any way to change the number of columns listed in the body text of the links.php page?

 

View the problem here

 

Thanks!

Link to comment
Share on other sites

A new version has been uploaded. Here's what was changed:

 

- Changed code in catalog/links.php to display Approved and Waiting links

- Added an optional file in modules which displays the links vertically instead of in a table

- Problem with multiple languages fixed

 

For the language problem, the links_setup.php script assumes all languages are present. It may fail if they are not. The code to check languages isn't in the shop and I didn't want to have to have it installed just for this. If it s a problem, I will add the code to the script. For the update though, there is an update file in the UpdateDocs directory that explains how to add the language updates if you have V 1.09 installed.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

In admin->Maximum Values, set Categories to List per row to what you want it to be.

 

Jack

Great! Thanks.

 

Also, thanks for the vertical link layout. It's awesome. :) You're pretty cool, Jack. B)

Edited by chynathedragon
Link to comment
Share on other sites

Hi Jack,

I have ver 1.04 and would like to go to your 1.10

 

Is the only mysql db addition in 1.10 or do I have to go back and pickup on an older versions mysql additions.

 

Then.. just overwrite my files (effected) with the new ones?

 

Thanks, KJ

define('PROJECTS', 'Something that goes on forever!');

Link to comment
Share on other sites

I really don't know. As you know, for a brief period, seeveral updates came out in a very short time. I didn't document the changes like I should have. However, I can say that the database changes in this last version won't break your shop if you put them in or leave them out. They just fix the language problem mentioned by some people. So an easy test would be to make a backup of your files, upload all of the files in this latest version and see what happens. If it fails, it is because of a database problem. In that case you would need to go through the different versions to see where the database was changed.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

  • 2 weeks later...

I've got links manager on my website and it all works a dream. However, i dont actually control the content. I just control the marketing and design of the website. By default links manager is sending the email address out as [email protected].

 

How can i edit links manager so all link enquiries and replies to confirmation emails are sent to [email protected]?

Link to comment
Share on other sites

Links Manager is using the stores email address. To have the email sent somewhere else, look in the admin->links.php file for this line and change accordingly.

            tep_mail($links_contact_name, $links_contact_email, EMAIL_TEXT_SUBJECT, $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

That is, replace STORE_OWNER_EMAIL_ADDRESS with

'[email protected]'

(notice the single quotes).

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

I've done that but it didnt work :(

 

The email i recieved when i did a test is:

 

From: Company [mailto:[email protected]]

Sent: 21 September 2005 19:17

To: XXXXXXXXX

Subject: Welcome to XXXXXXX link exchange.

 

 

Dear Neil McLoughlin

 

We welcome you to the XXXXXXXX link exchange program.

 

Your link has been successfully submitted at All For You Lingerie. It will be added to our listing as soon as we approve it. You will receive an email about the status of your submittal. If you have not received it within the next 48 hours, please contact us before submitting your link again.

 

For help with our link exchange program, please email the store-owner: sales@wrongdomain.

 

Note: This email address was given to us during a link submittal. If you have a problem, please send an email to [email protected]

 

 

I want the wrongdomain.com to be my personal email address

Link to comment
Share on other sites

That's strange. Try changing the subject in the same way but put something else there (like XXX). Does that show up in the subject line of your received email?

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

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...