Доброго дня!
Создаю собственное решение для маркетплейса, но не могу разобраться как установить шаблоны по условию.
При установке в условиях шаблона сайта только 1 шаблон, как добавить программно шаблоны по php-условию?
Есть файл в модуле(находится в ... \site\services\main\template.php , но он не работает, почему?): [CODE]<?
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true)
die();
if (!defined("WIZARD_TEMPLATE_ID"))
return;
$bitrixTemplateDir = $_SERVER["DOCUMENT_ROOT"] . "/bitrix/templates/" . WIZARD_TEMPLATE_ID;
CopyDirFiles(
$_SERVER["DOCUMENT_ROOT"] . WizardServices::GetTemplatesPath(WIZARD_RELATIVE_PATH . "/site") . "/" . WIZARD_TEMPLATE_ID,
$bitrixTemplateDir,
$rewrite = true,
$recursive = true,
$delete_after_copy = false
);
$obSite = CSite::GetList($by = "def", $order = "desc", Array("LID" => WIZARD_SITE_ID));
if ($arSite = $obSite->Fetch()) {
$arTemplates = Array();
$arTemplates[] = Array("CONDITION" => "", "SORT" => 1, "TEMPLATE" => "name");
$arTemplates[] = Array("CONDITION" => "\$_SESSION['template_site']=='red'", "SORT" => 2, "TEMPLATE" => "name");
$arTemplates[] = Array("CONDITION" => "\$_SESSION['template_site']=='blue'", "SORT" => 3, "TEMPLATE" => "name_blue");
$arTemplates[] = Array("CONDITION" => "\$_SESSION['template_site']=='green'", "SORT" => 4, "TEMPLATE" => "name_green");
$arFields = Array(
"TEMPLATE" => $arTemplates,
"NAME" => $arSite["NAME"],
);
$obSite = new CSite();
$obSite->Update($arSite["LID"], $arFields);
}
COption::SetOptionString("main", "wizard_template_id", WIZARD_TEMPLATE_ID, false, WIZARD_SITE_ID);
?>
[/CODE]