Jump to content
Latest News: (loading..)
Sign in to follow this  
VJ

[Contribution] Links Manager for osC v1.00

Recommended Posts

I'm not sure if this is from a contribution or not (I install oscMax which included many contribs already) but for me you have to go your admin and under Administrator there is a section called "File Access".  You should see a directory here called "Links".  Enable this box by clicking the green button and then click on the Links folder to "Store" the files links.php, links_contact.php, and links_category.php.

 

 

That's a oscMax feature, for osC you should just have a link on the left for links, link categories and links contacts. Make sure you added the code to the boxes directory in admin or the links for "links" won't show up.

Share this post


Link to post
Share on other sites
I copied over the admin directory just like it said, but where in the admin screen does the links manager show up? Can anybody help me please?

 

On mine it appears under the tools section on the bottom of the left hand menu in admin

Share this post


Link to post
Share on other sites

I got everything going now. But I get this error, how do I fix it?

 

1146 - Table 'oscommerce_#.links_status' doesn't exist

 

select links_status_id, links_status_name from links_status where language_id = '1'

 

[TEP STOP]

Share this post


Link to post
Share on other sites
I got everything going now. But I get this error, how do I fix it?

 

1146 - Table 'oscommerce_#.links_status' doesn't exist

 

select links_status_id, links_status_name from links_status where language_id = '1'

 

[TEP STOP]

 

Hi,

from where you got the error? Admin or catalog section. If it is from catalog, you may be using the old query. Make sure the table and columns match together. I mean, the name in the database must be the same as in the query.

 

To anyone who knows php please.

I have setup the links manager here: http://www.netpromoservices.com/links.php. Everything works good except that listing is ordered alphabetically, which make a link appears in the first page, and as data increase, link could pass to the second page. Some spiders does not cross over pages, so partners are telling me the link is removed, which is not true. I want to list the links by links_id rather than alphabetically.

I posted the code here, if anyone can give a hand in how to change the sort, I really will appreciate.

thanks

far

Share this post


Link to post
Share on other sites
To anyone who knows php please.

I have setup the links manager here: http://www.netpromoservices.com/links.php. Everything works good except that listing is ordered alphabetically, which make a link appears in the first page, and as data increase, link could pass to the second page. Some spiders does not cross over pages, so partners are telling me the link is removed, which is not true. I want to list the links by links_id rather than alphabetically.

I posted the code here, if anyone can give a hand in how to change the sort, I really will appreciate.

thanks

far

 

I just went to your site, and all your links are now sorted by link ID! Can you let us know how you did that, please!

 

^_^

Share this post


Link to post
Share on other sites
I just went to your site, and all your links are now sorted by link ID!  Can you let us know how you did that, please!

 

^_^

 

 

Nevermind! I figured it out!

Here is is, for anyone else who wants it:

 

in links.php find:

// show the links in a given category
// We show them all
   $listing_sql = "select " . $select_column_list . " l.links_id from " . TABLE_LINKS_DESCRIPTION . " ld, " . TABLE_LINKS . " l, " . TABLE_LINKS_TO_LINK_CATEGORIES . " l2lc where l.links_status = '2' and l.links_id = l2lc.links_id and ld.links_id = l2lc.links_id and ld.language_id = '" . (int)$languages_id . "' and l2lc.link_categories_id = '" . (int)$current_category_id . "'";

   if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {
     for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
       if ($column_list[$i] == 'LINK_LIST_TITLE') {
         $HTTP_GET_VARS['sort'] = $i+1 . 'a';
         $listing_sql .= " order by ld.links_title";
         break;
       }
     }
   } else {
     $sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1);
     $sort_order = substr($HTTP_GET_VARS['sort'], 1);
     $listing_sql .= ' order by ';
     switch ($column_list[$sort_col-1]) {
       case 'LINK_LIST_TITLE':
         $listing_sql .= "ld.links_title " . ($sort_order == 'd' ? 'desc' : '');
         break; 
       case 'LINK_LIST_URL':
         $listing_sql .= "l.links_url " . ($sort_order == 'd' ? 'desc' : '') . ", ld.links_title";
         break; 
       case 'LINK_LIST_IMAGE':
         $listing_sql .= "ld.links_title";
         break;
       case 'LINK_LIST_DESCRIPTION':
         $listing_sql .= "ld.links_description " . ($sort_order == 'd' ? 'desc' : '') . ", ld.links_title";
         break;
       case 'LINK_LIST_COUNT':
         $listing_sql .= "l.links_clicked " . ($sort_order == 'd' ? 'desc' : '') . ", ld.links_title";
         break; 
     }
   }
?>

 

change

$listing_sql .= " order by ld.links_title";

to

$listing_sql .= " order by ld.links_id";

Then change

