Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Links Manager for osC v1.00


VJ

Recommended Posts

The code is working according to this page. My guess is that something is wrong with how the link is set up in admin.

 

Jack

Support Links:

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

All of My Addons

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

Hi,

 

The problem was that the sql file in the instructions had a language value of 3 instead of 1 and the statuses did not show up. Once these were changed to 1 for english then the statuses showed up so the store owner could approve the sites.

Link to comment
Share on other sites

Is there a way to turn off the reciprocal link?
Not currently, without editing the code. Someone else requested this and it is planned.

 

Jack

Support Links:

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

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Not really, at least on my part. One of the main purposes of the contribution is for SEO and having nested directories works against that.

 

Jack

Support Links:

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

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Can anyone help with this error I've received after installing this contrib for the first time:

 

Fatal error: Cannot redeclare tep_show_category() (previously declared 
in /includes/header.php:221)
in /includes/boxes/categories.php on line 13

 

Would really like to go live after i figure this out. Any help would be much appreciated.

 

Thank you.

Link to comment
Share on other sites

That function isn't used by Links Manager. You have some code that is calling it twice. You will need to isolate which file is causing the problem.

 

Jack

Support Links:

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

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Hi,

 

I have another problem with the "check link" feature in the admin.

 

What is this suppose to do?

 

Each time I click to check the link it says it is not there but it is clearly there on the website.

 

Thanks!

Link to comment
Share on other sites

That function isn't used by Links Manager. You have some code that is calling it twice. You will need to isolate which file is causing the problem.

 

Jack

 

I'm using a template. A few pages back a guy was having the same problem but I can't understand how he fixed it. If I understand the problem it looks like the template is conflicting with the links manager files because they are both trying to display the categories, right? If so how where would I comment out the code in the links manager program so that my site calls up the format I want and at the same time eliminating the duplicate calling?

Link to comment
Share on other sites

Hi,

 

I have another problem with the "check link" feature in the admin.

 

What is this suppose to do?

 

Each time I click to check the link it says it is not there but it is clearly there on the website.

 

Thanks!

 

 

I can answer this one....it's testing the location of the reciprocal link on the website where you are trading links. It is verifying that your link exists on their website.

Link to comment
Share on other sites

Oh so if the store owners link isn't on the other site then it gives a negative...

 

I guess when someone fills out the links form to add their link then they should always give the url of their reciprocal link on their website.

 

That's really nice!

 

The problem is with this customer that he had a list of links that he added to his site but the other people did not reciprocate or didn't have to at the time...what a bummer!

 

Thanks!

Link to comment
Share on other sites

I'm using a template. A few pages back a guy was having the same problem but I can't understand how he fixed it. If I understand the problem it looks like the template is conflicting with the links manager files because they are both trying to display the categories, right? If so how where would I comment out the code in the links manager program so that my site calls up the format I want and at the same time eliminating the duplicate calling?
A common trend with the template makers is to pull the function from the function directory and place it in the header file. What I do for a quick fix, if that is the case here, is to find the two occurrences of it in the header file and rename it to something else (like my_tep_show_category).

 

Jack

Support Links:

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

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

A common trend with the template makers is to pull the function from the function directory and place it in the header file. What I do for a quick fix, if that is the case here, is to find the two occurrences of it in the header file and rename it to something else (like my_tep_show_category).

 

Jack

 

I can't make it work. I attached my header file hoping you could help me out. But how come my site works normally in every other way except with this contrib added? I added other contribs. And will this change alter the look of my site that I'm trying to achieve with the template? here's the file...

