change IBLOCK_ID source to Bitrix's dbconn file constants

This commit is contained in:
merelendor 2024-05-14 20:25:27 +03:00
parent d87d7fea78
commit e944d8081d

View File

@ -183,7 +183,7 @@ function models_check($bitrix_models, $bitrix_modifications, $brand_uid, $brand)
$CODE = CUtil::translit( $NAME, "ru", [ "max_len" => 255, "change_case" => "L", "replace_space" => "-", "replace_other" => "-", ] ); $CODE = CUtil::translit( $NAME, "ru", [ "max_len" => 255, "change_case" => "L", "replace_space" => "-", "replace_other" => "-", ] );
//"ID" //"ID"
$modification_search_res = CIBlockElement::GetList( [], [ "IBLOCK_ID" => 10, "CODE" => $CODE ], false, ["nPageSize" => 1], [] ); $modification_search_res = CIBlockElement::GetList( [], [ "IBLOCK_ID" => IBLOCK_ID_MODIFICATIONS, "CODE" => $CODE ], false, ["nPageSize" => 1], [] );
while($modification_search_ob = $modification_search_res->GetNextElement()) while($modification_search_ob = $modification_search_res->GetNextElement())
{ {
$m_res = $modification_search_ob->GetFields(); $m_res = $modification_search_ob->GetFields();
@ -197,7 +197,7 @@ function models_check($bitrix_models, $bitrix_modifications, $brand_uid, $brand)
if($modification_existed === null) if($modification_existed === null)
{ {
$modification_element = new CIBlockElement; $modification_element = new CIBlockElement;
$modification_payload = [ "IBLOCK_SECTION_ID" => false, "IBLOCK_ID" => 10, "PROPERTY_VALUES" => [ "MODEL_UID" => $model_uid, "TITLE" => $modification ], "NAME" => $NAME, "CODE" => $CODE, "ACTIVE" => "Y", ]; $modification_payload = [ "IBLOCK_SECTION_ID" => false, "IBLOCK_ID" => IBLOCK_ID_MODIFICATIONS, "PROPERTY_VALUES" => [ "MODEL_UID" => $model_uid, "TITLE" => $modification ], "NAME" => $NAME, "CODE" => $CODE, "ACTIVE" => "Y", ];
if($new_modification_id = $modification_element->Add($modification_payload)) if($new_modification_id = $modification_element->Add($modification_payload))
{ {
@ -258,7 +258,7 @@ foreach($json AS $car)
//"ID" //"ID"
$car_existed = null; $car_existed = null;
$car_search_res = CIBlockElement::GetList( [], [ "IBLOCK_ID" => 1, "PROPERTY_UID" => $car['uid'] ], false, ["nPageSize" => 1], [] ); $car_search_res = CIBlockElement::GetList( [], [ "IBLOCK_ID" => IBLOCK_ID_CATALOG_CARS_NEW, "PROPERTY_UID" => $car['uid'] ], false, ["nPageSize" => 1], [] );
while($car_search_ob = $car_search_res->GetNextElement()) while($car_search_ob = $car_search_res->GetNextElement())
{ {
@ -278,7 +278,7 @@ foreach($json AS $car)
//if($c === 0) //if($c === 0)
//{ //{
$car_element = new CIBlockElement; $car_element = new CIBlockElement;
$car_payload = [ "IBLOCK_SECTION_ID" => false, "IBLOCK_ID" => 1, "NAME" => $name, "CODE" => $code, "PROPERTY_VALUES" => $PROPERTY_VALUES, "ACTIVE" => "Y", ]; $car_payload = [ "IBLOCK_SECTION_ID" => false, "IBLOCK_ID" => IBLOCK_ID_CATALOG_CARS_NEW, "NAME" => $name, "CODE" => $code, "PROPERTY_VALUES" => $PROPERTY_VALUES, "ACTIVE" => "Y", ];
if($new_car_id = $car_element->Add($car_payload)) if($new_car_id = $car_element->Add($car_payload))
{ {