|
|
Ok!
|
|
|
Ok!
|
|---|---|---|---|---|
| 294 | $arSelect = Array("ID", "NAME");
$arFilter = Array("IBLOCK_ID"=>2, "ACTIVE"=>"Y");
$res = CIBlockElement::GetList(Array("NAME" => "ASC"), $arFilter, false, Array("nPageSize" => 1005), $arSelect);
$i = 1;
$name = [];
while($ob = $res->GetNextElement())
{
$arFields = $ob->GetFields();
$sel = $DB->Query("SELECT NAME FROM b_sale_order_props_variant WHERE NAME LIKE '%" . $arFields['NAME'] . "%'");
while($res_name = $sel->Fetch()) {
$name[] = $res_name['NAME'];
}
//echo $name;
if(!in_array($arFields['NAME'], $name)) {
$query = "INSERT INTO b_sale_order_props_variant VALUES ('', 26, '" . $arFields['NAME'] . "', '" . Cutil::translit($arFields['NAME'], "ru", array("replace_space"=>"-","replace_other"=>"-")) . "', " . $i*100 . ", '', 'bx_" . hash("crc32", $arFields['NAME']) . "')";
echo $query . "
";
$DB->Query($query);
}
else {
$query = "UPDATE b_sale_order_props_variant SET SORT = " . $i*100 . " WHERE NAME = '" . $arFields['NAME'] . "'";
echo $query . "
";
$DB->Query($query);
}
$i++;
} | свойства заказа | 10090 | Добавить свойство Пункт самовывоза в список свойств Заказа в Битрикс |