($sort_order == 'd'

to

($sort_order == 'a'

(if you want it sorted ascending)

 

then under LINK_LIST_URL, LINK_LIST_DESCRIPTION, and LINK_LIST_COUNT, change the end

ld.links_title";

to

ld.links_id";

 

So your finished product should look like this:

// show the links in a given category
// We show them all
   $listing_sql = "select " . $select_column_list . " l.links_id from " . TABLE_LINKS_DESCRIPTION . " ld, " . TABLE_LINKS . " l, " . TABLE_LINKS_TO_LINK_CATEGORIES . " l2lc where l.links_status = '2' and l.links_id = l2lc.links_id and ld.links_id = l2lc.links_id and ld.language_id = '" . (int)$languages_id . "' and l2lc.link_categories_id = '" . (int)$current_category_id . "'";

   if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {
     for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
       if ($column_list[$i] == 'LINK_LIST_TITLE') {
         $HTTP_GET_VARS['sort'] = $i+1 . 'a';
         $listing_sql .= " order by ld.links_id";
         break;
       }
     }
   } else {
     $sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1);
     $sort_order = substr($HTTP_GET_VARS['sort'], 1);
     $listing_sql .= ' order by ';
     switch ($column_list[$sort_col-1]) {
       case 'LINK_LIST_TITLE':
         $listing_sql .= "ld.links_title " . ($sort_order == 'a' ? 'desc' : '');
         break; 
       case 'LINK_LIST_URL':
         $listing_sql .= "l.links_url " . ($sort_order == 'a' ? 'desc' : '') . ", ld.links_id";
         break; 
       case 'LINK_LIST_IMAGE':
         $listing_sql .= "ld.links_title";
         break;
       case 'LINK_LIST_DESCRIPTION':
         $listing_sql .= "ld.links_description " . ($sort_order == 'a' ? 'desc' : '') . ", ld.links_id";
         break;
       case 'LINK_LIST_COUNT':
         $listing_sql .= "l.links_clicked " . ($sort_order == 'a' ? 'desc' : '') . ", ld.links_id";
         break; 
     }
   }
?>

 

Don't know if that's the best way, but it works for me! ^_^

Edited by Taipa

Share this post


Link to post
Share on other sites

Darn it, it stopped working after I added more than 5 links, so there's got to be more than that, sorry. :(

Share this post


Link to post
Share on other sites

something I am having trouble with,, is once i go into the catagory from teh catalot side,, the links list pushes my right col. out and distorts my page,, any one know how to fix this?

 

Thanks

Tom


no bugs in my stuff,,, just random features ;)

Share this post


Link to post
Share on other sites

I'm having trouble keeping my links ordered the way I want. I want them ordered by id descending, and it works great for 10 or fewer links, but the "Next" and "Prev" button (for when there's more than 10 links) switch the sort order to sorting by title, acsending.

I don't know where to edit this "sort=2a" that the next/prev buttons are adding to the URL. Any help would be appreciated!

Share this post


Link to post
Share on other sites
Here is the issue, as it was written, it sort the links inside a category alphabetically, which means that as we increase the data, a particular link could be today in page 1, but tomorrow in page 2.

As many link exchange websites are using spiders to check if the link is still up, the spider will look at page 1, but when the link is moved to page 2, it can't find it.

This is happening to me now. I'm getting emails from partners notifying the link is broken.

 

