Jump to content
Sign in to follow this  
wheeloftime

[Contrib] Manufacturers Multilanguage

Recommended Posts

Well, seems like the search is almost over... I have use cache set to true in Admin and if I modify the call for the box in column_left/right.php like this:

if ((USE_CACHE == 'false') && empty($SID)) {
echo tep_cache_manufacturers2_box();
 } else {
require(DIR_WS_BOXES . 'manufacturers2.php');
 }

the box stays in place. <_<

So I use false instead of true.

Edited by JSR

Share this post


Link to post
Share on other sites

I installed this on a very heavily modded shop and it installed just fine.

 

No problems no where and everything seems to work fine except for 1 small thing...

 

When I click any manufacturer in the pull down menu it shows their products just fine and their logo.

 

However it does not show the information that I input in the admin area under the description field.

 

Have I missed something somewhere?

 

I was thinking that the extra description information would show up at the very top of the manufacturers catgeory......

 

Any help?

Share this post


Link to post
Share on other sites
I installed this on a very heavily modded shop and it installed just fine.

 

No problems no where and everything seems to work fine except for 1 small thing...

 

When I click any manufacturer in the pull down menu it shows their products just fine and their logo.

 

However it does not show the information that I input in the admin area under the description field.

 

Have I missed something somewhere?

 

I was thinking that the extra description information would show up at the very top of the manufacturers catgeory......

 

Any help?

 

sunshynevideo I too noticed this. If you look at the edits for the /index.php there is nothing that seems to call the description - but then again maybe I overlooked it.

 

I would love to see if anyone was able to get this to work and a live site that actually is taking advantage of this contribution.

Share this post


Link to post
Share on other sites

Seems to me that there is a step missing somewhere. Maybe later if I find time I will try and play with this a bit more

 

sunshynevideo I too noticed this. If you look at the edits for the /index.php there is nothing that seems to call the description - but then again maybe I overlooked it.

 

I would love to see if anyone was able to get this to work and a live site that actually is taking advantage of this contribution.

Share this post


Link to post
Share on other sites
Seems to me that there is a step missing somewhere.

Seems easy enough to incorporate I think by adding the function tep_get_manufacturers_description to catalog/includes/functions/general.php (should already be in catalog/admin/includes/functions/general.php)

	// Return the manufacturers description in the needed language
// TABLES: manufacturers_info
  function tep_get_manufacturers_description($manufacturers_id, $language_id) {
	$manufacturers_query = tep_db_query("select manufacturers_description from " . TABLE_MANUFACTURERS_INFO . " where manufacturers_id = '" . (int)$manufacturers_id . "' and languages_id = '" . (int)$language_id . "'");
	$manufacturer = tep_db_fetch_array($manufacturers_query);

	return $manufacturer['manufacturers_description'];
  }

Then adding some code to index.php:

