Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //title: Парсим CSV
- $csv = array_map('str_getcsv', file('/home/c/ci25473/belikova.net/public_html/upload/export_file_3XuhuHO4sQop9HPt.csv'));
- foreach ($csv as $item) {
- $csv_new[] = $item[0];
- }
- // echo "<pre>";
- // print_r($csv_new);
- // echo "</pre>";
- CModule::IncludeModule('iblock');
- $IBLOCK_ID = 6;
- $arSelect = Array("ID", "CODE");
- $arFilter = Array("IBLOCK_ID" => $IBLOCK_ID, "ACTIVE_DATE" => "Y", "ACTIVE" => "Y");
- $res = CIBlockElement::GetList(Array(), $arFilter, false, Array(), $arSelect);
- $i = 0;
- while($ob = $res->GetNextElement()) {
- $arFields = $ob->GetFields();
- // echo "<pre>";
- // print_r($arFields);
- // echo "</pre>";
- $ELEMENT_ID = $arFields["ID"];
- $property_value = $arFields["CODE"];
- $property_code = "CODE";
- $bd[] = $property_value;
- if (in_array($property_value, $csv_new)) {
- $arLoadProductArray = Array(
- "CODE" => ""
- );
- $el = new CIBlockElement;
- $tmp = $el->Update($ELEMENT_ID, $arLoadProductArray);
- $i++;
- }
- // CIBlockElement::SetPropertyValueCode($ELEMENT_ID, $property_code, $property_value);
- }
- //echo count($csv_new);
- //echo $i;
- //print_r(array_count_values ($bd));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement