Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Links Manager for osC v1.00


VJ

Recommended Posts

Jack,

 

As well as the above for the next version this would be cool to:

 

http://www.oscommerce.com/forums/index.php?sho...678&st=740#

 

here the .htaccess bit

RewriteRule ^(.*)-links-(.*).html$ links.php?lPath=$2&%{QUERY_STRING}

 

Thanks,

 

Eric

Edited by matrix2223
Link to comment
Share on other sites

  • Replies 1.1k
  • Created
  • Last Reply

Top Posters In This Topic

I tried that and it still wasn't working. When I clicked on a category, it showed up as &lPath=# instead of the name of the category. I did some digging and found a fix. The only thing now is getting the category name to display on the title bar :P

 

This is what I had to do to get "Links Manager V 1.14b" and "Ultimate SEO URLs - 2.1d" to play nice together.

 

In /catalog/includes/classes/seo.class.php

 

In the function href_link, I changed:

 

		if ( !in_array($page, $this->attributes['SEO_PAGES']) || $this->attributes['SEO_ENABLED'] == 'false' ) {
		return $this->stock_href_link($page, $parameters, $connection, $add_session_id);
	}

 

To

 

		if (( !in_array($page, $this->attributes['SEO_PAGES']) || $this->attributes['SEO_ENABLED'] == 'false' ) && ($page != FILENAME_LINKS)) {
		return $this->stock_href_link($page, $parameters, $connection, $add_session_id);
	}

 

Because it was erasing the html link parameters.

 

Then in the function parse_parameters, I added:

 

				case 'lPath':
					switch(true){
				case ($page == FILENAME_LINKS):
					  $url = $this->make_url($page, $this->get_link_name($p2[1]), $p2[0], $p2[1], '.html', $separator);
					  break;
				default:
			  $container[$p2[0]] = $p2[1];
			  break;
				} # end switch
					break;

 

right after the "break;" and right before "case 'cPath':"

 

Then I added the function

 

	function get_link_name($lPath){
	switch(true){
		case ($this->attributes['USE_SEO_CACHE_GLOBAL'] == 'true' && defined('LINK_NAME_' . $lPath)):
			$this->performance['CACHE_QUERY_SAVINGS']++;
			$return = constant('LINK_NAME_' . $lPath);
			$this->cache['LINKS'][$lPath] = $return;
			break;
		case ($this->attributes['USE_SEO_CACHE_GLOBAL'] == 'true' && isset($this->cache['LINKS'][$lPath])):
			$this->performance['CACHE_QUERY_SAVINGS']++;
			$return = $this->cache['LINKS'][$lPath];
			break;
		default:
			$this->performance['NUMBER_QUERIES']++;
			$sql = "SELECT link_categories_name as lName
				FROM ".TABLE_LINK_CATEGORIES_DESCRIPTION."
				WHERE link_categories_id='".(int)$lPath."'
				AND language_id='".(int)$this->languages_id."'
				LIMIT 1";
			$result = $this->DB->FetchArray( $this->DB->Query( $sql ) );
			$lName = $this->strip( $result['lName'] );
			$this->cache['ARTICLES'][$aID] = $lName;
			$this->performance['QUERIES']['TOPICS'][] = $sql;
			$return = $lName;
			break;
	} # end switch
	return $return;
} # end function

 

right before the function "function get_category_name(&$cID){"

 

In the function SEO_URL, I changed:

 

		$this->reg_anchors = array('products_id' => '-p-',
							   'cPath' => '-c-',
							   'manufacturers_id' => '-m-',
							   'pID' => '-pi-',
							   'tPath' => '-t-',
							   'articles_id' => '-a-',
							   'products_id_review' => '-pr-',
							   'products_id_review_info' => '-pri-',
							   'info_id' => '-i-'
							   );

 

To

 

		$this->reg_anchors = array('products_id' => '-p-',
							   'cPath' => '-c-',
							   'manufacturers_id' => '-m-',
							   'pID' => '-pi-',
							   'tPath' => '-t-',
							   'articles_id' => '-a-',
							   'products_id_review' => '-pr-',
							   'products_id_review_info' => '-pri-',
							   'info_id' => '-i-',
							   'lPath' => '-links-'
							   );

 