// Get the right image for the top-right
$image = DIR_WS_IMAGES . 'table_background_list.gif';
if (isset($HTTP_GET_VARS['manufacturers_id'])) {
  $image = tep_db_query("select manufacturers_image from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'");
  $image = tep_db_fetch_array($image);
  $image = $image['manufacturers_image'];
// now get the description of the manufacturer in the appropriate language
  $manufacturers_description = tep_get_manufacturers_description((int)$_GET['manufacturers_id'], (int)$languages_id);
} elseif ($current_category_id) {

and echo it somewhere with the needed HTML around it like e.g.:

<?php if (tep_not_null($manufacturers_description) {
?>
<p class="whateveryoulike">
echo $manufacturers_description;
</p>
<?php 
 } // end if (tep_not_null($manufacturers_description)
?>

Share this post


Link to post
Share on other sites
Seems easy enough to incorporate I think by adding the function tep_get_manufacturers_description to catalog/includes/functions/general.php (should already be in catalog/admin/includes/functions/general.php)

 

This code went in general just fine with no adverse results

 

	// Return the manufacturers description in the needed language
// TABLES: manufacturers_info
  function tep_get_manufacturers_description($manufacturers_id, $language_id) {
	$manufacturers_query = tep_db_query("select manufacturers_description from " . TABLE_MANUFACTURERS_INFO . " where manufacturers_id = '" . (int)$manufacturers_id . "' and languages_id = '" . (int)$language_id . "'");
	$manufacturer = tep_db_fetch_array($manufacturers_query);

	return $manufacturer['manufacturers_description'];
  }

 

This code blow went in just fine but my page load time just bottomed out and took forever to load

 

Then adding some code to index.php:

// Get the right image for the top-right
$image = DIR_WS_IMAGES . 'table_background_list.gif';
if (isset($HTTP_GET_VARS['manufacturers_id'])) {
  $image = tep_db_query("select manufacturers_image from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'");
  $image = tep_db_fetch_array($image);
  $image = $image['manufacturers_image'];
// now get the description of the manufacturer in the appropriate language
  $manufacturers_description = tep_get_manufacturers_description((int)$_GET['manufacturers_id'], (int)$languages_id);
} elseif ($current_category_id) {

 

 

I added in this piece of code and all i got was a blank page with nothing on it.

and echo it somewhere with the needed HTML around it like e.g.:

<?php if (tep_not_null($manufacturers_description) {
?>
<p class="whateveryoulike">
echo $manufacturers_description;
</p>
<?php 
 } // end if (tep_not_null($manufacturers_description)
?>

 

 

Not sure where I am screwing up.. But here is my index file... Maybe someone can tell me where I have messed up but this index code below does NOT have the above codes in it.

 

<?php
 require('includes/application_top.php');
//BEGIN Cat, Prod name in page title
require('includes/metaqueries.php');
//END Cat, Prod name in page title
// the following cPath references come from application_top.php
 $category_depth = 'top';
 if (isset($cPath) && tep_not_null($cPath)) {
$categories_products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");
$cateqories_products = tep_db_fetch_array($categories_products_query);
if ($cateqories_products['total'] > 0) {
  $category_depth = 'products'; // display products
} else {
  $category_parent_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$current_category_id . "'");
  $category_parent = tep_db_fetch_array($category_parent_query);
  if ($category_parent['total'] > 0) {
	$category_depth = 'nested'; // navigate through the categories
  } else {
	$category_depth = 'products'; // category has no products, but display the 'no products' message
  }
}
 }

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFAULT);
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<title><?php echo $metaqueries_title; ?></title>
<head>
<meta name="verify-v1" content="kFf166noZt5CZZAqegZdTIgCdiIPz+Vy1ZUeEJ3GnRU=" />
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<?php
  if (!isset($lng) || (isset($lng) && !is_object($lng))) {
	include(DIR_WS_CLASSES . 'language.php');
	$lng = new language;
  }

  reset($lng->catalog_languages);
  while (list($key, $value) = each($lng->catalog_languages)) {
?>
<link rel="alternate" type="application/rss+xml" title="<?php echo STORE_NAME . ' - ' . BOX_INFORMATION_RSS; ?>" href="<?php echo FILENAME_RSS, '?language=' . $key; ?>">
<?php
  }
	  ?>

</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
 <tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<?php
 if ($category_depth == 'nested') {
$category_query = tep_db_query("select cd.categories_name, c.categories_image,cd.categories_description,cd.categories_heading_title from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . (int)$current_category_id . "' and cd.categories_id = '" . (int)$current_category_id . "' and cd.language_id = '" . (int)$languages_id . "'");
$category = tep_db_fetch_array($category_query);
?>
<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="pageHeading" valign="top"><?php echo (!empty($category['categories_heading_title']) ? $category['categories_heading_title'] : HEADING_TITLE); ?></td>
	  </tr>
	  <tr>
		<TD COLSPAN="2" CLASS="main">
		<?php echo tep_image(DIR_WS_IMAGES . $category['categories_image'], $category['categories_name'], HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT, 'ALIGN=right'); ?>
		<?php echo $category['categories_description']; ?>
		</TD>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
	  <tr>
		<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr>
<?php
if (isset($cPath) && strpos('_', $cPath)) {
// check to see if there are deeper categories within the current category
  $category_links = array_reverse($cPath_array);
  for($i=0, $n=sizeof($category_links); $i<$n; $i++) {
	$categories_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$category_links[$i] . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "'");
	$categories = tep_db_fetch_array($categories_query);
	if ($categories['total'] < 1) {
	  // do nothing, go through the loop
	} else {
	  $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$category_links[$i] . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name");
	  break; // we've found the deepest category the customer is in
	}
  }
} else {
  $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$current_category_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name");
}

$number_of_categories = tep_db_num_rows($categories_query);

$rows = 0;
while ($categories = tep_db_fetch_array($categories_query)) {
  $rows++;
  $cPath_new = tep_get_path($categories['categories_id']);
  $width = (int)(100 / MAX_DISPLAY_CATEGORIES_PER_ROW) . '%';
  echo '				<td align="center" class="smallText" width="' . $width . '" valign="top"><a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . tep_image(DIR_WS_IMAGES . $categories['categories_image'], $categories['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '<br>' . $categories['categories_name'] . '</a></td>' . "\n";
  if ((($rows / MAX_DISPLAY_CATEGORIES_PER_ROW) == floor($rows / MAX_DISPLAY_CATEGORIES_PER_ROW)) && ($rows != $number_of_categories)) {
	echo '			  </tr>' . "\n";
	echo '			  <tr>' . "\n";
  }
}

// needed for the new products module shown below
$new_products_category_id = $current_category_id;
?>
		  </tr>
		</table></td>
	  </tr>
	  <tr>
		<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
	  </tr>
	  <tr>
		<td><?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?></td>
	  </tr>
	</table></td>
  </tr>
</table></td>
<?php
 } elseif ($category_depth == 'products' || isset($HTTP_GET_VARS['manufacturers_id'])) {
// create column list
$define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL,
					 'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME,
					 'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER,
					 'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE,
					 'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY,
					 'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT,
					 'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE,
					 'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW);

asort($define_list);

$column_list = array();
reset($define_list);
while (list($key, $value) = each($define_list)) {
  if ($value > 0) $column_list[] = $key;
}

$select_column_list = '';

for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
  switch ($column_list[$i]) {
	case 'PRODUCT_LIST_MODEL':
	  $select_column_list .= 'p.products_model, ';
	  break;
	case 'PRODUCT_LIST_NAME':
	  $select_column_list .= 'pd.products_name, ';
	  break;
	case 'PRODUCT_LIST_MANUFACTURER':
	  $select_column_list .= 'm.manufacturers_name, ';
	  break;
	case 'PRODUCT_LIST_QUANTITY':
	  $select_column_list .= 'p.products_quantity, ';
	  break;
	case 'PRODUCT_LIST_IMAGE':
	  $select_column_list .= 'p.products_image, ';
	  break;
	case 'PRODUCT_LIST_WEIGHT':
	  $select_column_list .= 'p.products_weight, ';
	  break;
  }
}

// show the products of a specified manufacturer
if (isset($HTTP_GET_VARS['manufacturers_id'])) {
  if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
// We are asked to show only a specific category
	$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'";
  } else {
// We show them all
	$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";
  }
} else {
// show the products in a given categorie
  if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
// We are asked to show only specific catgeory
	$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
  } else {
// We show them all
	$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.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] == 'PRODUCT_LIST_NAME') {
	  $HTTP_GET_VARS['sort'] = $i+1 . 'a';
	  $listing_sql .= " order by pd.products_name";
	  break;
	}
  }
} else {
  $sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1);
  $sort_order = substr($HTTP_GET_VARS['sort'], 1);

  switch ($column_list[$sort_col-1]) {
	case 'PRODUCT_LIST_MODEL':
	  $listing_sql .= " order by p.products_model " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
	  break;
	case 'PRODUCT_LIST_NAME':
	  $listing_sql .= " order by pd.products_name " . ($sort_order == 'd' ? 'desc' : '');
	  break;
	case 'PRODUCT_LIST_MANUFACTURER':
	  $listing_sql .= " order by m.manufacturers_name " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
	  break;
	case 'PRODUCT_LIST_QUANTITY':
	  $listing_sql .= " order by p.products_quantity " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
	  break;
	case 'PRODUCT_LIST_IMAGE':
	  $listing_sql .= " order by pd.products_name";
	  break;
	case 'PRODUCT_LIST_WEIGHT':
	  $listing_sql .= " order by p.products_weight " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
	  break;
	case 'PRODUCT_LIST_PRICE':
	  $listing_sql .= " order by final_price " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
	  break;
  }

}
$cat_description_query = tep_db_query ("select categories_heading_title, categories_description from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . $current_category_id . "' and language_id = '" . (int)$languages_id . "'");
$cat_description = tep_db_fetch_array ($cat_description_query);
?>
<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="pageHeading"><?php echo (!empty($cat_description['categories_heading_title']) ? $cat_description['categories_heading_title'] : HEADING_TITLE); ?></td>
<?php
// optional Product List Filter
if (PRODUCT_LIST_FILTER > 0) {
  if (isset($HTTP_GET_VARS['manufacturers_id'])) {
	$filterlist_sql = "select distinct c.categories_id as id, cd.categories_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where p.products_status = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and p2c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' order by cd.categories_name";
} else {
	$filterlist_sql= "select distinct m.manufacturers_id as id, m.manufacturers_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_MANUFACTURERS_INFO . " m where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.languages_id = " . (int)$languages_id . " and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by m.manufacturers_name";
  }
  $filterlist_query = tep_db_query($filterlist_sql);
  if (tep_db_num_rows($filterlist_query) > 1) {
	echo '			<td align="center" class="main">' . tep_draw_form('filter', FILENAME_DEFAULT, 'get') . TEXT_SHOW . ' ';
	if (isset($HTTP_GET_VARS['manufacturers_id'])) {
	  echo tep_draw_hidden_field('manufacturers_id', $HTTP_GET_VARS['manufacturers_id']);
	  $options = array(array('id' => '', 'text' => TEXT_ALL_CATEGORIES));
	} else {
	  echo tep_draw_hidden_field('cPath', $cPath);
	  $options = array(array('id' => '', 'text' => TEXT_ALL_MANUFACTURERS));
	}
	echo tep_draw_hidden_field('sort', $HTTP_GET_VARS['sort']);
	while ($filterlist = tep_db_fetch_array($filterlist_query)) {
	  $options[] = array('id' => $filterlist['id'], 'text' => $filterlist['name']);
	}
	echo tep_draw_pull_down_menu('filter_id', $options, (isset($HTTP_GET_VARS['filter_id']) ? $HTTP_GET_VARS['filter_id'] : ''), 'onchange="this.form.submit()"');
	echo tep_hide_session_id() . '</form></td>' . "\n";
  }
}

// Get the right image for the top-right
$image = DIR_WS_IMAGES . 'table_background_list.gif';
if (isset($HTTP_GET_VARS['manufacturers_id'])) {
  $image = tep_db_query("select manufacturers_image from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'");
  $image = tep_db_fetch_array($image);
  $image = $image['manufacturers_image'];
	} elseif ($current_category_id) {
  $image = tep_db_query("select categories_image from " . TABLE_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");
  $image = tep_db_fetch_array($image);
  $image = $image['categories_image'];
}
?>
		</tr>

	  <tr><TD> </TD></TR>
	  <tr>
		<TD COLSPAN="2" CLASS="main">
		<?php echo tep_image(DIR_WS_IMAGES . $image, (!empty($cat_description['categories_heading_title']) ? $cat_description['categories_heading_title'] : HEADING_TITLE), HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT, 'ALIGN=right'); ?>
		<?php echo $cat_description['categories_description']; ?>
		</TD>
	  </tr>
	 </table></td>
  </tr>

  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td><?php include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING); ?></td>
  </tr>
</table></td>
<?php
 } else { // default page
?>
<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
		<td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_default.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="main"><?php echo tep_customer_greeting(); ?></td>
	  </tr>
	  <tr>
		<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
	  </tr>
	  <tr>
		<td class="main"><?php echo TEXT_MAIN; ?></td>
	  </tr>
	  <tr>
		<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
	  </tr>
	  <tr>
		<td><?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?><br><?php include(DIR_WS_MODULES . FILENAME_TOP_RATING); ?></td>
	  </tr>
<?php
include(DIR_WS_MODULES . FILENAME_UPCOMING_PRODUCTS);
?>
	</table></td>
  </tr>
</table></td>
<?php
 }
?>
<!-- body_text_eof //-->
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
</table></td>
 </tr>
</table>
<!-- body_eof //-->
<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Share this post


Link to post
Share on other sites
Not sure where I am screwing up.. But here is my index file... Maybe someone can tell me where I have messed up but this index code below does NOT have the above codes in it.

The error on index.php is caused by the fact that i forgot to add the php tags around the echo:

<?php if (tep_not_null($manufacturers_description) {
?>
<p class="whateveryoulike">
<?php echo $manufacturers_description; ?>
</p>
<?php 
 } // end if (tep_not_null($manufacturers_description)
?>

Now for the description itself you only need these two lines, but I added a few more surrounding lines to be able to find it back in your index.php:

// now get the description of the manufacturer in the appropriate language
  $manufacturers_description = tep_get_manufacturers_description((int)$_GET['manufacturers_id'], (int)$languages_id);

I don't see how this simple query would take so long. Might be something unrelated.

Share this post


Link to post
Share on other sites

Ok went back and re added code below....

 

The error on index.php is caused by the fact that i forgot to add the php tags around the echo:

 

Once again I add this code into my idex page and once again I get a black page. Possibly I am adding the code into the wrong area but I am assuming that this code goes in the html area under the piece of code at the bottom of this post. Where do you suggest I put this in my index page? Evidently this tweak is causing brain lock. Thanks in advance!

 

<?php if (tep_not_null($manufacturers_description) {
?>
<p class="whateveryoulike">
<?php echo $manufacturers_description; ?>
</p>
<?php 
 } // end if (tep_not_null($manufacturers_description)
?>

 

Got this part added back in fine. Seems to work ok

 

Now for the description itself you only need these two lines, but I added a few more surrounding lines to be able to find it back in your index.php:

// now get the description of the manufacturer in the appropriate language
  $manufacturers_description = tep_get_manufacturers_description((int)$_GET['manufacturers_id'], (int)$languages_id);

I don't see how this simple query would take so long. Might be something unrelated.

Share this post


Link to post
Share on other sites
Ok went back and re added code below....

OK, problem with not testing: a ) is missing in this piece after $manufacturers_description)

<?php if (tep_not_null($manufacturers_description)) {

If you copy and pasted the code from the webpage, you also might have a problem with unicode spaces being in front of the } in this piece:

<?php 
 } // end if (tep_not_null($manufacturers_description)
?>

Make sure there are no spaces before it, or remove them and add them back with your text editor.

 

How and where you want to show this on your page is up to you. Most of the content is not in paragraph tags on that page though. Most goes in td tags like the separator:

	  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>

But perhaps you want it next to the image or wherever. The code I showed can be pasted anywhere in the HTML (more or less).

Share this post


Link to post
Share on other sites

Ok Got it working perfect. It was that missing ) after the $manufacturers_description... But that was exactly as I copied from your post above. However I should have seen that. But as they say its the simple things in lfe that get you all messed up.

 

Now to duplicate this code a bit so that it shows the manufacturer name above the description!

 

Thank you for the help and hopefully someone will update this addon with this new information.

 

OK, problem with not testing: a ) is missing in this piece after $manufacturers_description)

<?php if (tep_not_null($manufacturers_description)) {

If you copy and pasted the code from the webpage, you also might have a problem with unicode spaces being in front of the } in this piece:

<?php 
 } // end if (tep_not_null($manufacturers_description)
?>

Make sure there are no spaces before it, or remove them and add them back with your text editor.

 

How and where you want to show this on your page is up to you. Most of the content is not in paragraph tags on that page though. Most goes in td tags like the separator:

	  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>

But perhaps you want it next to the image or wherever. The code I showed can be pasted anywhere in the HTML (more or less).

Share this post


Link to post
Share on other sites

For anyone that wants to add the manufacturer name above the description in nice bold lettering add this

 

<?php if (tep_not_null($manufacturers_name)) {
?>
<p class="main"><font size=+2>
<?php echo $manufacturers_name; ?>
</p></font>
<?php
 } // end if (tep_not_null($manufacturers_name)
?>

 

Just before this

 

<?php if (tep_not_null($manufacturers_description)) {
?>
<p class="main">
<?php echo $manufacturers_description; ?>
</p>
<?php
 } // end if (tep_not_null($manufacturers_description)
?>

 

In your index.php file

 

Then you will end up with a nice clean look

Share this post


Link to post
Share on other sites

I need to note here that my trick above for having the Manufacturer name show up did not work,. It was same name no matter who I loaded. So back to the drawing board.

Share this post


Link to post
Share on other sites

Hi.

 

I'm running into an issue when trying to make edits to manufacturers? Has anyone else come across this error? I could not even add products until I followed the instructions suggested in this post. The only thing is this post does not tell you where to do the changes, and there are 4 instances of it.

 

 

Warning: array_merge() [function.array-merge]: Argument #1 is not an array in /home/dev/virtual_html/admin/manufacturers.php on line 33

Warning: reset() [function.reset]: Passed variable is not an array or object in /home/dev/virtual_html/admin/includes/functions/database.php on line 55

Warning: Variable passed to each() is not an array or object in /home/dev/virtual_html/admin/includes/functions/database.php on line 79
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where manufacturers_id = '31'' at line 1

update manufacturers se where manufacturers_id = '31'

[TEP STOP]

 

here is my /admin/manufacturers.php

 

