<?php 
/**
 * Система управления сайтом HostCMS v. 5.xx
 * Copyright © 2005-2010 ООО "Хостмэйк" (Hostmake LLC), http://www.hostcms.ru
 *
 * Обработчик добавления/редактирования директории доп. свойств товара.
 * 
 * Файл: /admin/shop/action/add_item_dir_property.php
 * 
 * @author Hostmake LLC
 * @version 5.x
 */
// Получаем переданные параметры
$param = array();

if (isset($_REQUEST['shop_properties_items_dir_id'])
&& $_REQUEST['shop_properties_items_dir_id'] != 0) 
{
	$param['shop_properties_items_dir_id'] = intval($_REQUEST['shop_properties_items_dir_id']);
}

$param['shop_shops_id'] = to_int($_REQUEST['shop_shops_id']);
$param['shop_properties_items_dir_parent_id'] = to_int($_REQUEST['shop_properties_items_dir_parent_id']);
$param['shop_properties_items_dir_name'] = to_str($_REQUEST['shop_properties_items_dir_name']);
$param['shop_properties_items_dir_description'] = to_str($_REQUEST['shop_properties_items_dir_description']);
$param['shop_properties_items_dir_order'] = to_int($_REQUEST['shop_properties_items_dir_order']);

if ($shop_properties_items_dir_id = $shop->InsertPropertiesItemsDir($param))
{
	$admin_forms = new admin_forms();
	$window_id = $admin_forms->GetWindowId();
	?><script type="text/javascript">
	$.appendInput('<?php echo $window_id?>', 'EditAddDirProperty', 'shop_properties_items_dir_id', '<?php echo $shop_properties_items_dir_id?>');
	</script><?php

	if (isset($_REQUEST['shop_properties_items_dir_id'])) 
	{
		show_message($GLOBALS['MSG_shops']['edit_success']);
	}
	else 
	{
		show_message($GLOBALS['MSG_shops']['add_success']);
	}
}
else 
{
	if (isset($_REQUEST['shop_properties_items_dir_id'])) 
	{
		show_error_message($GLOBALS['MSG_shops']['error_edit_success']);
	}
	else 
	{
		show_error_message($GLOBALS['MSG_shops']['error_add_success']);
	}
}
?>