A
A
Alexander Arbuzov2015-10-27 16:13:10
1C-Bitrix
Alexander Arbuzov, 2015-10-27 16:13:10

Bitrix, how to change ELEMENT_XML_ID?

I can't figure out how to change ELEMENT_XML_ID. My products were imported from another site and their article number is filled in this field. I have an Xml export from 1C, I run it and try to fill in the ELEMENT_XML_ID field for the product. Nothing works. Tell me how to do it right? I don’t know Bitrix at all, I know how to use documentation and Google.
What I managed to get:

$xml = new SimpleXMLElement($importCatalogData,LIBXML_NOENT);
    foreach ($xml->Каталог->Товары->Товар as $xmlItem){
        $sku = trim((string)$xmlItem->Артикул);
        $name = trim((string)$xmlItem->Наименование);
        $importId = trim((string)$xmlItem->Ид);
        if($sku != ''){
            $db_res = CCatalogProduct::GetList(false,array("ELEMENT_XML_ID" => "{$sku}"));
            while ($ar_res = $db_res->Fetch()){
                //echo $ar_res['ELEMENT_IBLOCK_ID']." - ".$ar_res['ID']." - ".$importId." - ".$ar_res["ELEMENT_NAME"]."<br>";
                CIBlockElement::SetPropertyValuesEx($ar_res['ID'], false, array('ELEMENT_XML_ID'=>$importId));
            }
        }
    }

The option to get a couple of top three certificates from Bitrix is ​​exciting, but does not fit the timing. So you can't offer.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis K, 2015-10-27
@arbuzzz

Look at the method dev.1c-bitrix.ru/api_help/iblock/classes/ciblockel...
the field name will be XML_ID, not ELEMENT_XML_ID dev.1c-bitrix.ru/api_help/iblock/fields.php#felement

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question