Bitrix. Infoblock type of key value



  • Hey! There's a challenge to make a web interface for texting. In short, there's a text field and a field for several numbers. On application to the button by POST, a message is sent as follows: номер:текстin return ID messages. How do I keep information in the infoblock? ID:номер One element?



  • If you need an infoblock,

    1. Telephone number (PROPERTY_PHONE)
    2. There's a processor on the page that will add an element.

    Processor code:

    <?
        if(isset($_REQUEST["phone"]) && isset($_REQUEST["mess"]) ){
        $el = new CIBlockElement;
    
    $PROP = array();
    $PROP["PHONE"] = $_REQUEST["phone"];  // свойству с кодом 12 присваиваем значение "Белый"   
    
    $arLoadProductArray = Array(
        "MODIFIED_BY"    =&gt; $USER-&gt;GetID(), // элемент изменен текущим пользователем
        "IBLOCK_SECTION_ID" =&gt; false,          // элемент лежит в корне раздела
        "IBLOCK_ID"      =&gt; 18,//указать свой
        "PROPERTY_VALUES"=&gt; $PROP,
        "NAME"           =&gt; "Элемент",
        "ACTIVE"         =&gt; "Y",            // активен
        "DETAIL_TEXT"   =&gt; $_REQUEST["mess"],
    );
    
    if($PRODUCT_ID = $el-&gt;Add($arLoadProductArray))
      echo $PRODUCT_ID;
    else
      echo "Error: ".$el-&gt;LAST_ERROR;
    

    }?>

    But for your task, you better use Highload-locks. https://dev.1c-bitrix.ru/learning/course/?COURSE_ID=43&CHAPTER_ID=05745


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2