After that, then when I click on a link category, it displays the SEO URL instead of lPath=#.

 

But the email link was giving me issues and I made a little change there also. Around line 205 in the file "/catalog/admin/links.php", I changed:

$siteURL = sprintf("%s/%s-links-%s.html", HTTP_CATALOG_SERVER, $catname, $category['link_categories_id']);

 

To

 

$siteURL = sprintf("%s%s-links-%s.html", HTTP_CATALOG_SERVER . DIR_WS_CATALOG, strtolower($catname), $category['link_categories_id']);

 

The catalog dir was missing from the link and I like all lowercase links so I added that also. Now its working fine ;)

Link to comment
Share on other sites

I've made the split page fix, but now I'm getting the following message when I go to add a link:

 

1054 - Unknown column 'l.links_category_suggest' in 'field list'

 

select l.links_id, ld.links_title, l.links_url, ld.language_id, ld.links_description, l.links_contact_email, l.links_status, l.links_image_url, l.links_contact_name, l.links_reciprocal_url, l.links_category_suggest, l.links_status, l.links_rating from links l left join links_description ld on ld.links_id = l.links_id where ld.links_id = l.links_id and l.links_id = '0'

 

How do I fix this - many thanks

Link to comment
Share on other sites

That means you are missing a required field from the database. If you are doing an update, you need to be sure to run the update database file.

 

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

Just a note for the record. THis may have already been addressed so I'll keep it short.

 

I installed V1.13 which is smooth! A great contribution, thanx. I was having a problem with validating my OSC link on an outside page.

 

My OSC site is running as a add-on domain, so the auto install program grabbed my main domain and inserted it into my configuration db file under LINKS_CHECK_PHRASE. Once I updated the record, everything works great!

 

Thanx again for the contribution,

 

Ed

Link to comment
Share on other sites

Thank-you that has sorted out that error message.

I promise that this will be the last thing that I ask (thank you so much for your help so far).

 

I'm getting the following messsages - I realise that it's because the database hasnt been updated, I'm not sure why it isnt being changed after running the script. Could you provide me with the sql to fix these.

 

Many thanks in advance, Dawn

 

1146 - Table 'links_featured' doesn't exist

1146 - Table 'links_check' doesn't exist

Link to comment
Share on other sites

Thank-you that has sorted out that error message.

I promise that this will be the last thing that I ask (thank you so much for your help so far).

 

I'm getting the following messsages - I realise that it's because the database hasnt been updated, I'm not sure why it isnt being changed after running the script. Could you provide me with the sql to fix these.

 

Many thanks in advance, Dawn

 

1146 - Table 'links_featured' doesn't exist

1146 - Table 'links_check' doesn't exist

It looks like you missed an update file. See update_changes_v_1.10_to_1.13.txt in the Update_Docs directory. It has the sql for the above as well as others that you probably need.

 

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

This might be useful to someone. I added a category filter so that it only shows links from a selected category. This works in conjunction with the status filter. For instance, you can select a category and then select a status, and will show link from the selected category with the selected status.

 

Tested on SQL4/PHP4 and SQL5/PHP5

 

link_manager_category_filter.gif

 

File: /catalog/admin/links.php

 

Directly above:

  $showLinkStatus = 'All';
 $links_statuses = array();
 $linkShow = array();
 $links_status_array = array();
 $links_status_query = tep_db_query("select links_status_id, links_status_name from " . TABLE_LINKS_STATUS . " where language_id = '" . (int)$languages_id . "'");
 $linkShow[] = array('id' => 'All', 'text' => 'All');
 while ($links_status = tep_db_fetch_array($links_status_query)) {
$linkShow[] = $links_statuses[] = array('id' => $links_status['links_status_id'],
						   'text' => $links_status['links_status_name']);
$links_status_array[$links_status['links_status_id']] = $links_status['links_status_name'];
 }

 

