Не строит писать в чужих темах. Всегда создавайте свою и ссылкой указываете на похожую. Я перенес вопрос.
Вот тут обсуждался похожий вопрос
Делайте по аналогии - указывайте нужное поле. Вот описание функции и полей
weallere сказал(а)
По аналогии не получается, т.к. это уже получается не страница заказов, а Детали заказа.
- вы задали изначально вопрос не по теме,написав в чужой теме.
Напишите ниже подробно, где и что вы хотите вывести. В каком месте. Скриншоты приветствуются. Ваша постановка вопроса не ясна.
Автор дополнения появится сегодня поздно вечером - ответит.
откройте файл /wp-content/plugins/events-and-places/admin/index.php
перед строкой 485 $events = $evpl_places->get_places();
добавьте
$evpl_places->query['select'][] = 'orders.user_data';
и после 498 строки:
switch($key){
добавьте
case 'user_data': $content = 'Имя пользователя: '.get_the_author_meta('display_name', $value); break;
Хорошо, сделал как тут приведено. В результате получилось тоже самое.
И тут и там вы приводите пример, как вывести колонку "Пользователей", т.е. получается иx email.
А я прошу поля: Фамилия Имя Отчество.
откройте файл /wp-content/plugins/events-and-places/admin/index.php
перед строкой 485 $events = $evpl_places->get_places();
добавьте
$evpl_places->query['select'][] = 'orders.order_details';
и после 498 строки:
switch($key){
добавьте
case 'order_details': $userName = array(); foreach($order->order_details as $field){ if(in_array($field['title'], array('Фамилия', 'Имя', 'Отчество'))){ $userName[] = stripslashes_deep($field['value']); } } $content = implode(' ',$userName); break;
Разместил. Когда нажал на скачивание, появились вот такие ошибки:
Warning: Invalid argument supplied for foreach() in /wp-content/plugins/events-and-places/admin/index.php on line 504
foreach($order->order_details as $field){
Warning: Cannot modify header information - headers already sent by (output started at /wp-content/plugins/events-and-places/admin/index.php:504) in /wp-content/plugins/events-and-places/admin/index.php on line 597
header('Content-Description: File Transfer');
Warning: Cannot modify header information - headers already sent by (output started at /wp-content/plugins/events-and-places/admin/index.php:504) in /wp-content/plugins/events-and-places/admin/index.php on line 598
header('Content-Disposition: attachment; filename="'.$file_name.'"');
Warning: Cannot modify header information - headers already sent by (output started at /wp-content/plugins/events-and-places/admin/index.php:504) in /wp-content/plugins/events-and-places/admin/index.php on line 599
header('Content-Type: text/xml; charset=utf-8');
389 12345@yandex.ru 2018-04-27 12:57:09 2 0001 Семинар «Название» Ряд 2 Места: 3, 2 2018-04-27 18:30:00 a:4:{i:0;a:3:{s:4:"type";s:4:"text";s:5:"title";s:14:"Фамилия";s:5:"value";s:14:"Шадрина";}i:1;a:3:{s:4:"type";s:4:"text";s:5:"title";s:6:"Имя";s:5:"value";s:14:"Валерия";}i:2;a:3:{s:4:"type";s:4:"text";s:5:"title";s:16:"Отчество";s:5:"value";s:18:"Андреевна";}i:3;a:3:{s:4:"type";s:3:"tel";s:5:"title";s:14:"Телефон";s:5:"value";s:11:"89320000000";}}
замените вторую часть предложенного кода на это
case 'order_details': $userName = array(); foreach(maybe_unserialize($value) as $field){ if(in_array($field['title'], array('Фамилия', 'Имя', 'Отчество'))){ $userName[] = stripslashes_deep($field['value']); } } $content = implode(' ',$userName); break;
Сейчас файл скачался, ФИО вывелось.
Только после ФИО в этой же ячейке ещё куча информации:
Шадрина Валерия Андреевнаa:4:{i:0;a:3:{s:4:"type";s:4:"text";s:5:"title";s:14:"Фамилия";s:5:"value";s:14:"Шадрина";}i:1;a:3:{s:4:"type";s:4:"text";s:5:"title";s:6:"Имя";s:5:"value";s:14:"Валерия";}i:2;a:3:{s:4:"type";s:4:"text";s:5:"title";s:16:"Отчество";s:5:"value";s:18:"Андреевна";}i:3;a:3:{s:4:"type";s:3:"tel";s:5:"title";s:14:"Телефон";s:5:"value";s:11:"89320000000";}}
Сейчас отлично! Вывелись только ФИО! )))
Ещё только одна вещь, ФИО выводится в колонке EventTime и получается на один заказ 2 строки. В одной в EventTime стоит время события, а в другой ФИО.
Почему так непонятно.
Вот первая часть:
$evpl_places->query['select'] = array(); $evpl_places->query['select'][] = 'places.order_id'; $evpl_places->query['select'][] = 'orders.user_data'; $evpl_places->query['select'][] = 'orders.order_date'; $evpl_places->query['select'][] = 'orders.place_amount'; $evpl_places->query['select'][] = 'orders.order_price'; $evpl_places->query['select'][] = 'places.event_id'; $evpl_places->query['select'][] = 'places.event_places'; $evpl_places->query['select'][] = 'DATE(places.event_date) as eventdate'; $evpl_places->query['select'][] = 'TIME(places.event_date) as eventtime'; $evpl_places->query['select'][] = 'orders.order_details'; $events = $evpl_places->get_places();
Вот вторая часть:
switch($key){ case 'order_details': $userName = array(); foreach(maybe_unserialize($value) as $field){ if(in_array($field['title'], array('Фамилия', 'Имя', 'Отчество'))){ $userName[] = stripslashes_deep($field['value']); } } $content = implode(' ',$userName); break; case 'order_id': $name = 'ID-Order'; break; case 'user_data': $name = 'user_data'; $content = ''.get_the_author_meta('display_name', $value); break; case 'order_date': $name = 'OrderDate'; break; case 'event_id': $name = 'Event'; $value = get_the_title($value); break; case 'eventdate': $name = 'EventDate'; break; case 'eventtime': $name = 'EventTime'; break; case 'event_places': $name = 'Places'; break; case 'place_amount': $name = 'Place-Amount'; break; case 'order_price': $name = 'Order-Price'; break; default: $name = $key;