K
K
Kirill Gorelov2020-09-23 12:49:39
1C-Bitrix
Kirill Gorelov, 2020-09-23 12:49:39

Bitrix ordering, specify full name?

How to specify the name and phone number in the order?
And none of them work.
And I also tried this
. The customer's full name is not displayed when placing an order, what's the problem?
What I have tried:

once

$order->doFinalAction(true);
$propertyCollection = $order->getPropertyCollection();
$phoneProp = $propertyCollection->getPhone();
$phoneProp->setValue($phone);
$nameProp = $propertyCollection->getPayerName();
$nameProp->setValue('dfghj');


2

$propertyCollection = $order->getPropertyCollection();
// телефон
$phoneProp = $propertyCollection->getPhone();
$phoneProp->setValue($phone);
// имя
$nameProp = $propertyCollection->getPayerName();
$nameProp->setValue('Кирилл');


3


$propertyCollection = $order->getPropertyCollection();

function getPropertyByCode($propertyCollection, $code) {
foreach ($propertyCollection as $property)
{
if($property->getField('CODE') == $code)
return $property;
}
}

$emailProperty = getPropertyByCode($propertyCollection, 'EMAIL');
$emailProperty->setValue($email);

$phoneProperty = getPropertyByCode($propertyCollection, 'PHONE');
$phoneProperty->setValue('+79851234567');

$fioProperty = getPropertyByCode($propertyCollection, 'FIO');
$fioProperty->setValue('bvz');

$ADDRESS = getPropertyByCode($propertyCollection, 'ADDRESS');
$ADDRESS->setValue($addr);


4

$propertyCollection = $order->getPropertyCollection();

$propertyCodeToId = array();

foreach($propertyCollection as $propertyValue)
$propertyCodeToId[$propertyValue->getField('CODE')] = $propertyValue->getField('ORDER_PROPS_ID');


$propertyValue=$propertyCollection->getItemByOrderPropertyId($propertyCodeToId['FIO']);
$propertyValue->setValue('Мои имя');

$propertyValue=$propertyCollection->getItemByOrderPropertyId($propertyCodeToId['PHONE']);
$propertyValue->setValue($phone);

$propertyValue=$propertyCollection->getItemByOrderPropertyId($propertyCodeToId['EMAIL']);
$propertyValue->setValue($email);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
ggrachdev, 2020-09-23
@ggrachdev

Look at the character code of the order property - full name
Receive an order or create a new one, specify the required properties and save it.
Here is a good article:
https://mrcappuccino.ru/blog/post/work-with-order-...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question