Change the content of the block landing.block.updatenodes

We are still updating this page

Some data may be missing — we will fill it in shortly

Scope: landing

Who can execute the method: any user

The method landing.block.updatenodes changes the content of the block. It returns true or an error. This method is also used for updating the parameters of dynamic blocks, such as the product list, detailed product, and some others.

Parameters

Method

Description

Version

lid
unknown

Page identifier

block
unknown

Block identifier

data
unknown

Array of selectors and new values.
For example: data: {'.landing-block-node-text@1': 'new text!'}. The principle is the same - selector and its new value. If you are sure that the selector in the block is unique, you can omit the counter @1.
Also, data depends on the types of nodes being modified. For more details, see the example below; for descriptions of types, refer to a separate page.

Examples

BX24.callMethod(
            'landing.block.updatenodes',
            {
                lid: 311,
                block: 6058,
                data: {
                    '.landing-block-node-text': 'Text with html',
                    '.landing-block-node-img': {src: '/some/path/picture.png', alt: 'My picture'},
                    '.landing-block-node-link': {text: 'My link', href: 'https://bitrix24.com', target: '_blank'},
                    '.landing-block-node-icon': ['fa-telegram', 'fa-skype'],
                    '.landing-block-node-embed': {src: '//www.youtube.com/embed/q4d8g9Dn3ww?autoplay=1&controls=0&loop=1&mute=1&rel=0', source: 'https://www.youtube.com/watch?v=q4d8g9Dn3ww'},
                },
            },
            function(result)
            {
                if(result.error())
                {
                    console.error(result.error());
                }
                else
                {
                    console.info(result.data());
                }
            }
        );
        

How to Use Examples in Documentation

Editing parameters of dynamic blocks

There are several dynamic blocks whose parameters can be changed via REST. For example, the number of products on a page. This can be done as follows.

  1. Use the method landing.block.getmanifest to find out what parameters the block has. The method will return an array of the manifest, where we are interested in the key attrs and the parameters of the dynamic block component you are interested in. In this case, we are interested in bitrix:catalog.section.

    attrs:
            bitrix:catalog.section: Array(24)
            0: {name: "Section ID", style: false, original_type: "component", component_type: "STRING", attribute: "SECTION_ID", …}
            1: {name: "Unavailable products", style: false, original_type: "component", component_type: "LIST", attribute: "HIDE_NOT_AVAILABLE", …}
            2: {name: "Unavailable trade offers", style: false, original_type: "component", component_type: "LIST", attribute: "HIDE_NOT_AVAILABLE_OFFERS", …}
            3: {name: "Field by which we sort elements", style: false, original_type: "component", component_type: "LIST", attribute: "ELEMENT_SORT_FIELD", …}
            4: {name: "Order of sorting elements", style: false, original_type: "component", component_type: "LIST", attribute: "ELEMENT_SORT_ORDER", …}
            5: {name: "Currency to which prices will be converted", style: false, original_type: "component", component_type: "LIST", attribute: "CURRENCY_ID", …}
            6: {name: "Price type", style: false, original_type: "component", component_type: "LIST", attribute: "PRICE_CODE", …}
            ...
            
  2. Use the method landing.block.updatenodes to change the necessary parameters. Historically, dynamic parameters (attributes) are changed specifically through this method.

    BX24.callMethod(
                'landing.block.updatenodes',
                {
                    lid: 5597,
                    block: 44131,
                    data: {
                        'bitrix:catalog.section': {
                            attrs: {
                                'MESS_BTN_BUY': 'Add to my cart'
                            }
                        }
                    },
                    function(result)
                    {
                        if (result.error())
                        {
                            console.error(result.error());
                        }
                        else
                        {
                            console.info(result.data());
                        }
                    }
                }
            );