Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- CModule::IncludeModule("iblock");
- CModule::IncludeModule("sale");
- CModule::IncludeModule("catalog");
- $CATALOG_IBLOCK_ID = "14";
- $OFFERS_IBLOCK_ID = "15";
- $MAIN_SECTION_ID = "880";
- $arSort = array("SORT" => "ASC");
- $arFilter = array("IBLOCK_ID" => $CATALOG_IBLOCK_ID, "ID" => $MAIN_SECTION_ID, "ACTIVE" => "Y", "GLOBAL_ACTIVE" => "Y");
- $cSection = CIBlockSection::GetList($arSort, $arFilter);
- if($cSection = $cSection->GetNext())
- {
- $arFilter = array("IBLOCK_ID" => $CATALOG_IBLOCK_ID, '>LEFT_MARGIN'=>$cSection['LEFT_MARGIN'],
- '<RIGHT_MARGIN'=>$cSection['RIGHT_MARGIN'], "ACTIVE" => "Y", "!ID" => $cSection["ID"]);
- $rsSections = CIBlockSection::GetList($arSort, $arFilter);
- $arResult['SECTION'] = array();
- while ($arSection = $rsSections->GetNext()) {
- $arResult['SECTION'][$arSection['ID']] = $arSection['ID'];
- }
- $elements = "";
- $arOrder = array("SORT" => "ASC");
- $arFilter = array("ACTIVE" => "Y", "INCLUDE_SUBSECTIONS" => "Y", "IBLOCK_ID" => $CATALOG_IBLOCK_ID, "SECTION_ID" => $MAIN_SECTION_ID);
- $rsElements = CIBlockElement::GetList($arOrder, $arFilter, FALSE, FALSE);
- while ($arElement = $rsElements->GetNextElement())
- {
- $fields = $arElement->GetFields();
- $props = $arElement->GetProperties();
- $arOrder = array("SORT" => "ASC");
- $arOffersFilter = array("ACTIVE" => "Y", "IBLOCK_ID" => $OFFERS_IBLOCK_ID, "PROPERTY_CML2_LINK" => $fields["ID"]);
- $rsOffersElements = CIBlockElement::GetList($arOrder, $arOffersFilter, FALSE, FALSE);
- while ($arOffer = $rsOffersElements->GetNextElement())
- {
- if (!$arResult['SECTION'][$fields["IBLOCK_SECTION_ID"]]) {
- $db_old_groups = CIBlockElement::GetElementGroups($fields["ID"], true);
- $ar_new_groups = array($NEW_GROUP_ID);
- while($ar_group = $db_old_groups->Fetch())
- {
- echo '<pre>';
- var_dump($ar_group);
- echo '</pre>';
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement