Пример #1
0
}
if (LANGUAGE_ID !== "ru") {
    return;
}
//Library
include_once dirname(__FILE__) . "/iblock_tools.php";
__IncludeLang(GetLangFileName(dirname(__FILE__) . "/lang/", "/" . basename(__FILE__)));
//Parameters
if (!is_array($arParams)) {
    $arParams = array();
}
if (strlen($arParams["site_id"]) <= 0) {
    $arParams["site_id"] = "s1";
}
$search = array("#IBLOCK.ID(XML_ID=FUTURE-1C-CATALOG)#");
$replace = array(CIBlockCMLImport::GetIBlockByXML_ID("FUTURE-1C-CATALOG"));
//Create directory and copy files
DEMO_IBlock_CopyFiles("/public/e-store/xml_catalog/", "/e-store/xml_catalog/", false, $search, $replace);
CopyDirFiles(dirname(__FILE__) . "/public/language/" . LANGUAGE_ID . "/e-store/xml_catalog/", $_SERVER["DOCUMENT_ROOT"] . "/e-store/xml_catalog", false, true);
//Add menu item
DEMO_IBlock_AddMenuItem("/e-store/.left.menu.php", array(GetMessage("DEMO_IBLOCK_ESTORE_XMLCAT_MENU"), "/e-store/xml_catalog/", array(), array(), ""));
if (IsModuleInstalled('catalog')) {
    //Create group and add it to importers
    $XMLCATALOG_GROUP_ID = DEMO_IBlock_AddUserGroup("1c_integration", GetMessage("DEMO_IBLOCK_XMLCATALOG_GROUP_NAME"), GetMessage("DEMO_IBLOCK_XMLCATALOG_GROUP_DESC"));
    //Tune 1C exchange
    if ($XMLCATALOG_GROUP_ID) {
        DemoSiteUtil::SetFilePermission(array($arParams["site_id"], "/bitrix/admin"), array($XMLCATALOG_GROUP_ID => "R"));
        COption::SetOptionString("catalog", "1C_GROUP_PERMISSIONS", $XMLCATALOG_GROUP_ID);
        COption::SetOptionString("catalog", "1C_SITE_LIST", $arParams["site_id"]);
    }
}
Пример #2
0
}
//Library
include_once dirname(__FILE__) . "/iblock_tools.php";
__IncludeLang(GetLangFileName(dirname(__FILE__) . "/lang/", "/" . basename(__FILE__)));
//Parameters
if (!is_array($arParams)) {
    $arParams = array();
}
if (strlen($arParams["site_id"]) <= 0) {
    $arParams["site_id"] = "s1";
}
//Import XML
if ($IBLOCK_ID = DEMO_IBlock_ImportXML("110_paid_paid-articles_" . LANGUAGE_ID . ".xml", $arParams["site_id"], false, true)) {
    $_SESSION["DEMO_IBLOCK_PAID"] = CIBlockCMLImport::GetIBlockByXML_ID("paid-subscribe");
    if ($SUBSCR_ID = DEMO_IBlock_ImportXML("120_paid_paid-subscribe_" . LANGUAGE_ID . ".xml", $arParams["site_id"], false, true)) {
        $SUBSCR_GROUP_ID = DEMO_IBlock_AddUserGroup("subscribers", GetMessage("DEMO_IBLOCK_ESTORE_PAID_GROUP_NAME"), GetMessage("DEMO_IBLOCK_ESTORE_PAID_GROUP_DESC"));
        //Create directory and copy files
        $search = array("#IBLOCK.ID(XML_ID=paid-articles)#", "#IBLOCK.ID(XML_ID=paid-subscribe)#", "#USER_GROUP.ID(STRING_ID=subscribers)#");
        $replace = array($IBLOCK_ID, $SUBSCR_ID, $SUBSCR_GROUP_ID);
        DEMO_IBlock_CopyFiles("/public/e-store/paid/", "/e-store/paid/", false, $search, $replace);
        CopyDirFiles(dirname(__FILE__) . "/public/language/" . LANGUAGE_ID . "/e-store/paid/", $_SERVER["DOCUMENT_ROOT"] . "/e-store/paid", false, true);
        //Add menu item
        DEMO_IBlock_AddMenuItem("/e-store/.left.menu.php", array(GetMessage("DEMO_IBLOCK_ESTORE_PAID_MENU"), "/e-store/paid/", array(), array(), ""));
        if ($_SESSION["DEMO_IBLOCK_PAID"] === false) {
            DEMO_IBlock_ImportXML("120_paid_paid-subscribe-offers_" . LANGUAGE_ID . ".xml", $arParams["site_id"], true, false);
            if (CModule::IncludeModule('catalog')) {
                CCatalog::Update($SUBSCR_ID, array("SUBSCRIPTION" => "Y"));
            }
        }
    }
}