<?php
/**
 *\licence GPL 2005-2010  The osCSS developers - osCSS Open Source E-commerce
 *\portion code Copyright (c) 2002 osCommerce
 *\package osCSS-2 <www http://www.oscss.org>
 *\version 2.1.0
 *\date  28/11/10, 08:18
 *\author oscim <mail aurelien@oscim.fr> <www http://www.oscim.fr>
 *\encode UTF-8
 *\group boxes
 *\file includes/boxes/manufacturers.php
 */
  $DB=Database::getInstance();
  global $page,$language,$languages_id,  $manufacturers_array, $number_of_rows;
  $s='';
  $language=$page->the_var('language');
  $osCSS_Cache=new osCSS_Cache;
  $page->_conf_value('MAX_MANUFACTURERS_LIST');
  $manufacturers_array = array();
  $manufacturers_query = $DB->query($sql="select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name");
  if ($number_of_rows = $manufacturers_query->__get('numRows') > 0) {
    if (($osCSS_Cache->read('manufacturerBox-' . $language .'-rows-'.MAX_DISPLAY_MANUFACTURERS_IN_A_LIST, 720) === false) ) {

    if ($page->_conf_value('MAX_MANUFACTURERS_LIST') != 0 && $number_of_rows >= $page->_conf_value('MAX_DISPLAY_MANUFACTURERS_IN_A_LIST')){
     if ($page->_conf_value('MAX_MANUFACTURERS_LIST') < 2)  $manufacturers_array[] = array('id' => '', 'text' => PULL_DOWN_DEFAULT);
    }

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

    $s=tep_get_include_contents('box.manufacturers');
    $osCSS_Cache->writeBuffer($s);
    }
    else $s= $osCSS_Cache->getCache();
 }
$array= array('title'=>__('box heading manufacturers'),'content'=>tep_output_string_protected($s,false,true));
?>