A
A
Airslip2017-02-22 11:18:47
1C-Bitrix
Airslip, 2017-02-22 11:18:47

How to remove mandatory fields when registering using bitrix:sale.order.ajax?

I ask for help, the 3rd day I'm trying to figure out the problem. For the first time I came across the bitrix:sale.order.ajax component, and as far as I understand, it has some kind of user authorization before placing an order. So, initially there were three fields in the registration form: first name, last name, email, which are required. I need to remove the last name and email. In the component template, I removed these inputs,
but this did not solve my problem, since when trying to register, the component tries to validate non-existent fields and does not let it go further.
Question: where are the fields for registration in this component set?
I am attaching the component call code:

<?$APPLICATION->IncludeComponent(
  "bitrix:sale.order.ajax", 
  "new_order", 
  array(
    "ALLOW_AUTO_REGISTER" => "N",
    "ALLOW_NEW_PROFILE" => "Y",
    "COMPOSITE_FRAME_MODE" => "A",
    "COMPOSITE_FRAME_TYPE" => "AUTO",
    "COUNT_DELIVERY_TAX" => "N",
    "DELIVERY_NO_AJAX" => "Y",
    "DELIVERY_NO_SESSION" => "Y",
    "DELIVERY_TO_PAYSYSTEM" => "d2p",
    "DISABLE_BASKET_REDIRECT" => "N",
    "ONLY_FULL_PAY_FROM_ACCOUNT" => "N",
    "PATH_TO_AUTH" => "/auth/",
    "PATH_TO_BASKET" => "/personal/basket/",
    "PATH_TO_PAYMENT" => "payment.php",
    "PATH_TO_PERSONAL" => "/personal/",
    "PAY_FROM_ACCOUNT" => "Y",
    "PRODUCT_COLUMNS" => "",
    "PROP_1" => "",
    "PROP_2" => "",
    "SEND_NEW_USER_NOTIFY" => "Y",
    "SET_TITLE" => "Y",
    "SHOW_PAYMENT_SERVICES_NAMES" => "Y",
    "SHOW_STORES_IMAGES" => "N",
    "TEMPLATE_LOCATION" => "popup",
    "USE_PREPAYMENT" => "N",
    "COMPONENT_TEMPLATE" => "new_order",
    "COMPATIBLE_MODE" => "Y",
    "USE_PRELOAD" => "Y",
    "PRODUCT_COLUMNS_VISIBLE" => array(
      0 => "PREVIEW_PICTURE",
      1 => "PROPS",
    ),
    "ADDITIONAL_PICT_PROP_26" => "-",
    "BASKET_IMAGES_SCALING" => "standard"
  ),
  false
);?>

Digging into the component, I found a file at "/bitrix/components/bitrix/sale.order.ajax/class.php", which contains about 5000 lines and commented out all the lines where I met the words email and last_name. After that, the component stopped asking me for an email, but still required a surname. But something tells me that this is the wrong decision.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Andrey, 2017-02-22
@flx12

in the admin panel: shop - order properties
find the properties you need and uncheck "required"

A
Airslip, 2017-02-22
@Airslip

I suspected that somewhere there, but alas, for some reason, it is the surname field that has a symbolic code not the same as in the component and template (instead of LAST_NAME - FIO). Yes, and the checkbox "Required" at FIO does not want to be removed.
ca7388beda17.jpg

A
alljefferson, 2021-08-23
@alljefferson

Maybe someone will come in handy
1) Transfer (if not transferred) the sale.order.ajax component to the /local/components/bitrix/ folder from /bitrix/components/bitrix/.
2) In the /local/components/bitrix/sale.order.ajax/class.php file, comment out the lines (in the doRegister function):

if (strlen($request['NEW_LAST_NAME']) <= 0)
{
  $this->addError(Loc::getMessage('STOF_ERROR_REG_LASTNAME'), self::AUTH_BLOCK);
}

3) In the template file of the sale.order.ajax component in the order_ajax.js file, comment out the lines (in the editRegistrationForm function):
authFormNodes.push(this.createAuthFormInputContainer(
  BX.message('STOF_LASTNAME'),
  BX.create('INPUT', {
    attrs: {'data-next': 'NEW_EMAIL'},
    props: {
      name: 'NEW_LAST_NAME',
      type: 'text',
      size: 40,
      value: this.result.AUTH.NEW_LAST_NAME || ''
    },
    events: {keypress: BX.proxy(this.checkKeyPress, this)}
  }),
  true
));

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question