A
A
anriko2021-03-03 09:50:05
1C-Bitrix
anriko, 2021-03-03 09:50:05

How to change the mass value of the SUBSCRIBE field?

I try it didn't work. where is the mistake ?

/* для поменл значения  свойств  в товаре */
function copy_from_fields_to_propertys_values($IBLOCK_ID){
    if ( CModule::IncludeModule ( "iblock" ) ){
        $arOrder = array(
            "sort" => "ASC",
        );

        $arFilter = array(
       "IBLOCK_ID" => $IBLOCK_ID,
        );

     

        $arSelect = array(
            "NAME",
            "ID",
            'SUBSCRIBE' );

       

        $db_elemens = CIBlockElement::GetList ( $arOrder, $arFilter, false, false, $arSelect );
        while ( $arElement = $db_elemens->GetNextElement() ) {
          
            $el = new CIBlockElement;
            $filds = $arElement->GetFields();

            print_r($filds['ID']);
            echo"</br>";
            echo"</br>";
            $arLoadProductArray = Array(
                "SUBSCRIBE"   => "Y"
            );
        $res = $el->Update($filds['ID'], $arLoadProductArray);
    
    }

    } else {
        die( "Модуль iblock не установлен" );
    }
}
copy_from_fields_to_propertys_values('33')
;

603f3cc307240288368072.png

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexey Emelyanov, 2021-03-03
@babarun

If you want to save in a property then PROPERTY_ SUBSCRIBE

N
no_one_safe, 2021-03-03
@no_one_safe

This property is not an infblock, but a trade catalog

P
PetrPo, 2021-03-03
@PetrPo

method , below there is an example with SUBSCRIBE (only this is a static method):
D - by default, from the module settings Y
- yes
N - no
UPD
still in the source code it is written that the method is deprecated, use

\Bitrix\Catalog\Model\Product::update($id, ['SUBSCRIBE' => 'Y']);

UPDUPD
here is an example with CAN_BUY_ZERO, replace it with SUBSCRIBE - it will drive for once

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question