Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

формат даты в доп полях


Recommended Posts

всем привет

создал доп. поле дата и время

в заказе отображается вот в таком формате 

2023-02-16T18:47

 

Подскажите пожалуйста как изменить этот формат к примеру 

T 18:47  D 16-02-2023

 

Спасибо

Link to comment
Share on other sites


В 18.03.2023 в 16:09, drOC сказав:

Спробуйте

 

date('FORMAT', strtotime($time))

 

де $time - ваші дані в БД

 

і FORMAT за шаблоном

https://www.php.net/manual/en/datetime.format.php

в каком файле???

дата выводиться как в админке в информации заказа так и в письме, в одном формате.

я так понял это в файлах отвечающие за доп.   поля пользователей, но где именно это я не нашёл ((

да и в базу данных ити данные записываются в таблице order, поле 

payment_custom_field в формате json 

{"2":"2023-03-20T12:30"}

Link to comment
Share on other sites


пробовал менять тут oct_ultrastore/template/partial/  файл d_custom_field.twig
но он отвечает за отображение на сайте на сайте и в письме не меняется дата 

Менял с YYYY-MM-DD на DD-MM-YYYY

менял в файлах catalog/view/javascript/jquery/datetimepicker/moment/moment.min.js
но всё равно не помогает 

Link to comment
Share on other sites


всем спасибо за внимание, нашёл решение
 

в файле формирования запроса в базу catalog\model\checkout\order.php

изменил с 

json_encode($data['shipping_custom_field'])

на 

json_encode(array('2' => date('d-m-Y', strtotime($data['shipping_custom_field']['2']))))

 

работает

я не силён в php  поэтому не в курсе правильное ли решение

 

 

 

 

Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.