<?php
/*
 $Id: manufacturers.php,v 1.55 2003/06/29 22:50:52 hpdl Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

 $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');

 if (tep_not_null($action)) {
switch ($action) {
  case 'insert':
  case 'save':
	if (isset($HTTP_GET_VARS['mID'])) $manufacturers_id = tep_db_prepare_input($HTTP_GET_VARS['mID']);

	if ($action == 'insert') {
	  $insert_sql_data = array('date_added' => 'now()');

	$sql_data_array = array_merge((array)$sql_data_array, (array)$insert_sql_data);

	  tep_db_perform(TABLE_MANUFACTURERS, $sql_data_array);
	  $manufacturers_id = tep_db_insert_id();
	} elseif ($action == 'save') {
	  $update_sql_data = array('last_modified' => 'now()');

	  $sql_data_array = array_merge($sql_data_array, $update_sql_data);

	  tep_db_perform(TABLE_MANUFACTURERS, $sql_data_array, 'update', "manufacturers_id = '" . (int)$manufacturers_id . "'");
	}


	$languages = tep_get_languages();
	for ($i=0, $n=sizeof($languages); $i<$n; $i++) {

	  $manufacturers_name_array = $HTTP_POST_VARS['manufacturers_name'];
	  $language_id = $languages[$i]['id'];

	  $sql_data_array = array('manufacturers_name' => tep_db_prepare_input($manufacturers_name_array[$language_id]));

	  if ($action == 'insert') {
		$insert_sql_data = array('manufacturers_id' => $manufacturers_id,
								 'languages_id' => $language_id);

$sql_data_array = array_merge((array)$sql_data_array, (array)$insert_sql_data);

		tep_db_perform(TABLE_MANUFACTURERS_INFO, $sql_data_array);
	  } elseif ($action == 'save') {
		tep_db_perform(TABLE_MANUFACTURERS_INFO, $sql_data_array, 'update', "manufacturers_id = '" . (int)$manufacturers_id . "' and languages_id = '" . (int)$language_id . "'");
	  }
	}

	$languages = tep_get_languages();
	for ($i=0, $n=sizeof($languages); $i<$n; $i++) {

	  $manufacturers_description_array = $HTTP_POST_VARS['manufacturers_description'];
	  $language_id = $languages[$i]['id'];

	  $sql_data_array = array('manufacturers_description' => tep_db_prepare_input($manufacturers_description_array[$language_id]));

	  if ($action == 'insert') {
		$insert_sql_data = array('manufacturers_id' => $manufacturers_id,
								 'languages_id' => $language_id);

$sql_data_array = array_merge((array)$sql_data_array, (array)$insert_sql_data);

		tep_db_perform(TABLE_MANUFACTURERS_INFO, $sql_data_array, 'update', "manufacturers_id = '" . (int)$manufacturers_id . "' and languages_id = '" . (int)$language_id . "'");
//			tep_db_perform(TABLE_MANUFACTURERS_INFO, $sql_data_array);
	  } elseif ($action == 'save') {
		tep_db_perform(TABLE_MANUFACTURERS_INFO, $sql_data_array, 'update', "manufacturers_id = '" . (int)$manufacturers_id . "' and languages_id = '" . (int)$language_id . "'");
	  }
	}

	if ($manufacturers_image = new upload('manufacturers_image', DIR_FS_CATALOG_IMAGES)) {
	  tep_db_query("update " . TABLE_MANUFACTURERS . " set manufacturers_image = '" . $manufacturers_image->filename . "' where manufacturers_id = '" . (int)$manufacturers_id . "'");
	}

	for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
	  $manufacturers_url_array = $HTTP_POST_VARS['manufacturers_url'];
	  $language_id = $languages[$i]['id'];

	  $sql_data_array = array('manufacturers_url' => tep_db_prepare_input($manufacturers_url_array[$language_id]));

	  if ($action == 'insert') {
		$insert_sql_data = array('manufacturers_id' => $manufacturers_id,
								 'languages_id' => $language_id);

$sql_data_array = array_merge((array)$sql_data_array, (array)$insert_sql_data);

		tep_db_perform(TABLE_MANUFACTURERS_INFO, $sql_data_array, 'update', "manufacturers_id = '" . (int)$manufacturers_id . "' and languages_id = '" . (int)$language_id . "'");

//			tep_db_perform(TABLE_MANUFACTURERS_INFO, $sql_data_array);
	  } elseif ($action == 'save') {
		tep_db_perform(TABLE_MANUFACTURERS_INFO, $sql_data_array, 'update', "manufacturers_id = '" . (int)$manufacturers_id . "' and languages_id = '" . (int)$language_id . "'");
	  }
	}

	if (USE_CACHE == 'true') {
	  tep_reset_cache_block('manufacturers');
	}

	tep_redirect(tep_href_link(FILENAME_MANUFACTURERS, (isset($HTTP_GET_VARS['page']) ? 'page=' . $HTTP_GET_VARS['page'] . '&' : '') . 'mID=' . $manufacturers_id));
	break;
  case 'deleteconfirm':
	$manufacturers_id = tep_db_prepare_input($HTTP_GET_VARS['mID']);

	if (isset($HTTP_POST_VARS['delete_image']) && ($HTTP_POST_VARS['delete_image'] == 'on')) {
	  $manufacturer_query = tep_db_query("select manufacturers_image from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$manufacturers_id . "'");
	  $manufacturer = tep_db_fetch_array($manufacturer_query);

	  $image_location = DIR_FS_DOCUMENT_ROOT . DIR_WS_CATALOG_IMAGES . $manufacturer['manufacturers_image'];

	  if (file_exists($image_location)) @unlink($image_location);
	}

	tep_db_query("delete from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$manufacturers_id . "'");
	tep_db_query("delete from " . TABLE_MANUFACTURERS_INFO . " where manufacturers_id = '" . (int)$manufacturers_id . "'");

	if (isset($HTTP_POST_VARS['delete_products']) && ($HTTP_POST_VARS['delete_products'] == 'on')) {
	  $products_query = tep_db_query("select products_id from " . TABLE_PRODUCTS . " where manufacturers_id = '" . (int)$manufacturers_id . "'");
	  while ($products = tep_db_fetch_array($products_query)) {
		tep_remove_product($products['products_id']);
	  }
	} else {
	  tep_db_query("update " . TABLE_PRODUCTS . " set manufacturers_id = '' where manufacturers_id = '" . (int)$manufacturers_id . "'");
	}

	if (USE_CACHE == 'true') {
	  tep_reset_cache_block('manufacturers');
	}

	tep_redirect(tep_href_link(FILENAME_MANUFACTURERS, 'page=' . $HTTP_GET_VARS['page']));
	break;
}
 }
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<script language="javascript" src="includes/general.js"></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onLoad="SetFocus();">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
 <tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  <tr>
	<td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
		<td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr class="dataTableHeadingRow">
			<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_MANUFACTURERS; ?></td>
			<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td>
		  </tr>
<?php
 $manufacturers_query_raw = "select ma.manufacturers_id, mi.manufacturers_name, ma.manufacturers_image, ma.date_added, ma.last_modified from " . TABLE_MANUFACTURERS . " ma, " . TABLE_MANUFACTURERS_INFO . " mi where ma.manufacturers_id = mi.manufacturers_id and mi.languages_id = " . (int)$languages_id . " order by mi.manufacturers_name";

 $manufacturers_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $manufacturers_query_raw, $manufacturers_query_numrows);
 $manufacturers_query = tep_db_query($manufacturers_query_raw);

 while ($manufacturers = tep_db_fetch_array($manufacturers_query)) {
if ((!isset($HTTP_GET_VARS['mID']) || (isset($HTTP_GET_VARS['mID']) && ($HTTP_GET_VARS['mID'] == $manufacturers['manufacturers_id']))) && !isset($mInfo) && (substr($action, 0, 3) != 'new')) {
  $manufacturer_products_query = tep_db_query("select count(*) as products_count from " . TABLE_PRODUCTS . " where manufacturers_id = '" . (int)$manufacturers['manufacturers_id'] . "'");
  $manufacturer_products = tep_db_fetch_array($manufacturer_products_query);

  $mInfo_array = array_merge($manufacturers, $manufacturer_products);
  $mInfo = new objectInfo($mInfo_array);
}

if (isset($mInfo) && is_object($mInfo) && ($manufacturers['manufacturers_id'] == $mInfo->manufacturers_id)) {
  echo '			  <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_MANUFACTURERS, 'page=' . $HTTP_GET_VARS['page'] . '&mID=' . $manufacturers['manufacturers_id'] . '&action=edit') . '\'">' . "\n";
} else {
  echo '			  <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_MANUFACTURERS, 'page=' . $HTTP_GET_VARS['page'] . '&mID=' . $manufacturers['manufacturers_id']) . '\'">' . "\n";
}
?>
			<td class="dataTableContent"><?php echo $manufacturers['manufacturers_name']; ?></td>
			<td class="dataTableContent" align="right"><?php if (isset($mInfo) && is_object($mInfo) && ($manufacturers['manufacturers_id'] == $mInfo->manufacturers_id)) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif'); } else { echo '<a href="' . tep_href_link(FILENAME_MANUFACTURERS, 'page=' . $HTTP_GET_VARS['page'] . '&mID=' . $manufacturers['manufacturers_id']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> </td>
		  </tr>
<?php
 }
?>
		  <tr>
			<td colspan="2"><table border="0" width="100%" cellspacing="0" cellpadding="2">
			  <tr>
				<td class="smallText" valign="top"><?php echo $manufacturers_split->display_count($manufacturers_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_MANUFACTURERS); ?></td>
				<td class="smallText" align="right"><?php echo $manufacturers_split->display_links($manufacturers_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page']); ?></td>
			  </tr>
			</table></td>
		  </tr>
<?php
 if (empty($action)) {
?>
		  <tr>
			<td align="right" colspan="2" class="smallText"><?php echo '<a href="' . tep_href_link(FILENAME_MANUFACTURERS, 'page=' . $HTTP_GET_VARS['page'] . '&mID=' . $mInfo->manufacturers_id . '&action=new') . '">' . tep_image_button('button_insert.gif', IMAGE_INSERT) . '</a>'; ?></td>
		  </tr>
<?php
 }
?>
		</table></td>
<?php
 $heading = array();
 $contents = array();

 switch ($action) {
case 'new':
  $heading[] = array('text' => '<b>' . TEXT_HEADING_NEW_MANUFACTURER . '</b>');

  $contents = array('form' => tep_draw_form('manufacturers', FILENAME_MANUFACTURERS, 'action=insert', 'post', 'enctype="multipart/form-data"'));
  $contents[] = array('text' => TEXT_NEW_INTRO);

  $manufacturer_inputs_string = '';
  $languages = tep_get_languages();
  for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
	$manufacturer_inputs_string .= '<br>' . tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('manufacturers_name[' . $languages[$i]['id'] . ']');
  }
  $contents[] = array('text' => '<br>' . TEXT_MANUFACTURERS_NAME . $manufacturer_inputs_string);

  $manufacturer_inputs_string = '';
  $languages = tep_get_languages();
  for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
	$manufacturer_inputs_string .= '<br>' . tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_textarea_field('manufacturers_description[' . $languages[$i]['id'] . ']', 'soft', '40', '5');
  }
  $contents[] = array('text' => '<br>' . TEXT_MANUFACTURERS_DESCRIPTION . $manufacturer_inputs_string);

  $contents[] = array('text' => '<br>' . TEXT_MANUFACTURERS_IMAGE . '<br>' . tep_draw_file_field('manufacturers_image'));

  $manufacturer_inputs_string = '';
  $languages = tep_get_languages();
  for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
	$manufacturer_inputs_string .= '<br>' . tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('manufacturers_url[' . $languages[$i]['id'] . ']');
  }

  $contents[] = array('text' => '<br>' . TEXT_MANUFACTURERS_URL . $manufacturer_inputs_string);
  $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_save.gif', IMAGE_SAVE) . ' <a href="' . tep_href_link(FILENAME_MANUFACTURERS, 'page=' . $HTTP_GET_VARS['page'] . '&mID=' . $HTTP_GET_VARS['mID']) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  break;
case 'edit':
  $heading[] = array('text' => '<b>' . TEXT_HEADING_EDIT_MANUFACTURER . '</b>');

  $contents = array('form' => tep_draw_form('manufacturers', FILENAME_MANUFACTURERS, 'page=' . $HTTP_GET_VARS['page'] . '&mID=' . $mInfo->manufacturers_id . '&action=save', 'post', 'enctype="multipart/form-data"'));
  $contents[] = array('text' => TEXT_EDIT_INTRO);

//	  $contents[] = array('text' => '<br>' . TEXT_MANUFACTURERS_NAME . '<br>' . tep_draw_input_field('manufacturers_name', $mInfo->manufacturers_name));
  $manufacturer_inputs_string = '';
  $languages = tep_get_languages();
  for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
	$manufacturer_inputs_string .= '<br>' . tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('manufacturers_name[' . $languages[$i]['id'] . ']', tep_get_manufacturer_name($mInfo->manufacturers_id, $languages[$i]['id']));
  }
  $contents[] = array('text' => '<br>' . TEXT_MANUFACTURERS_NAME . $manufacturer_inputs_string);

  $manufacturer_inputs_string = '';
  $languages = tep_get_languages();
  for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
	$manufacturer_inputs_string .= '<br>' . tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_textarea_field('manufacturers_description[' . $languages[$i]['id'] . ']', 'soft', '40', '5', tep_get_manufacturers_description($mInfo->manufacturers_id, $languages[$i]['id']));
  }
  $contents[] = array('text' => '<br>' . TEXT_MANUFACTURERS_DESCRIPTION . $manufacturer_inputs_string);

  $contents[] = array('text' => '<br>' . TEXT_MANUFACTURERS_IMAGE . '<br>' . tep_draw_file_field('manufacturers_image') . '<br>' . $mInfo->manufacturers_image);

  $manufacturer_inputs_string = '';
  $languages = tep_get_languages();
  for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
	$manufacturer_inputs_string .= '<br>' . tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('manufacturers_url[' . $languages[$i]['id'] . ']', tep_get_manufacturer_url($mInfo->manufacturers_id, $languages[$i]['id']));
  }

  $contents[] = array('text' => '<br>' . TEXT_MANUFACTURERS_URL . $manufacturer_inputs_string);
  $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_save.gif', IMAGE_SAVE) . ' <a href="' . tep_href_link(FILENAME_MANUFACTURERS, 'page=' . $HTTP_GET_VARS['page'] . '&mID=' . $mInfo->manufacturers_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  break;
case 'delete':
  $heading[] = array('text' => '<b>' . TEXT_HEADING_DELETE_MANUFACTURER . '</b>');

  $contents = array('form' => tep_draw_form('manufacturers', FILENAME_MANUFACTURERS, 'page=' . $HTTP_GET_VARS['page'] . '&mID=' . $mInfo->manufacturers_id . '&action=deleteconfirm'));
  $contents[] = array('text' => TEXT_DELETE_INTRO);
  $contents[] = array('text' => '<br><b>' . $mInfo->manufacturers_name . '</b>');
  $contents[] = array('text' => '<br>' . tep_draw_checkbox_field('delete_image', '', true) . ' ' . TEXT_DELETE_IMAGE);

  if ($mInfo->products_count > 0) {
	$contents[] = array('text' => '<br>' . tep_draw_checkbox_field('delete_products') . ' ' . TEXT_DELETE_PRODUCTS);
	$contents[] = array('text' => '<br>' . sprintf(TEXT_DELETE_WARNING_PRODUCTS, $mInfo->products_count));
  }

  $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . tep_href_link(FILENAME_MANUFACTURERS, 'page=' . $HTTP_GET_VARS['page'] . '&mID=' . $mInfo->manufacturers_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  break;
default:
  if (isset($mInfo) && is_object($mInfo)) {
	$heading[] = array('text' => '<b>' . $mInfo->manufacturers_name . '</b>');

	$contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_MANUFACTURERS, 'page=' . $HTTP_GET_VARS['page'] . '&mID=' . $mInfo->manufacturers_id . '&action=edit') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_MANUFACTURERS, 'page=' . $HTTP_GET_VARS['page'] . '&mID=' . $mInfo->manufacturers_id . '&action=delete') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a>');
	$contents[] = array('text' => '<br>' . TEXT_DATE_ADDED . ' ' . tep_date_short($mInfo->date_added));
	if (tep_not_null($mInfo->last_modified)) $contents[] = array('text' => TEXT_LAST_MODIFIED . ' ' . tep_date_short($mInfo->last_modified));
	$contents[] = array('text' => '<br>' . tep_info_image($mInfo->manufacturers_image, $mInfo->manufacturers_name));
	$contents[] = array('text' => '<br>' . TEXT_PRODUCTS . ' ' . $mInfo->products_count);
  }
  break;
 }

 if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) {
echo '			<td width="25%" valign="top">' . "\n";

$box = new box;
echo $box->infoBox($heading, $contents);

echo '			</td>' . "\n";
 }
?>
	  </tr>
	</table></td>
  </tr>
</table></td>
<!-- body_text_eof //-->
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

Thanks for any insight on this.

Edited by JEWbacca

Share this post


Link to post
Share on other sites

Dear Howard

 

I tried to install your Add-On "Manufacturers Multilanguage With Description". But I was not successful. I opened a thread but so far I did not find any support:

 

http://forums.oscommerce.com/index.php?showtopic=317256

 

What irritates me, is that the field "manufacturers_name" is being dropped by your SQL statement. After doing that nothing worked anymore. I haded to re-add the field to get my shop backup and running.

 

The reason I am interested in this add-on is because I want to display the manufacturer name in Japanese.

 

Thank you for your Feedback.

 

Best

Zeno

Share this post


Link to post
Share on other sites

Ok, got one more question:

 

I am trying to combine these two AddOns:

 

This Query is from the Manufacturer Multilanguage:

 

$manufacturers_query = tep_db_query("select ma.manufacturers_id, mi.manufacturers_name from " . TABLE_MANUFACTURERS . " ma," . TABLE_MANUFACTURERS_INFO . " mi where ma.manufacturers_id = mi.manufacturers_id and mi.languages_id = " . (int)$languages_id . " order by mi.manufacturers_name");

 

This Query is from the "Empty Manufacturers" AddOn - http://addons.oscommerce.com/info/5476 - :

$manufacturers_query = tep_db_query("select distinct " . TABLE_MANUFACTURERS . ".manufacturers_id, " . TABLE_MANUFACTURERS .

".manufacturers_name, products_id, products_status from " . TABLE_MANUFACTURERS . ", " . TABLE_PRODUCTS . " where " .

TABLE_MANUFACTURERS . ".manufacturers_id = " . TABLE_PRODUCTS .

".manufacturers_id and " . TABLE_PRODUCTS . ".products_status = 1 group

by manufacturers_name");

 

What I want to do is combine the two queries but I have not yet figured out how to do it! I want Multilanguage Manufacturers but I also do not want the Manufacturer name to show if all the products of the manufacturer are set to inactive.

 

Thank you for any Feedback and help.

 

Best

Zeno

Share this post


Link to post
Share on other sites

hi was working on this.. and I think I have figured it out in a easy way. for me it works.

 

i just wanted the manufacturers to work as countries, so I needed to be able to specify in english and spanish, as countries differ. i didn't need it for descriptions, image or url.

 

so the fix I have placed in the contribution area ,work for the multilanguage usage:

 

http://addons.oscommerce.com/info/3521

 

The main problems solved were:

 

- the structure for the left join

- the duplication of classes

- it couldn't find the field languages

 

so that is solved in this contribution.

 

hope it works for you too! good luck!!

Edited by zandapro

Share this post


Link to post
Share on other sites

hi all this is just what i need, i have a couple of issues, but ill start with the main prob, ive followed the instructions properly, i believe.

 

im getting the error:

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where manufacturers_id = '36'' at line 1

 

update manufacturers se where manufacturers_id = '36'

 

[TEP STOP]

 

now i see others have had this issue, but i cant see that anyone has solved it, i noticed the "se" in "update manufacturers se where manufacturers_id = '36'"

 

looked at the code but i cant see where the se is coming from.

 

I have the manufacturers.php from the 1.2 version

Any help would be great

 

Craig

Share this post


Link to post
Share on other sites

Hi i have a problem then i add manufacture:

 

Warning: array_merge() [function.array-merge]: Argument #1 is not an array in /home/argoshka/public_html/admin/manufacturers.php on line 26

 

Warning: reset() [function.reset]: Passed variable is not an array or object in /home/argoshka/public_html/admin/includes/functions/database.php on line 55

 

Warning: Variable passed to each() is not an array or object in /home/argoshka/public_html/admin/includes/functions/database.php on line 58

 

Warning: reset() [function.reset]: Passed variable is not an array or object in /home/argoshka/public_html/admin/includes/functions/database.php on line 62

 

Warning: Variable passed to each() is not an array or object in /home/argoshka/public_html/admin/includes/functions/database.php on line 63

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') values)' at line 1

 

insert into manufacturers) values)

 

[TEP STOP]

 

 

 

Can you help me?

 

 

 

database.php

.....

function tep_db_perform($table, $data, $action = 'insert', $parameters = '', $link = 'db_link') {

reset($data); //line55

if ($action == 'insert') {

$query = 'insert into ' . $table . ' (';

while (list($columns, ) = each($data)) { //line58

$query .= $columns . ', ';

}

$query = substr($query, 0, -2) . ') values (';

reset($data); //line62

while (list(, $value) = each($data)) { //line 63

switch ((string)$value) {

case 'now()':

$query .= 'now(), ';

break;

case 'null':

$query .= 'null, ';

break;

default:

$query .= '\'' . tep_db_input($value) . '\', ';

break;

}

.....

 

 

manufacturers.php get from archive Manufacturers Multilanguage With Description v1.2

 

How right change my own manufacturers.php?

Edited by juri.s

Share this post


Link to post
Share on other sites

Hello thanks for this contribution. Does anyone know what should I do if I only need to have the multilanguage for manufacturers?

 

Thank you

Share this post


Link to post
Share on other sites

I've covered this issue. Please see the link

 

http://forums.oscommerce.com/topic/310290-warning-array-merge-functionarray-merge-argument-1-is-not-an-array-in-homerdzfineapublic-htmlstoreadminmanufacturersphp-on-line-33/page__view__findpost__p__1521084

 

Hi i have a problem then i add manufacture:

 

Warning: array_merge() [function.array-merge]: Argument #1 is not an array in /home/argoshka/public_html/admin/manufacturers.php on line 26

 

Warning: reset() [function.reset]: Passed variable is not an array or object in /home/argoshka/public_html/admin/includes/functions/database.php on line 55

 

Warning: Variable passed to each() is not an array or object in /home/argoshka/public_html/admin/includes/functions/database.php on line 58

 

Warning: reset() [function.reset]: Passed variable is not an array or object in /home/argoshka/public_html/admin/includes/functions/database.php on line 62

 

Warning: Variable passed to each() is not an array or object in /home/argoshka/public_html/admin/includes/functions/database.php on line 63

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') values)' at line 1

 

insert into manufacturers) values)

 

[TEP STOP]

 

 

 

Can you help me?

 

 

 

database.php

.....

function tep_db_perform($table, $data, $action = 'insert', $parameters = '', $link = 'db_link') {

reset($data); //line55

if ($action == 'insert') {

$query = 'insert into ' . $table . ' (';

while (list($columns, ) = each($data)) { //line58

$query .= $columns . ', ';

}

$query = substr($query, 0, -2) . ') values (';

reset($data); //line62

while (list(, $value) = each($data)) { //line 63

switch ((string)$value) {

case 'now()':

$query .= 'now(), ';

break;

case 'null':

$query .= 'null, ';

break;

default:

$query .= '\'' . tep_db_input($value) . '\', ';

break;

}

.....

 

 

manufacturers.php get from archive Manufacturers Multilanguage With Description v1.2

 

How right change my own manufacturers.php?

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  

×