<?php
/**
* @version	$Id: product_option_combinations_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 ProductOptionCombinationsTagProcessor extends kDBTagProcessor {

		function ListOptions($params)
		{
			$o = '';

			return $o;
		}

		function ListValues($params)
		{
			$o = '';

			return $o;
		}

		function ShowCombination($params)
		{
			$object = $this->getObject($params);
			$combination = unserialize($object->GetDBField('Combination'));

			$block_params['name'] = $params['render_as'];

			$opt_helper = $this->Application->recallObject('kProductOptionsHelper');
			$o = '';
			$i = 0;
			foreach ($combination as $opt => $val) {
				$i++;
				$block_params['option_id'] = $opt;
				$conv_key = $opt_helper->ConvertKey($opt, $object->GetDBField('ProductId'));
				$block_params['option_name'] = $conv_key['Name'];

				if (is_array($val)) {
					$val = join(',', $val);
				}
				$block_params['option_value'] = $val;
				$block_params['is_last'] = $i == count($combination);
				$o .= $this->Application->ParseBlock($block_params);
			}
			return $o;
		}

	}