<?php
/*
 $Id: header.php,v 1.42 2003/06/10 18:20:38 hpdl Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

// check if the 'install' directory exists, and warn of its existence
 if (WARN_INSTALL_EXISTENCE == 'true') {
if (file_exists(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/install')) {
  $messageStack->add('header', WARNING_INSTALL_DIRECTORY_EXISTS, 'warning');
}
 }

// check if the configure.php file is writeable
 if (WARN_CONFIG_WRITEABLE == 'true') {
if ( (file_exists(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/includes/configure.php')) && (is_writeable(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/includes/configure.php')) ) {
  $messageStack->add('header', WARNING_CONFIG_FILE_WRITEABLE, 'warning');
}
 }

// check if the session folder is writeable
 if (WARN_SESSION_DIRECTORY_NOT_WRITEABLE == 'true') {
if (STORE_SESSIONS == '') {
  if (!is_dir(tep_session_save_path())) {
	$messageStack->add('header', WARNING_SESSION_DIRECTORY_NON_EXISTENT, 'warning');
  } elseif (!is_writeable(tep_session_save_path())) {
	$messageStack->add('header', WARNING_SESSION_DIRECTORY_NOT_WRITEABLE, 'warning');
  }
}
 }

// check session.auto_start is disabled
 if ( (function_exists('ini_get')) && (WARN_SESSION_AUTO_START == 'true') ) {
if (ini_get('session.auto_start') == '1') {
  $messageStack->add('header', WARNING_SESSION_AUTO_START, 'warning');
}
 }

 if ( (WARN_DOWNLOAD_DIRECTORY_NOT_READABLE == 'true') && (DOWNLOAD_ENABLED == 'true') ) {
if (!is_dir(DIR_FS_DOWNLOAD)) {
  $messageStack->add('header', WARNING_DOWNLOAD_DIRECTORY_NON_EXISTENT, 'warning');
}
 }

 if ($messageStack->size('header') > 0) {
echo $messageStack->output('header');
 }
?>
<!--




<?   // ---- MANUFACTURERS


 $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name");
 if ($number_of_rows = tep_db_num_rows($manufacturers_query)) {

  echo '<table cellspacing=0 cellpadding=0 width=177 align=center> '.
		  tep_draw_form('manufacturers', tep_href_link(FILENAME_DEFAULT, '', 'NONSSL', false), 'get')
		 .' <tr><td colspan=2><b>Search by manufacturers:</b></td></tr>
			<tr><td height=2 colspan=2></td></tr>
			<tr><td colspan=2>
	   ';	  

  $manufacturers_array = array();
  while ($manufacturers = tep_db_fetch_array($manufacturers_query)) {
	$manufacturers_name = ((strlen($manufacturers['manufacturers_name']) > MAX_DISPLAY_MANUFACTURER_NAME_LEN) ? substr($manufacturers['manufacturers_name'], 0, MAX_DISPLAY_MANUFACTURER_NAME_LEN) . '..' : $manufacturers['manufacturers_name']);
	$manufacturers_array[] = array('id' => $manufacturers['manufacturers_id'],
								   'text' => $manufacturers_name);
  }

  echo tep_draw_pull_down_menu('manufacturers_id', $manufacturers_array, (isset($HTTP_GET_VARS['manufacturers_id']) ? $HTTP_GET_VARS['manufacturers_id'] : ''), 'onChange="this.form.submit();" size="' . MAX_MANUFACTURERS_LIST . '" class=se1') . tep_hide_session_id();
  echo ' </td>
	  </form>
	 </table>
	   ';
 }

?>


-->

 <table cellspacing=0 cellpadding=0 align=center>
 <tr><td height=10></td></tr>
 <tr><td>

 <table cellspacing=0 cellpadding=0 width=757 align=center bgcolor=#ffffff>   
 <tr><td>
<table cellspacing=0 cellpadding=0 width=715 align=center>
<tr><td>

	<table cellspacing=0 cellpadding=0
	 <tr><td height=33 colspan=2></td></tr>
	 <tr><td><a href=<?tep_href_link('index.php')?>><img src=images/m01.jpg width=173 height=62 border=0></a></td>
		 <td background=images/m05.gif width=542 height=62>
		  <table cellspacing=0 cellpadding=0>
		   <tr><td width=173>
				<table cellspacing=0 cellpadding=0 width=137 align=center>
				 <tr><td height=12></td></tr>
				 <tr><td class=ch>Order by Phone:</td></tr>
				 <tr><td height=7></td></tr>
				 <tr><td style="padding-right:20px">
 <font face="arial" color="#A9A954" size="1">? (888) 512-6759</font>
			   </td></tr>
				 <tr><td height=7></td></tr>
				</table>
			   </td>
			   <td width=170>
				<table cellspacing=0 cellpadding=0 width=137 align=center>
				 <tr><td height=13></td></tr>
				 <tr><td class=ch>Shop by Price:</td></tr>
				 <tr><td height=4></td></tr>
				 <tr><td>
<? // CURRENCIES

echo tep_draw_form('currencies', tep_href_link(basename($PHP_SELF), '', $request_type, false), 'get');

reset($currencies->currencies);
$currencies_array = array();
while (list($key, $value) = each($currencies->currencies)) {
  $currencies_array[] = array('id' => $key, 'text' => $value['title']);
}

$hidden_get_variables = '';
reset($HTTP_GET_VARS);
while (list($key, $value) = each($HTTP_GET_VARS)) {
  if ( ($key != 'currency') && ($key != tep_session_name()) && ($key != 'x') && ($key != 'y') ) {
	$hidden_get_variables .= tep_draw_hidden_field($key, $value);
  }
}

echo tep_draw_pull_down_menu('manufacturers_id', $manufacturers_array, (isset($HTTP_GET_VARS['manufacturers_id']) ? $HTTP_GET_VARS['manufacturers_id'] : ''), 'onChange="this.form.submit();" size="' . MAX_MANUFACTURERS_LIST . '" class=se1') . tep_hide_session_id();
  echo '</form>';

?>			   
			  </td></tr>
				 <tr><td height=9></td></tr>
				</table>
			   </td>
			   <td width=199>
				<table cellspacing=0 cellpadding=0 width=175 align=center>
				 <tr><td height=13></td></tr>
				 <tr><td class=ch>Shopping Cart:</td></tr>
				 <tr><td height=6></td></tr>

				 <tr><td class=tx>now in your shopping cart <b><a class=ml href=<?=tep_href_link('shopping_cart.php')?>><font color=#999943><?=$cart->count_contents()?> items</font></a></b></td></tr>
				 <tr><td height=9></td></tr>
				</table>
		   </td></tr>
		  </table>
	 </td></tr>
	 <tr><td height=4 colspan=2></td></tr>
	</table>
	<table cellspacing=0 cellpadding=0>
	 <tr><td>
		  <table cellspacing=0 cellpadding=0>
		  <tr><td><a href=<?=tep_href_link('index.php')?>><img src=images/m06.gif width=169 height=39 border=0></a></td></tr>
		   <tr><td><a href=<?=tep_href_link('products_new.php')?>><img src=images/m07.gif width=169 height=39 border=0></a></td></tr>
		   <tr><td><a href=<?=tep_href_link('account.php')?>><img src=images/m08.gif width=169 height=39 border=0></a></td></tr>
		   <tr><td><a href=<?=tep_href_link('shopping_cart.php')?>><img src=images/m09.gif width=169 height=39 border=0></a></td></tr>
		   <tr><td><a href=<?=tep_href_link('checkout_shipping.php')?>><img src=images/m10.gif width=169 height=39 border=0></a></td></tr>
		  </table>
		 </td>
		 <td width=4></td>
		 <td><a href="http://www.pinevalleygiftbaskets.com/spa-bath-c-66.html"><img border="0" src="images/m11.jpg" alt="Spa Gift Baskets" width="173" height="195" ><img border="0" src="images/m12.jpg" alt="Spa Gift Baskets" width="184" height="195"></a></td>
	 <td width=4></td>
		 <td>
		  <table cellspacing=0 cellpadding=0>
		  <tr><td><a href=<?=tep_href_link('specials.php')?>><img src=images/m13.gif width=181 height=22 border=0></a></td></tr>
		   <tr><td><a href=<?=tep_href_link('advanced_search.php')?>><img src=images/m14.gif width=181 height=21 border=0></a></td></tr>
		   <tr><td><a href=<?=tep_href_link('contact_us.php')?>><img src=images/m15.gif width=181 height=19 border=0></a></td></tr>
		   <tr><td><a href=<?=tep_href_link('create_account.php')?>><img src=images/m16.gif width=181 height=20 border=0></a></td></tr>
		   <tr><td><a href=<?=tep_href_link('login.php')?>><img src=images/m17.gif width=181 height=20 border=0></a></td></tr>
		   <tr><td><img src=images/m18.gif width=181 height=13></td></tr>
		   <tr><td><img src=images/m21.gif width=181 height=3></td></tr>
		   <tr><td background=images/m20.gif width=181 height=77>



<? // SEARCH ?>
				<table cellspacing=0 cellpadding=0 width=147 align=center>
				 <?=tep_draw_form('quick_find', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get')?>
				 <tr><td height=10></td></tr>
				 <tr><td class=ch><font color=#ffffff>Quick Search:</a></td></tr>
				 <tr><td height=5></td></tr>
				 <tr><td><?=tep_draw_input_field('keywords', '', 'size="20" maxlength="30" class=go onclick="this.value=\'\'"  value="- Enter keyword - "') . '?' . tep_hide_session_id()?></td></tr>
				 <tr><td height=7></td></tr>
				 <tr><td align=right><input type=image src=images/m19.gif width=32 height=12 border=0> ? </td></tr>
				 </form>
				</table>
<? // END SEARCH ?>
		   </td></tr>
		  </table>
	 </td></tr>
	 <tr><td colspan=5 width=715 height=2></td></tr>
	 <tr><td colspan=5 width=715 height=4 bgcolor=#ACAC53></td></tr>
	 <tr><td colspan=5 width=715 height=2></td></tr>
	</table>
	<table cellspacing=0 cellpadding=0>
	 <tr><td width=2 bgcolor=#B0B05A></td>
		 <td width=2></td>
		 <td width=165 valign=top>
		  <table cellspacing=0 cellpadding=0>
		   <tr><td><img src=images/m22.gif width=165 height=36></td></tr>
		   <tr><td height=3></td></tr>
		   <tr><td><img src=images/m23.gif width=165 height=5></td></tr>
		   <tr><td width=165 class=bg>
				<table cellspacing=0 cellpadding=0 width=135 align=center>
				 <tr><td height=9></td></tr>
<?   // ---- CATEGORIES

  function tep_show_category($counter) {
global $tree, $categories_string, $cPath_array;

  if(!$tree[$counter]['level']){			   

$categories_string .= $categories_string ? '<tr><td><img src=images/m26.gif width=135 height=1></td></tr><tr><td height=4></td></tr>' : '';			 

$categories_string .= ' <tr><td><img src=images/m25.gif width=4 height=4 align=absmiddle> ?<a class=ml1 href=';

if ($tree[$counter]['parent'] == 0) {
  $cPath_new = 'cPath=' . $counter;
} else {
  $cPath_new = 'cPath=' . $tree[$counter]['path'];
}
$categories_string .= tep_href_link('index.php', $cPath_new) . '>';
// display categry name
$categories_string .= $tree[$counter]['name'];
$categories_string .= '</a></td></tr><tr><td height=3></td></tr>';

  }else{  // SUBCATEGORY

$categories_string .= '<tr><td>? ? ';

for($i=0;$i<$tree[$counter]['le vel'];$i++)
 $categories_string .= '???';

$categories_string .= ' - <a class=ml1 style="font-weight:normal;" href=';   
if ($tree[$counter]['parent'] == 0) {
  $cPath_new = 'cPath=' . $counter;
} else {
  $cPath_new = 'cPath=' . $tree[$counter]['path'];
}
$categories_string .= tep_href_link('index.php', $cPath_new) . '>';
// display category name
$categories_string .= $tree[$counter]['name'];
$categories_string .= '</a></td></tr><tr><td height=3></td></tr>';
  }  

if ($tree[$counter]['next_id'] != false) {
  tep_show_category($tree[$counter]['next_id']);
}  
// }



 define(TABLE_CATEGORIES, "categories");
 define(TABLE_CATEGORIES_DESCRIPTION, "categories_description");
 $categories_string = '';
 $tree = array();

 $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");
 while ($categories = tep_db_fetch_array($categories_query))  {
$tree[$categories['categories_id']] = array('name' => $categories['categories_name'],
											'parent' => $categories['parent_id'],
											'level' => 0,
											'path' => $categories['categories_id'],
											'next_id' => false);

if (isset($parent_id)) {
  $tree[$parent_id]['next_id'] = $categories['categories_id'];
}

$parent_id = $categories['categories_id'];

if (!isset($first_element)) {
  $first_element = $categories['categories_id'];
}
 }

 //------------------------
 if ($cPath) {
$new_path = '';
reset($cPath_array);
while (list($key, $value) = each($cPath_array)) {
  unset($parent_id);
  unset($first_id);
  $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$value . "' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");
  if (tep_db_num_rows($categories_query)) {
	$new_path .= $value;
	while ($row = tep_db_fetch_array($categories_query)) {
	  $tree[$row['categories_id']] = array('name' => $row['categories_name'],
										   'parent' => $row['parent_id'],
										   'level' => $key+1,
										   'path' => $new_path . '_' . $row['categories_id'],
										   'next_id' => false);

	  if (isset($parent_id)) {
		$tree[$parent_id]['next_id'] = $row['categories_id'];
	  }

	  $parent_id = $row['categories_id'];

	  if (!isset($first_id)) {
		$first_id = $row['categories_id'];
	  }

	  $last_id = $row['categories_id'];
	}
	$tree[$last_id]['next_id'] = $tree[$value]['next_id'];
	$tree[$value]['next_id'] = $first_id;
	$new_path .= '_';
  } else {
	break;
  }
}
 }
$categories_string .=  '';
tep_show_category($first_element); 
$categories_string .=  '';

echo $categories_string;
?>



				<tr><td height=7></td></tr>					
				</table>
		   </tr></tr>
		   <tr><td><img src=images/m27.gif width=165 height=7></td></tr>
		  </table>		
		 </td>
		 <td width=4></td>
		 <td width=537 valign=top>

Link to comment
Share on other sites

What happened when you renamed the function as I suggested?

 

Jack

 

 

I didn't rename it because I thought I was looking for 2 instances of the statement and couldn't find both of them. So then I should try the following change?

 

From:

function tep_show_category($counter) {
global $tree, $categories_string, $cPath_array;

 

To:

function my_tep_show_category($counter) {
global $tree, $categories_string, $cPath_array;

Link to comment
Share on other sites

I didn't rename it because I thought I was looking for 2 instances of the statement and couldn't find both of them. So then I should try the following change?

 

From:

function tep_show_category($counter) {
global $tree, $categories_string, $cPath_array;

 

To:

function my_tep_show_category($counter) {
global $tree, $categories_string, $cPath_array;

 

Well I tried this change and I recieved the following error on the home page:

 

Fatal error: Call to undefined function: tep_show_category() in 
/includes/header.php on line 328

 

Did I do what you were suggesting? Any other help would be much appreciated. I really need to make this contrib work! Thanks

Edited by schnauzer
Link to comment
Share on other sites

The function is named with the

function tep_show_category($counter)

and then the function is called with the

tep_show_category($first_element);

You need to change them both (any other occurrences on that page).

 

Jack

Support Links:

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

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

The function is named with the
function tep_show_category($counter)

and then the function is called with the

tep_show_category($first_element);

You need to change them both (any other occurrences on that page).

 

Jack

 

 

It worked...I actually found a 3rd occurrance and change that as well. The only thing is that the links pages are a mess format wise. now the osc stock left and right columns are showing up. Also i'm kind of concerned that by doing this I may have changed something elsewhere that i shouldn't have. Don't the functions have a reason for being there to begin with?

 

So how can I remove the stock columns?

Link to comment
Share on other sites

As I mentioned, the template designers do that, probably because they don't know the correct way to do it. It won't hurt to have them renamed that way since the code on that page is self-contained. The original function still exists where it should and will work as expected. To switch the display for links manager, see the instructions. The explain what you need to do.

 

Jack

Support Links:

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

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

As I mentioned, the template designers do that, probably because they don't know the correct way to do it. It won't hurt to have them renamed that way since the code on that page is self-contained. The original function still exists where it should and will work as expected. To switch the display for links manager, see the instructions. The explain what you need to do.

 

Jack

 

Jack-

 

What instructions? The readme file only includes installation instructions and the configuration section in teh admin panel doesn't address the appearance of the columns. Thanks for getting me this far I appreciate it.

Link to comment
Share on other sites

From the readme file

NOTE: An optional file named link_listing.php_vertical_listing is in the modules

directory. If you want a vertical listing of links, instead of the traditional

table, rename it and use it instead.

 

Jack

Support Links:

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

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

From the readme file

 

Jack

 

Jack-

how the links are displayed are fine. But on the links pages I now have all of the original stock osc info boxes appearing and well as my category column is displyed twice. Where would I comment out all of the boxes that are appearing so that just my template appears?

Edited by schnauzer
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...