One way round this (it doesn't change the sort order though) is to hard code a value in for number of links per page in link_listing.php in includes/modules.

 

It is written to take the value set up in admin for search results. If you set that value to 10 then you get 10 links per page, 10 products per page, etc. Hardcode link_listing.php to a higher value and you get more links but still get the defualt products per page.

 

If I was a link partner I'd want to always be on the first page as there is no incentive for a customer to want to click to extra pages.

Share this post


Link to post
Share on other sites

Is it me or have i got half a contribution?

 

i don't have upload.php or validate.php, and i cant find them either.

And i get the 1146 error which everybody seems to have got...How did u get rid of it?

 

Thanks

Steve

Edited by Stevis2002

Share this post


Link to post
Share on other sites

I've installed Links Manager and aside from one thing, it works great. Howeverthat one thing is crppling. Every time someone clicks continue after entering their link info they receive one of the following errors depending on their browser.

"connection refused" or "DNS Error". any ideas on what may be the problem? I really don't want to be adding links manually.

Share this post


Link to post
Share on other sites

I just uploaded a new version.

 

Changes made:

- Added Find image to search string

- Moved link count to beside the category name instead of below it

- Added setting in admin to control the showing of category images

- Added setting in admin to show link titles as links

- Added code to check all links at one time

- Added code to disable errors on failed opens. Should get rid of an existing bug.

 

To upgrade from version 1.6, the database will need to be updated.

First - Go to admin->tools and backup the database. If the database is corrupted in some way, which it shouldn't be, this will allow you to easily recover from it.

 

In order for the following to display correctly, you need to know the existing group_id for Links Manager. So go into phpmyadmin, select your database and then click on the configuration_group table (left column). Then click on the Browse tab. On the resulting page, scroll down until you find Links as the title. Write down the configuration_group_id associated with it.

 

Then, select the SQL tab. In the box on that page, paste the following

 INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Display Link Title as links', 'TITLES_AS_LINKS', 'False', 'Make the links title a link.', '18', '16', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())

and

 INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Display Links Category images', 'SHOW_LINKS_CATEGORIES_IMAGE', 'True', 'Display the images for the Links Categories.', '18', '17', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())

Replace the 18 above with the number you wrote down above. Click Go and the update should be completed. Go to configuration in admin and verify the new entry is listed and works.

 

For the Check All Links option, how many you can check will depend on your hosts settings. I have added a time out statement (see line 504 of admin/links.php). This can be increased if you are having timeout problems although some hosts won't allow it and you may have to remove it altogether to get it to work.

 

Jack

Share this post


Link to post
Share on other sites

I must have missed something. I am getting an error

 

switch on action = update

 

Warning: Cannot modify header information - headers already sent by (output started at /home/deb/public_html/catalog/admin/links.php:41) in /home/deb/public_html/catalog/admin/includes/functions/general.php on line 18

 

Can anyone tell me what I have done wrong or forgotten to do ?

Share this post


Link to post
Share on other sites

The headers already sent message occurs when there is an extra space either at the beginning or the end of a file. It isn't possible to tell which file but it will be one of the ones that was just changed. Open those files for editing and make sure the very first chanracter in them is <. Then place the cursor at the very end of the file and backspace until you reach the >.

 

Jack

Share this post


Link to post
Share on other sites
The headers already sent message occurs when there is an extra space either at the beginning or the end of a file.

Jack

 

Very good - you were right - found it and I fixed it.

 

 

Great contribution ! I can only imagine how much work this has been for you.

 

Since I am upgrading, I didnt make all changes to the files since they had been done previously. Just want to double check with you on one thing -

When editing a link - at the very top of the screen - it has

"switch on action = edit" - is this because I have forgotten to do something ? or is it meant to be there ? It then disappears once I change the status.

 

 

Thank you so much !

Share this post


Link to post
Share on other sites

That's caused by a statement I was using for working on the code. I serves no purpose now. It doesn't hurt anything being in there except for the message it displays. If you open admin/links.php and loot line 41 your should see

 echo 'switch on action = '.$action.'<br>';

Just delete that line to remove it.

 

Jack

Share this post


Link to post
Share on other sites
Very good - you were right - found it and I fixed it.

 

Can you tell us what file you found the white space??

 

Thanks.


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

Share this post


Link to post
Share on other sites

hi, ive sorry i posted this in the other topic. I didnt realise it was ment to be here:

 

When i do step 3 in the instructions "Fire up your browser and run /catalog/links_setup.php, to update your database." i keep getting the message "Parse error: parse error, unexpected ',' in /home/abdhqx/public_html/links_setup.php on line 69". Ive looked at the code but i only really have a basic knoledge of php so i might be missing something.

Share this post


Link to post
Share on other sites

I find it funny. I have a test oscommerce set up and then an additional 2 stores. I had version 1.01 installed and am upgrading to v 1.07It amazes me how installing the same contribution on all 3 can get such different results.

 

I made the database change to 'Display Link Titles as Links' It appeared in my admin configuration. I set it to True - but the links wont appear as Links on my store.

 

Everything works fine except this.

 

What file have I missed on? - I uploaded all the new files for 1.07

 

 

 

(so I went and added the code to the database again, thinking that was wrong, now I have 2 links for the Link Titles in Admin * will that cause a problem?

Share this post


Link to post
Share on other sites
hi, ive sorry i posted this in the other topic. I didnt realise it was ment to be here:

 

When i do step 3 in the instructions "Fire up your browser and run /catalog/links_setup.php, to update your database." i keep getting the message "Parse error: parse error, unexpected ',' in /home/abdhqx/public_html/links_setup.php on line 69". Ive looked at the code but i only really have a basic knoledge of php so i might be missing something.

That's a mistake in the links_setup.php file. Search for this code
                      array("INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Display Link Title as links', 'TITLES_AS_LINKS', 'False', 'Make the links title a link.', '" . $configuration_group_id . "', '8', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"));

and change it to

                      array("INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Display Link Title as links', 'TITLES_AS_LINKS', 'False', 'Make the links title a link.', '" . $configuration_group_id . "', '8', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"),

You should restore your database first so you don't get duplicate entries.

 

Jack

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  

×