Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Question about Manufacturers Dropdown Menu


jesma

Recommended Posts

Hi,

 

As i have bought an OScommerce, the manufacturers Dropdown Menu, that would usually be in the left column of the store, is not present.m I managed to customise the template a lot to suit my needs, but the last thing I need to do.. add back the Manufacturer dropdown menu, I just can't do.

 

I'm positve the backbone of the Manufacturers code is still there, as I can still select and search Manufactorer from the Advanced Search page, and define products to a Manufactorer... I just need the frontend, ie.. the Manufacturer Dropdown Menu, back on the left columnn of my store.

 

Can anyone help me get this back? SURELY, it's just of matter of being a few lines of PHP code that I sinply need o insert into a spce in my column_left.php.

 

Can anyone help me with the code I need, to get the Manufacturer Dropdown back, or how I can do it?

 

Any help would be truely appreciated!!

Link to comment
Share on other sites

always backup your files first, then try adding this into your column_left.php wherever you want the manufacturers box to appear;

 

if ((USE_CACHE == 'true') && empty($SID)) {
echo tep_cache_manufacturers_box();
 } else {
include(DIR_WS_BOXES . 'manufacturers.php');
 }

What? Yeah, I can do that.

Link to comment
Share on other sites

Brooke, thanks for your help. The only problem is, after I select a category, it goes to the advanced_search.php page as tho no products exist under the selected category, but ive made sure that products do!!

 

Any ideas?

Link to comment
Share on other sites

I don't know if your allowed to you other site names on here, so I'll abbreviate with TemplateMo**ter. I'm not sure if manufacturers has been edited, but I can't see why it would. Here is my file code for manufacturers.php:

 

Can you see anything wrong with it?

 

<?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 //-->
<table cellpadding="0" cellspacing="0" border="0" width="100%" id="manu">
<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 . '" class="form1" style="width:162px"') . tep_hide_session_id());
}
new infoBox($info_box_contents);
?>
</td></tr>
</table>
<!-- manufacturers_eof //-->
<?php
 }
?>

Link to comment
Share on other sites

there are definately some changes in that from the original. to see if those changes are the issue, i would make a copy of your manufacturers.php file, so you have one called manufacturers_copy.php and one still called manufacturers.php. replace the code in manufacturers.php with a stock osCommerce manufacturers.php code, then see if that at least makes the dropdown work properly.

here is code from a stock osCommerce manufacturers.php;

 

<?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 © 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

}

?>

What? Yeah, I can do that.

Link to comment
Share on other sites

Really appreciate your time helping me brooke!!

 

But.., still doesn't seem to work! Still just goes to the advanced search page saying "At least one of the fields in the search form must be entered.".

 

You must be running out of ideas, but do you have any other guesses to why it's doing this?

Link to comment
Share on other sites

Thinking about it, Brooke, is the original code you gave me taken from the advanced search page?

 

I say this because, as I wrote about, this error appears when I select the manufacturer: "At least one of the fields in the search form must be entered.". That error message also happens when I go on onto advanced search and select manufacturor WITHOUT entering anything in the keyword search slightly above it on the advanced search.php page.

 

Therefore, could it of been you've given me the code from the advanced_search.php page for the manufacturer box, in which case won't work as you need to enter in keywords too, or did you get the code from the left column of the store?

Link to comment
Share on other sites

nope, that code was from the manufacturers.php page from a stock osC pack.

 

strange that it wouldnt work.

 

the tough thing is, youre using a template. those templats places can really muck up a lot of code. so its hard for me to know whats going on with it all. do you have a link to your site? maybe that would help.

What? Yeah, I can do that.

Link to comment
Share on other sites

Brooke.. thanks!!

 

I had to reinstall the whole site again due to an error elsewhere that I couldn't work out...

 

Basically, I put the manufacturer code from your first post into the left column.. WORKED PERFECTLY!

 

It seemed that when I had hugely modified the template I bought, I had moved the search form also, and the manufacturers code you gave me last night just under the search form. Somehow, with the search and manufacturers form next to eachother the code must of got muddled somehow with the search, which explains why it kept going to the advanced search page after all the times I selected a manufacturer!

 

Anyway, thanks for your help brooke! I'm really pleased now as it really was an important feature for the products I'm selling!

 

Thanks again

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...