My developer left me out to dry and while im able to learn pretty quickly, actually adding code to excisiting piece of code is a struggle while reading the code makes sort of sense. My business got hit by corona and this piece of code is part of my core business. I have to solve this and sadly on my own account as im willing to pay if i had the recources.
I guess this is a very basic question for all but beginners but i'd love to understand it. Been spending alot of time just reading the code and now its time for help.
This piece of code
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) {
// Group name
$formater->custom_header($group);
// Table header
$formater->table_header();
Displays the group that the user is in on a PDF. Now i know that the foreach part defines the formatter part. the part in particulair is the
// Group name
$formater->custom_header($group);
Now in the same file i need to display that same group name in the following sequence
case 'Delivery note':
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) {
// Delivery header
$formater->delivery_header();
// Client name
$formater->custom_header($data['order']
->get_formatted_shipping_full_name(), 5);
// Client address
$address = join( ", ", array_filter( array(
$data['order']->get_shipping_address_1(),
$data['order']->get_shipping_address_2(),
$data['order']->get_shipping_city(),
$data['order']->get_shipping_postcode() )
)
);
$formater->custom_header($address, 10);
// Group name
$formater->custom_header($group);
// Table header
$formater->table_header();
Now ive already put the
// Group name
$formater->custom_header($group);
part in there but i am unable to define it in the upper part.
Is someone willing to show me how i can get this to work and possibly explain it since i really like understanding it aswelll.
Edit: https://imgur.com/a/wKPDaM7
The "Registerd" part is what the
// Group name
$formater->custom_header($group); prints.
In the 2nd image, the blue line, thats where i want that to appear aswell.
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Find the answer in similar questions on our website.
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.
PHP (from the English Hypertext Preprocessor - hypertext preprocessor) is a scripting programming language for developing web applications. Supported by most hosting providers, it is one of the most popular tools for creating dynamic websites.
The PHP scripting language has gained wide popularity due to its processing speed, simplicity, cross-platform, functionality and distribution of source codes under its own license.
https://www.php.net/
Welcome to the Q&A site for web developers. Here you can ask a question about the problem you are facing and get answers from other experts. We have created a user-friendly interface so that you can quickly and free of charge ask a question about a web programming problem. We also invite other experts to join our community and help other members who ask questions. In addition, you can use our search for questions with a solution.
Ask about the real problem you are facing. Describe in detail what you are doing and what you want to achieve.
Our goal is to create a strong community in which everyone will support each other. If you find a question and know the answer to it, help others with your knowledge.