Advertisement
Guest User

Untitled

a guest
Jul 30th, 2015
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.02 KB | None | 0 0
  1. <?php
  2.  
  3. CModule::IncludeModule("iblock");
  4. CModule::IncludeModule("sale");
  5. CModule::IncludeModule("catalog");
  6. $CATALOG_IBLOCK_ID = "14";
  7. $OFFERS_IBLOCK_ID = "15";
  8. $MAIN_SECTION_ID = "880";
  9.  
  10.  
  11. $arSort = array("SORT" => "ASC");
  12. $arFilter = array("IBLOCK_ID" => $CATALOG_IBLOCK_ID, "ID" => $MAIN_SECTION_ID, "ACTIVE" => "Y", "GLOBAL_ACTIVE" => "Y");
  13. $cSection = CIBlockSection::GetList($arSort, $arFilter);
  14. if($cSection = $cSection->GetNext())
  15. {
  16. $arFilter = array("IBLOCK_ID" => $CATALOG_IBLOCK_ID, '>LEFT_MARGIN'=>$cSection['LEFT_MARGIN'],
  17. '<RIGHT_MARGIN'=>$cSection['RIGHT_MARGIN'], "ACTIVE" => "Y", "!ID" => $cSection["ID"]);
  18. $rsSections = CIBlockSection::GetList($arSort, $arFilter);
  19.  
  20. $arResult['SECTION'] = array();
  21. while ($arSection = $rsSections->GetNext()) {
  22. $arResult['SECTION'][$arSection['ID']] = $arSection['ID'];
  23. }
  24.  
  25. $elements = "";
  26. $arOrder = array("SORT" => "ASC");
  27. $arFilter = array("ACTIVE" => "Y", "INCLUDE_SUBSECTIONS" => "Y", "IBLOCK_ID" => $CATALOG_IBLOCK_ID, "SECTION_ID" => $MAIN_SECTION_ID);
  28. $rsElements = CIBlockElement::GetList($arOrder, $arFilter, FALSE, FALSE);
  29. while ($arElement = $rsElements->GetNextElement())
  30. {
  31. $fields = $arElement->GetFields();
  32. $props = $arElement->GetProperties();
  33.  
  34. $arOrder = array("SORT" => "ASC");
  35. $arOffersFilter = array("ACTIVE" => "Y", "IBLOCK_ID" => $OFFERS_IBLOCK_ID, "PROPERTY_CML2_LINK" => $fields["ID"]);
  36. $rsOffersElements = CIBlockElement::GetList($arOrder, $arOffersFilter, FALSE, FALSE);
  37. while ($arOffer = $rsOffersElements->GetNextElement())
  38. {
  39.  
  40. if (!$arResult['SECTION'][$fields["IBLOCK_SECTION_ID"]]) {
  41.  
  42. $db_old_groups = CIBlockElement::GetElementGroups($fields["ID"], true);
  43.  
  44. $ar_new_groups = array($NEW_GROUP_ID);
  45. while($ar_group = $db_old_groups->Fetch())
  46. {
  47. echo '<pre>';
  48. var_dump($ar_group);
  49. echo '</pre>';
  50. }
  51. }
  52. }
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement