Last active
April 7, 2023 15:20
-
-
Save Ginnw2/87028f7d293c2c649c813a68eb29bafb to your computer and use it in GitHub Desktop.
Установить цену 1 р для всех товаров.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?CModule::IncludeModule("catalog"); | |
$arSelect = Array("ID", "IBLOCK_ID", "CATALOG_PRICE_1"); | |
$arFilter = Array("IBLOCK_ID"=>17); | |
//ID инфоблока с ТП, а не с простыми товарами | |
$resw = CIBlockElement::GetList(Array(), $arFilter, false, Array("nPageSize"=>1000000), $arSelect); | |
while($ob = $resw->GetNextElement()){ | |
$arFields = $ob->GetFields(); | |
$arProps = $ob->GetProperties(); | |
{ | |
echo $arFields[ID].' - '.$arFields['CATALOG_PRICE_1'].'</br>'; | |
$PRODUCT_ID = $arFields[ID]; | |
$PRICE_TYPE_ID = 1; | |
//Тип цены смотрим в админке, обычно 1 | |
$arFields = Array( | |
"PRODUCT_ID" => $PRODUCT_ID, | |
"CATALOG_GROUP_ID" => $PRICE_TYPE_ID, | |
"PRICE" => '1', | |
"CURRENCY" => "RUB" | |
); | |
$res = CPrice::GetList( | |
array(), | |
array( | |
"PRODUCT_ID" => $PRODUCT_ID, | |
"CATALOG_GROUP_ID" => $PRICE_TYPE_ID | |
) | |
); | |
if ($arr = $res->Fetch()) | |
{ | |
CPrice::Update($arr["ID"], $arFields); | |
} | |
else | |
{ | |
CPrice::Add($arFields); | |
}; | |
} | |
};?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment