<?php
/**
* @version	$Id: product_options_config.php 16385 2016-08-11 08:15:43Z 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!');

$config = Array (
	'Prefix' => 'po',
	'ItemClass' => Array ('class' => 'kDBItem', 'file' => '', 'build_event' => 'OnItemBuild'),
	'ListClass' => Array ('class' => 'kDBList', 'file' => '', 'build_event' => 'OnListBuild'),
	'EventHandlerClass' => Array ('class' => 'ProductOptionsEventHandler', 'file' => 'product_options_event_handler.php', 'build_event' => 'OnBuild'),
	'TagProcessorClass' => Array ('class' => 'ProductOptionsTagProcessor', 'file' => 'product_options_tag_processor.php', 'build_event' => 'OnBuild'),

	'RegisterClasses' => Array (
		Array ('pseudo' => 'kProductOptionsHelper', 'class' => 'kProductOptionsHelper', 'file' => 'product_options_helper.php', 'build_event' => ''),
	),

	'AutoLoad' => true,

	'AggregateTags' => Array (
		Array (
			'AggregateTo' => '#PARENT#',
			'AggregatedTagName' => 'ListOptions',
			'LocalTagName' => 'ListOptions',
		),
	),

	'QueryString' => Array (
		1 => 'id',
		2 => 'Page',
		3 => 'PerPage',
		4 => 'event',
	),

	'TitleField' => 'Name',
	'IDField' => 'ProductOptionId',
	'TableName' => TABLE_PREFIX.'ProductOptions',
	'ForeignKey' => 'ProductId',
	'ParentTableKey' => 'ProductId',
	'ParentPrefix' => 'p',
	'AutoDelete' => true,
	'AutoClone' => true,
	'SubItems' => Array ('poc'),

	'ListSQLs' => Array (
		'' => '	SELECT *
				FROM %s',
	),

	'ListSortings' => Array (
		'' => Array (
			'Sorting' => Array ('Name' => 'asc'),
			'ForcedSorting' => Array ('Priority' => 'desc'),
		)
	),

	'Fields' => Array (
		'ProductOptionId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
		'ProductId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
		'Name' => Array ('type' => 'string', 'required' => 1, 'max_len' => 255, 'not_null' => 1, 'default' => '',),
		'OptionType' => Array ('type' => 'int', 'required' => 1, 'formatter' => 'kOptionsFormatter', 'use_phrases' => 1, 'options' =>Array (1 => '!la_type_select!', 5 => '!la_type_text!', 4 => '!la_type_textarea!', 3 => '!la_type_radio!', 6 => '!la_type_checkbox!' /*,  2 => '!la_type_password!' */), 'not_null' => 1, 'default' => 0),
		'Required' => Array (
			'type' => 'int',
			'formatter' => 'kOptionsFormatter',
			'options' => Array (0 => 'la_No', 1 => 'la_Yes'), 'use_phrases' => 1,
			'not_null' => 1, 'default' => 0,
		),
		'Listable' => Array (
			'type' => 'int',
			'formatter' => 'kOptionsFormatter',
			'options' => Array (0 => 'la_No', 1 => 'la_Yes'), 'use_phrases' => 1,
			'not_null' => 1, 'default' => 0,
		),
		'Priority' => Array ('type' => 'int', 'not_null' =>1, 'default' =>0),
		'Values' => Array ('type' => 'string', 'default' => NULL),
		'Prices' => Array ('type' => 'string', 'default' => NULL),
		'PriceTypes' => Array ('type' => 'string', 'default' => NULL),
	),

	'Grids' => Array (
		'Default' => Array (
			'Icons' => Array (
				'default' => 'icon16_item.png',
				'module' => 'core',
			),	// icons for each StatusField values, if no matches or no statusfield selected, then "default" icon is used
			'Fields' => Array (
				'ProductOptionId' => Array ( 'title' => 'column:la_fld_Id', 'data_block' => 'grid_checkbox_td', 'filter_block' => 'grid_range_filter'),
				'Name' => Array ( 'data_block' => 'option_name_td', 'filter_block' => 'grid_like_filter'),
				'OptionType' => Array ( 'filter_block' => 'grid_options_filter'),
				'Required' => Array ( 'filter_block' => 'grid_options_filter'),
//				'Listable' => Array ('filter_block' => 'grid_options_filter'),
			),
		),
	),
);