<?php
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
/**
* Manufacturer Search Module
*
* NOTE: THIS MODULE REQUIRES THE MAMBO-PHPSHOP COMPONENT!
/*
* @version $Id: mod_phpshop_manufacturers.php,v 1.2 2004/09/09 18:58:43 soeren_nb Exp $
* @package Mambo_4.5.1
* @subpackage mambo-phpShop
*
* @copyright (C) 2004 Soeren Eberhardt
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* mambo-phpShop is Free Software.
* mambo-phpShop comes with absolute no warranty.
*
* www.mambo-phpshop.net
*/

global $mosConfig_absolute_path;

$text_before = $params->get( 'text_before', '');

// the configuration file for PHPShop
require_once( "components/com_phpshop/phpshop_parser.php");
    
  $query  = "SELECT manufacturer_id,mf_name FROM #__pshop_manufacturer ";
  $query .= "ORDER BY mf_name ASC";
  
    $database->setQuery( $query );
    $database->query();
    $res = $database->loadObjectList();
    
    ?>
<table cellpadding="1" cellspacing="1" border="0" width="80%">


    <!--BEGIN manufacturer Search Box --> 
  <tr> 
    <td colspan="2">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td><?php echo $text_before ?></td>
        </tr>
        <tr><td>&nbsp;</td></tr>
        <? foreach( $res as $manufacturer) { ?>
            <tr>
                <td><a href="index.php?option=com_phpshop&page=shop.browse&manufacturer_id=<? echo $manufacturer->manufacturer_id ?>">
                    <? echo $manufacturer->mf_name; ?>
                    </a>
                </td>
            </tr>
        <? } ?>
      </table>
    </td>
  </tr>
  
  <tr> 
    <td colspan="2"> 
      <form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post">
        <input type="hidden" name="option" value="com_phpshop" />
        <input type="hidden" name="page" value="shop.browse" />
        <br>
        <select class="inputbox" name="manufacturer_id">
            <option value=""><? echo _CMN_SELECT ?></option>
        <?php  
                foreach ($res as $manufacturer) { ?>
            <option value="<? echo $manufacturer->manufacturer_id ?>"><? echo $manufacturer->mf_name ?></option>
          <? } ?>
        </select>
      
    </td>
  </tr>
  <tr>
      <td>
          <input class="button" type="submit" name="manufacturerSearch" value="<?php echo _SEARCH_TITLE ?>" />
          </form>
      </td>
  </tr>

  <!-- End manufacturer Search Box --> 

</table>