Add:

  $showLinkCategory = 'All';
$links_categories = array();
$linkShowCat = array();
$links_category_array = array();
$links_categories_query = tep_db_query("select link_categories_id, link_categories_name from " . TABLE_LINK_CATEGORIES_DESCRIPTION . " where language_id = '" . (int)$languages_id . "'");
$linkShowCat[] = array('id' => 'All', 'text' => 'All');
 while ($links_category = tep_db_fetch_array($links_categories_query)) {
$linkShowCat[] = $links_categories[] = array('id' => $links_category['link_categories_id'],
						   'text' => $links_category['link_categories_name']);
$links_category_array[$links_category['link_categories_id']] = $links_category['link_categories_name'];
 }

 if (isset($_GET['links_category_list'])) 
$showLinkCategories = $_GET['links_category_list'];

 

Change:

	  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr><?php echo tep_draw_form('search', FILENAME_LINKS, '', 'get'); ?>
		<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
		<td class="main" align="right"><?php echo tep_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td>
		<td class="main" align="right">Status: <?php echo tep_draw_pull_down_menu('links_status_list', $linkShow, '',  'onChange="this.form.submit();"');?></td>
		<td class="smallText" align="right"><?php echo HEADING_TITLE_SEARCH . ' ' . tep_draw_input_field('search'); ?></td>
	  </form></tr>
	</table></td>
  </tr>

 

To:

	  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr><?php echo tep_draw_form('search', FILENAME_LINKS, '', 'get'); ?>
		<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
		<td class="main" align="right"><?php echo tep_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td>
		<td class="main" align="right">Category: <?php echo tep_draw_pull_down_menu('links_category_list', $linkShowCat, '',  'onChange="this.form.submit();"');?></td>
		<td class="main" align="right"><?php echo tep_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td>
		<td class="main" align="right">Status: <?php echo tep_draw_pull_down_menu('links_status_list', $linkShow, '',  'onChange="this.form.submit();"');?></td>
		<td class="smallText" align="right"><?php echo HEADING_TITLE_SEARCH . ' ' . tep_draw_input_field('search'); ?></td>
	  </form></tr>
	</table></td>
  </tr>

 

Change:

	if ($showLinkStatus == 'All')
  $links_query_raw = "select l.links_id, l.links_url, l.links_image_url, l.links_date_added, l.links_last_modified, l.links_status, l.links_clicked, ld.links_title, ld.links_description, l.links_contact_name, l.links_contact_email, l.links_reciprocal_url, l.links_status from " . TABLE_LINKS . " l left join " . TABLE_LINKS_DESCRIPTION . " ld on l.links_id = ld.links_id " . $search . " order by " . $order;
else
  $links_query_raw = "select l.links_id, l.links_url, l.links_image_url, l.links_date_added, l.links_last_modified, l.links_status, l.links_clicked, ld.links_title, ld.links_description, l.links_contact_name, l.links_contact_email, l.links_reciprocal_url, l.links_status from " . TABLE_LINKS . " l left join " . TABLE_LINKS_DESCRIPTION . " ld on l.links_id = ld.links_id where l.links_status = '" . $showLinkStatus . "'" . $search . " order by " . $order;

 

