<?php
/**
* @version	$Id: manufacturers_tag_processor.php 15156 2012-03-04 09:27:14Z alex $
* @package	In-Commerce
* @copyright	Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license	Commercial License
* This software is protected by copyright law and international treaties.
* Unauthorized reproduction or unlicensed usage of the code of this program,
* or any portion of it may result in severe civil and criminal penalties,
* and will be prosecuted to the maximum extent possible under the law
* See http://www.in-portal.org/commercial-license for copyright notices and details.
*/

defined('FULL_PATH') or die('restricted access!');

class ManufacturersTagProcessor extends kDBTagProcessor{

	function BuildListSpecial($params)
	{
		if ($this->Special != '') return $this->Special;
		if ( isset($params['parent_cat_id']) ) {
			$parent_cat_id = $params['parent_cat_id'];
		}
		else {
			$parent_cat_id = $this->Application->GetVar('c_id');
			if (!$parent_cat_id) {
				$parent_cat_id = $this->Application->GetVar('m_cat_id');
			}
		}
		$recursive = isset($params['recursive']);

		$list_unique_key = $this->getUniqueListKey($params).$recursive;
		if ($list_unique_key == '') {
			return parent::BuildListSpecial($params);
		}

		return crc32($parent_cat_id.$list_unique_key);
	}

	function ListManufacturers($params)
	{
		return $this->PrintList2($params);
	}

	function ManufacturerLink($params)
	{
		$object = $this->getObject($params);

		$params['pass'] = 'm,manuf';
		$params['m_cat_id'] = 0;
		$params['manuf_id']	= $object->GetID();

	 	return $this->Application->ProcessParsedTag('m', 'Link', $params);
	}
}