K
K
kabashowlab2015-08-01 20:48:23
PHP
kabashowlab, 2015-08-01 20:48:23

Bitrix order letter. I installed a handler, numerical values ​​work, text ones do not. How it Do?

Good day.
I installed a mail event handler on Bitrix.
In general, I added new fields to the mail template, it was necessary to add the ability to specify the street, house number, phone number, and more.
Everything works except the text field. Not numerical. The numbers are coming.
Everything is great. And here is the address.
In the code, all lines [VALUE] are, respectively, a number.
And what needs to be put in the code with street to take a text value? Tried
[TEXT] [STRING]
Or is it also the arfields handler?
Please tell me, here is the php.init code

<?
//-- Adding an event handler
AddEventHandler("sale", "OnOrderNewSendEmail", "bxModifySaleMails");
//-- The actual event handler
function bxModifySaleMails($orderID, &$eventName, &$arFields)
{
$arOrder = CSaleOrder::GetByID($orderID);
//-- get phones and addresses
$order_props = CSaleOrderPropsValue::GetOrderProps($orderID);
$phone="";
$persona="";
$index = "";
$street="";
$number="";
$kv="";
$etaz="";
$domofon="";
$country_name = "";
$city_name = "";
$address = "";
while ($arProps = $order_props->Fetch())
{
if ($arProps["CODE"] == "PHONE")
{
$phone = htmlspecialchars($arProps["VALUE"]);
}
if ($arProps["CODE"] == "LOCATION")
{
$arLocs = CSaleLocation::GetByID($arProps["VALUE"]);
$country_name = $arLocs["COUNTRY_NAME_ORIG"];
$city_name = $arLocs["CITY_NAME_ORIG"];
}
if ($arProps["CODE"] == "INDEX")
{
$index = $arProps["VALUE"];
}
if ($arProps["CODE"] == "ADDRESS")
{
$address = $arProps["VALUE"];
$persona = htmlspecialchars($arProps["VALUE"]);
}
if ($arProps["CODE"] == "nomer")
{
$nomer = htmlspecialchars($arProps["VALUE"]);
}
if ($arProps["CODE"] == "kv")
{
$kv = htmlspecialchars($arProps["VALUE"]);
}
if ($arProps["CODE"] == "street")
{
$street = htmlspecialchars($arProps["STRING"]);
}
if ($arProps["CODE"] == "etaz")
{
$etaz = htmlspecialchars($arProps["VALUE"]);
}
if ($arProps["CODE"] == "domofon"
) {
$domofon = htmlspecialchars($arProps["VALUE"]);
}
}
$full_address = $index.", ".$country_name."-".$city_name.", ".$address;
//-- get the name of the delivery service
$arDeliv = CSaleDelivery::GetByID($arOrder["DELIVERY_ID"]);
$delivery_name = "";
if ($arDeliv)
{
$delivery_name = $arDeliv["NAME"];
}
//-- get the name of the payment system
$arPaySystem = CSalePaySystem::GetByID($arOrder["PAY_SYSTEM_ID"]);
$pay_system_name = "";
if ($arPaySystem)
{
$pay_system_name = $arPaySystem["NAME"];
}
//-- add new fields to the results array
$arFields["ORDER_DESCRIPTION" ] = $arOrder["USER_DESCRIPTION"];
$arFields["PHONE"] = $phone;
$arFields["persona"] = $persona;
$arFields["DELIVERY_NAME"] = $delivery_name;
$arFields["PAY_SYSTEM_NAME"] = $pay_system_name;
$arFields["FULL_ADDRESS"] = $full_address;
$arFields["number"] = $number;
$arFields["kv"] = $kv;
$arFields["etaz"] = $etaz;
$arFields["domofon"] = $domofon;
$arFields["street"] = $street;
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
kabashowlab, 2015-08-01
@kabashowlab

Solved the problem in general:
if ($arProps["CODE"] == "street")
{
$kv = htmlspecialchars($arProps["STRING"]);
instead inserted
if ($arProps["CODE"] == "street")
{
$street = $arProps["VALUE"];

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question