P
P
pavelmosin2021-07-23 13:53:17
1C-Bitrix
pavelmosin, 2021-07-23 13:53:17

How to add an html string with a link to the order property?

function AddOrderProperty($prop_id, $value, $order)
    {
        if (!strlen($prop_id)) {
            return false;
        }
        if (CModule::IncludeModule('sale')) {
            if ($arOrderProps = CSaleOrderProps::GetByID($prop_id)) {
                $db_vals = CSaleOrderPropsValue::GetList(array(),
                    array('ORDER_ID' => $order, 'ORDER_PROPS_ID' => $arOrderProps['ID']));
                if ($arVals = $db_vals->Fetch()) {
                    return CSaleOrderPropsValue::Update($arVals['ID'], array(
                        'NAME'           => $arVals['NAME'],
                        'CODE'           => $arVals['CODE'],
                        'ORDER_PROPS_ID' => $arVals['ORDER_PROPS_ID'],
                        'ORDER_ID'       => $arVals['ORDER_ID'],
                        'VALUE'          => $value,
                    ));
                } else {
                    return CSaleOrderPropsValue::Add(array(
                        'NAME'           => $arOrderProps['NAME'],
                        'CODE'           => $arOrderProps['CODE'],
                        'ORDER_PROPS_ID' => $arOrderProps['ID'],
                        'ORDER_ID'       => $order,
                        'VALUE'          => $value,
                    ));
                }
            }
        }
    }


$val = '<a href="/test/">TEST</a>';
AddOrderProperty( 1, $val, 4584 );

In the order property, the html tag is displayed through special characters

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Edward, 2021-07-24
@Drayde

Use a key like $property["~VALUE" ] when displaying the value

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question