To:

	if (isset($_GET['links_status_list']) && $showLinkStatus != 'All' && isset($_GET['links_category_list']) && $showLinkCategories != 'All') {
		$links_query_raw = "select l.links_id, l.links_url, l.links_image_url, l.links_date_added, l.links_last_modified, l.links_status, l.links_clicked, ld.links_title, ld.links_description, l.links_contact_name, l.links_contact_email, l.links_reciprocal_url, l.links_status  from " . TABLE_LINKS . " l left join " . TABLE_LINKS_DESCRIPTION . " ld on l.links_id = ld.links_id left join " . TABLE_LINKS_TO_LINK_CATEGORIES . " l2lc on l.links_id = l2lc.links_id where l.links_status = '" . $showLinkStatus . "' and l2lc.link_categories_id = '" . $showLinkCategories . "'" . $search . " order by " . $order;
	}
	elseif (isset($_GET['links_status_list']) && $showLinkStatus != 'All') {
		$links_query_raw = "select l.links_id, l.links_url, l.links_image_url, l.links_date_added, l.links_last_modified, l.links_status, l.links_clicked, ld.links_title, ld.links_description, l.links_contact_name, l.links_contact_email, l.links_reciprocal_url, l.links_status from " . TABLE_LINKS . " l left join " . TABLE_LINKS_DESCRIPTION . " ld on l.links_id = ld.links_id where l.links_status = '" . $showLinkStatus . "'" . $search . " order by " . $order;
	}
	elseif (isset($_GET['links_category_list']) && $showLinkCategories != 'All') {
		$links_query_raw = "select l.links_id, l.links_url, l.links_image_url, l.links_date_added, l.links_last_modified, l.links_status, l.links_clicked, ld.links_title, ld.links_description, l.links_contact_name, l.links_contact_email, l.links_reciprocal_url, l.links_status  from " . TABLE_LINKS . " l left join " . TABLE_LINKS_DESCRIPTION . " ld on l.links_id = ld.links_id left join " . TABLE_LINKS_TO_LINK_CATEGORIES . " l2lc on l.links_id = l2lc.links_id where l2lc.link_categories_id = '" . $showLinkCategories . "'" . $search . " order by " . $order;
	}
else {
		$links_query_raw = "select l.links_id, l.links_url, l.links_image_url, l.links_date_added, l.links_last_modified, l.links_status, l.links_clicked, ld.links_title, ld.links_description, l.links_contact_name, l.links_contact_email, l.links_reciprocal_url, l.links_status from " . TABLE_LINKS . " l left join " . TABLE_LINKS_DESCRIPTION . " ld on l.links_id = ld.links_id " . $search . " order by " . $order;
}

 

Later

Link to comment
Share on other sites

One last thing, the category drop-down above is sorted by id, to sort alphabetically, just change:

 

$links_categories_query = tep_db_query("select link_categories_id, link_categories_name from " . TABLE_LINK_CATEGORIES_DESCRIPTION . " where language_id = '" . (int)$languages_id . "'");

To

 

$links_categories_query = tep_db_query("select link_categories_id, link_categories_name from " . TABLE_LINK_CATEGORIES_DESCRIPTION . " where language_id = '" . (int)$languages_id . "' order by link_categories_name");
Link to comment
Share on other sites

Hi,

 

After many hours on the Links Manager code, I have failed to display more links in the Featured Link Area (3 links in the same time were perfect for me).

Is there an alternative trick about it?

 

Thanks.

