<?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 manufacturer_info.php
 *\brief Boite de detail d'un fabricant
 *
 *		Cette boite ne produit un affichage que sur la pgage produit, et affiche le detail du fabricant du produits
*/

  $DB=Database::getInstance();
  global $page,$boxe;
  $s='';
  $languages_id=$page->the_var('languages_id');

  if (!isset($_GET['products_id'])) return false;

  $manufacturer_query = $DB->query($sql="select m.manufacturers_id, m.manufacturers_name, m.manufacturers_image, mi.manufacturers_url from " . TABLE_MANUFACTURERS . " m left join " . TABLE_MANUFACTURERS_INFO . " mi on (m.manufacturers_id = mi.manufacturers_id and mi.languages_id = '" . (int)$languages_id . "'), " . TABLE_PRODUCTS . " p  where p.products_id = '" . (int)$_GET['products_id'] . "' and p.manufacturers_id = m.manufacturers_id");

  if ($manufacturer_query->__get('numRows')>0) {
    $manufacturer = $manufacturer_query->fetchAssoc();
    if (tep_not_null($manufacturer['manufacturers_image']))
      $s .=  '<p class="boxes manufacturerImage image"><a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $manufacturer['manufacturers_id']) . '">' . tep_image(DIR_WS_IMAGES . $manufacturer['manufacturers_image'], $manufacturer['manufacturers_name'],$page->_conf_value('SMALL_IMAGE_WIDTH'), $page->_conf_value('SMALL_IMAGE_HEIGHT') ) . '</a></p>';
    if (tep_not_null($manufacturer['manufacturers_url']))
      $s .= '<p class="boxes manufacturerLinks link ext"><a href="' . tep_href_link(FILENAME_REDIRECT, 'action=manufacturer&amp;manufacturers_id=' . $manufacturer['manufacturers_id']) . '">' . sprintf(__('box manufacturer info homepage'), $manufacturer['manufacturers_name']) . '</a></p>';
    $s .= '<p class="boxes manufacturerOtherproduct link int"><a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $manufacturer['manufacturers_id']) . '">' . __('box manufacturer info other products') . '</a></p>';

  }

  $array= array('title'=>__('box heading manufacturer info'),'content'=>tep_output_string_protected($s,false,true));
?>