'Function keeps sending a blank row
Im trying to make this part.
$groups_user = new Groups_User( $user_id );
$orders_group[$groups_user->groups[0]->group->name][] = $order_id;
Part of the larger
case 'Summary list':
foreach ( $order_ids as $order_id ) {
$user_id = get_post_meta($order_id, '_customer_user', true);
$groups_user = new Groups_User( $user_id );
$orders_group[$groups_user->groups[0]->group->name][$user_id][] = $order_id;
}
$i = 1;
foreach ($orders_group as $group => $users) {
Work with this part
foreach ( $order_ids as $order_id ) {
$order = wc_get_order( $order_id );
$user_id = $order->get_user_id();
if(array_key_exists($order->get_user_id(), $orders_group)) {
$orders_group[$user_id]['order_ids'][] = $order_id;
} else {
$orders_group[$user_id]['order'] = $order;
$orders_group[$user_id]['order_ids'][] = $order_id;
}
}
$og_count = count($orders_group);
$og_i = 1;
foreach ($orders_group as $user_id => $data) {
To my understanding is that the first part $order_id conflicts with the last part $order_id because they are used to define different things. However
$groups_user = new Groups_User( $user_id );
$orders_group[$groups_user->groups[0]->group->name][] = $order_id;
$groups_user pulls the data i need to display i just cant get it to work with the lower part. It keeps sending out a blank row
How can i make that one part work with the other to display what i need? Thank you in advance.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