Osc v2.3.4 BS "custom"
PHP 7.3 compatible (710 modified files => o_O')

Link to comment
Share on other sites

Hi,

 

After many hours on the Links Manager code, I have failed to display more links in the Featured Link Area (3 links at the same time were perfect for me).

Is there an alternative trick about it?

 

Thanks.

 

PS : Sorry for double post :sweating:

Edited by milerwan

Osc v2.3.4 BS "custom"
PHP 7.3 compatible (710 modified files => o_O')

Link to comment
Share on other sites

The code loads a random featured link and displays it. If you want to show more than one at a time, you will need to cycle through the returned links and change the code to allowing shoing more than one.

 

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 have os 2.2 and installed the 1.15 version of the link manager I fought through the configs and I have a working links manager and config under admin but when I click on the links link on my catalog site I get the following error

 

Fatal error: Call to undefined function tep_get_languages() in /www/htdocs/pndtools/catalog/links.php on line 22

 

Any help would be great

Link to comment
Share on other sites

Hi

I just unpack Links Manager V1.15 and all seems to be working, no parse errors, received emails when i added a couple of test URL's.

Went into Admin and fixed site info BUT.... where do i "validate or Activate" submittrd URL's so they become active........the links

are not displaying in "mysite.com/links.php"

 

I only have two options in the Admin area Admin/config/links & Admin/config/links-info_boxes_config.

 

 

Thxz

Paul

Link to comment
Share on other sites

I have installed this contribution (or a slightly later version of it) and have stumbled across a problem.

 

Has anyone ever tried to get an oscommerce shop with this module to link to another oscommerce shop with this module.

 

Its impossible as both websites require the link to be on the other one first!

Based on OsCommerce 2.2 MS2 - Mods Including: Customer Approval, STS Template System, OS-CMS, Sage Line 50 Sync, Locate a Stockist, Auto Thumbnailer, Easy Populator, Visitors Stats, Extra Images, Header Tags Controller, Unsold Cart, Products w/o Description/Prices/Images Reports, Backup Customers Table, Login to See Prices. Full customised products_info.php page. OSC Links Manager. Minimum Order Amount. Visitor Web Stats. Google Sitemap. All products page (user sitemap).

 

The OsCommerce Site is hosted on 1 domain with 20 feeder domains extracting data from OS-CMS & the shop catalogue.

 

If you would like to view my website in relation to any of my posts you can google my forum username to find my URL or add a (dot)co(dot)uk to the end of it.

Link to comment
Share on other sites

You would have to enter the other sites link on yours using the admin panel and then submit your link to the other site. If you don't want to add the link first, you could ask the other site to do it. But if they refuse, then you can't exchange links with that site.

 

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 was just wondering how you guys deal with link exchange programs that use the contribution. For instance, someone asks if I want to exchange links, I say yes. Then I post their link on my website (because they initiated the exchange, if I do, it's vise-versa) and send them the reciprocal link. Then I have to wait for them to add my link to their website and the exchange is complete.

 

But it's hard to keep track of a bunch of links to make sure they followed up on their end. And the only way to have the link displayed on the link page is to give it the approved status (yes? no?). I was wondering if there is a status I could set links (such a pending or waiting) where they will appear on the links page but I will know that those are awaiting exchange completion?

 

What is the difference between pending and waiting? Perhaps pending could apply to submitted links and waiting could apply to exchanges? Where waiting would be visible on the links page but incomplete?

 

TIA

Link to comment
Share on other sites

Hi,

 

I just installed version 1.15 and where is this text in the site for this define? The text does not show on the links_submit.php page.

define('TEXT_MAIN', 'Please fill out the following form to submit your website.');

That listing is in the includes/languages/english/links_submit.php file and this:

 

<?php } else { ?>

<td class="smallText"><br><?php echo TEXT_MAIN; ?></td>

is also in the catalog/links_submit.php file but this text does not show up on the site.

 

Thanks!

Link to comment
Share on other sites

I was just wondering how you guys deal with link exchange programs that use the contribution. For instance, someone asks if I want to exchange links, I say yes. Then I post their link on my website (because they initiated the exchange, if I do, it's vise-versa) and send them the reciprocal link. Then I have to wait for them to add my link to their website and the exchange is complete.

 

But it's hard to keep track of a bunch of links to make sure they followed up on their end. And the only way to have the link displayed on the link page is to give it the approved status (yes? no?). I was wondering if there is a status I could set links (such a pending or waiting) where they will appear on the links page but I will know that those are awaiting exchange completion?

 

What is the difference between pending and waiting? Perhaps pending could apply to submitted links and waiting could apply to exchanges? Where waiting would be visible on the links page but incomplete?

 

TIA

There is a check links script that can be ran using cron so that the links are checked on a regualr basis. See the documentation.

 

Pending was probably meant for that in the original release but wasn't used. It will be removed in the next release.

 

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

Hi,

 

I just installed version 1.15 and where is this text in the site for this define? The text does not show on the links_submit.php page.

 

That listing is in the includes/languages/english/links_submit.php file and this:

is also in the catalog/links_submit.php file but this text does not show up on the site.

 

Thanks!

That is in the links_submit.php file in the english directory of v 1.14 (mine). I don't support any of the other versions for this very reason so I can't tell you if that is the only problem or not with the version you are using.

 

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