Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Adding a Link to Manufacturers infobox


Silverado05

Recommended Posts

Hello, I was hoping someone could help me out with a little mod I am working on. It has been a while since I have coded so I am a little rusty not to mention it's late. Anyways, all I am wanting to to is add a text link that says "View All Manufacturers" right below the drop down box in the Manufacturers infobox. I know how to make the link, that is the easy part, just not sure where and how to insert it to get it to work. I have been playing around with it and can't seem to get it. This is easy as cake, but like I said it's been a while and I am tired. So if anyone could help me out I would be greatly appericative. I have been racking my brain trying to add it. Below is the file I am trying to add it to.

 

-Thanks

 

<?php
/*
 $Id: manufacturers.php,v 1.19 2003/06/09 22:17:13 hpdl Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 $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)) {
?>
<!-- manufacturers //-->
	  <tr>
		<td>
<?php
$info_box_contents = array();
$info_box_contents[] = array('text' => BOX_HEADING_MANUFACTURERS);

new infoBoxHeading($info_box_contents, false, false);

if ($number_of_rows <= MAX_DISPLAY_MANUFACTURERS_IN_A_LIST) {
// Display a list
  $manufacturers_list = '';
  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']);
	if (isset($HTTP_GET_VARS['manufacturers_id']) && ($HTTP_GET_VARS['manufacturers_id'] == $manufacturers['manufacturers_id'])) $manufacturers_name = '<b>' . $manufacturers_name .'</b>';
	$manufacturers_list .= '<a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $manufacturers['manufacturers_id']) . '">' . $manufacturers_name . '</a><br>';
  }

  $manufacturers_list = substr($manufacturers_list, 0, -4);

  $info_box_contents = array();
  $info_box_contents[] = array('text' => $manufacturers_list);
} else {
// Display a drop-down
  $manufacturers_array = array();
  if (MAX_MANUFACTURERS_LIST < 2) {
	$manufacturers_array[] = array('id' => '', 'text' => PULL_DOWN_DEFAULT);
  }

  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);
  }

  $info_box_contents = array();
  $info_box_contents[] = array('form' => tep_draw_form('manufacturers', tep_href_link(FILENAME_DEFAULT, '', 'NONSSL', false), 'get'),
							   'text' => 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 . '" style="width: 100%"') . tep_hide_session_id());
}

new infoBox($info_box_contents);
?>
		</td>
	  </tr>
<!-- manufacturers_eof //-->
<?php
 }
?>

Search the forum and contributions before posting. If that doesn't work, keep looking, then post. The forum is for seeking help and advice NOT for someone to do your work for you. Try to do something on your on, if you are going to run a shop then learn how it works.

Link to comment
Share on other sites

change this:

 

new infoBox($info_box_contents);

 

 

to this

 

$info_box_contents[] = array('text' => '<a href=' . tep_href_link(FILENAME_ALL_MANUFACTURERS) . '">All Manufacturers</a>');
new infoBox($info_box_contents);

Link to comment
Share on other sites

Thanks worked perfectly. Had to modify it for the correct filename but no biggie. Their was also an extra " I had to remove but other then that it works perfect. Thank you again for your help.

Search the forum and contributions before posting. If that doesn't work, keep looking, then post. The forum is for seeking help and advice NOT for someone to do your work for you. Try to do something on your on, if you are going to run a shop then learn how it works.

Link to comment
Share on other sites

  • 1 year later...
change this:

 

new infoBox($info_box_contents);

to this

 

$info_box_contents[] = array('text' => '<a href=' . tep_href_link(FILENAME_ALL_MANUFACTURERS) . '">All Manufacturers</a>');
new infoBox($info_box_contents);

Just wanted to say "Thank you Mark" :thumbsup: & silverado05

 

Used this:

$info_box_contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_MANUFACTURERS) . '">All Manufacturers</a>');
new infoBox($info_box_contents);

 

I've been searching for hours for this (after trying to play with the code myself!! >_< )

 

Julie

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...