Jeff

Forum Replies Created

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • Jeff
    Participant

    You should broadcast that one or do a quick update – because I was having the same problem, and the code fixed it immediately. Fingers crossed it doesn’t turn up again.

    in reply to: View Attendees List On-Line (new or adapted code) #941543
    Jeff
    Participant

    Yep, all working well now. This really helped get me over a hump in my array skills.

    I don’t know why the above code pastes came out with raw html characters, so I hesitate to paste the larger snippet that now gets sales data from the array variables instead of from tribe_get_cost(). I’m not sure that this thread is appropriate for sharing further results and the next level of development of this add-on (amounting to a Booking/Reservation application), but if anyone over there wants to see the results, you should now be able to contact me via Github or via Jeff, whose account I’ve been using for this very useful conversation.

    Grazie/Thanks again!

    -CK

    in reply to: View Attendees List On-Line (new or adapted code) #941483
    Jeff
    Participant

    aargh

    in reply to: View Attendees List On-Line (new or adapted code) #941482
    Jeff
    Participant

    shoot – don’t know why my paste this time got screwed up, try again:

    <?php
    //code from attendees.php, 
    //additional code (for extracting ticket data) from 
    //Gustavo Bordoni https://gist.github.com/bordoni/6e4543c562fe0182dbd6
    
    $event = get_post( $event_id );
    $tickets = TribeEventsTickets::get_event_tickets( $event_id );
    $count = 0;
    	foreach ($customerList as $orderID => $totalAttendees) {
    		$count = $count + 1;
    		$order = new WC_Order($orderID);
    		$orderTickets = $order->get_items();
    ?>
    	<tr class="attendees" >
    		<td class="att_tblcol_first" ><?php echo $count ; ?>.</td>
    		<td class="att_participant" ><?php echo "{$order->billing_first_name} {$order->billing_last_name}" ?><br/><small><?php echo $order->billing_company; ?></small></br></td>
    		<td class="att_signature" > </td>
    	<!--here is where we HAVE figured out how to get ticket data -->
    		<td class="att_ticket-type">
    	<?php
    		foreach ( $orderTickets as $key => $orderTicket ) {
    		echo '<p>' . $orderTicket['name'] . '(' . $orderTicket['item_meta']['_qty']['0'] . ')</p>';
    		} 
    	?>
    </td>
    <!-- the following works, but cost tells me what the ticket actually cost -
    might be better to choose from all available variables...
    -->
    <td class="att_ticket-price" align="center"><?php echo tribe_get_cost( null, true ) ?>*</td>
    <td class="att_paid tblcol_last" > </td>
    </tr>
    <?php	
    	} ?>
    in reply to: View Attendees List On-Line (new or adapted code) #941481
    Jeff
    Participant

    ah, simple: it’s _qty, not qty:

    
    <?php
    //code from attendees.php, 
    //additional code (for extracting ticket data) from Gustavo Bordoni https://gist.github.com/bordoni/6e4543c562fe0182dbd6
    
    $event = get_post( $event_id );
    $tickets = TribeEventsTickets::get_event_tickets( $event_id );
    $count = 0;
    	foreach ($customerList as $orderID => $totalAttendees) {
    		$count = $count + 1;
    		$order = new WC_Order($orderID);
    		$orderTickets = $order->get_items();
    ?>
    	<tr class="attendees" >
    		<td class="att_tblcol_first" ><?php echo $count ; ?>.</td>
    		<td class="att_participant" ><?php echo "{$order->billing_first_name} {$order->billing_last_name}" ?><br/><small><?php echo $order->billing_company; ?></small></br></td>
    		<td class="att_signature" > </td>
    	<!--here is where we HAVE figured out how to get ticket data -->
    		<td class="att_ticket-type">
    	<?php
    		foreach ( $orderTickets as $key => $orderTicket ) {
    		echo '<p>' . $orderTicket['name'] . '(' . $orderTicket['item_meta']['_qty']['0'] . ')</p>';
    		} 
    	?>
    </td>
    <!-- the following works, but cost tells me what the ticket actually cost -
    will next use above model to extract actual ticket prices...
    -->
    <td class="att_ticket-price" align="center"><?php echo tribe_get_cost( null, true ) ?>*</td>
    <td class="att_paid tblcol_last" > </td>
    </tr>
    <?php	
    	}

    Note: Code as written already will provide separate entries, in separate lines, for different ticket types in table cell reserved for given order. Excellent!

    in reply to: View Attendees List On-Line (new or adapted code) #941467
    Jeff
    Participant

    First variable – yes – success! I count that as huge progress and really the entirety of my original request. Second one, still a blank, but we’re very close, and the solution will provide the model for getting the sub-array values. Will look at it and try to figure it out, but please don’t hesitate to provide the solution if it occurs to you.

    -CK

    in reply to: View Attendees List On-Line (new or adapted code) #941462
    Jeff
    Participant

    Sorry for over-commenting, just for the record, the one I’m primarily interested in here is Non-Member. I also wanted (going back to a prior note) line_total and subtotal values.

    (I also see a potential complication that I won’t want to think about too hard at the moment, but may have to, since the original attendee list function produces lists of attendees by order, rather than by individual ticket. In a real list of attendees, like a booking/reservation system, tickets or spots would be broken down into constituent parts, especially when the same order had two different ticket types.)

    -CK

    in reply to: View Attendees List On-Line (new or adapted code) #941460
    Jeff
    Participant

    eh, shouldn’t have formatted that array as code – feel free to edit it if you have privileges. Here it is again for reference if not:

    Array ( [0] => Array ( [name] => Non-Member [type] => line_item [item_meta] => Array ( [_qty] => Array ( [0] => 1 ) [_tax_class] => Array ( [0] => ) [_product_id] => Array ( [0] => 316 ) [_variation_id] => Array ( [0] => 0 ) [_line_subtotal] => Array ( [0] => 7 ) [_line_total] => Array ( [0] => 7 ) [_line_subtotal_tax] => Array ( [0] => 0 ) [_line_tax] => Array ( [0] => 0 ) [_line_tax_data] => Array ( [0] => a:2:{s:5:”total”;a:0:{}s:8:”subtotal”;a:0:{}} ) ) [qty] => 1 [tax_class] => [product_id] => 316 [variation_id] => 0 [line_subtotal] => 7 [line_total] => 7 [line_subtotal_tax] => 0 [line_tax] => 0 [line_tax_data] => a:2:{s:5:”total”;a:0:{}s:8:”subtotal”;a:0:{}} ) )

    in reply to: View Attendees List On-Line (new or adapted code) #941459
    Jeff
    Participant

    Thanks, Gustavo – you ALMOST made my day and week with that… unfortunately, however, the it’s not echoing anything in at the key point, or perhaps at the “$key” point. In short, $orderTicket->name and $orderTicket->qty are drawing blanks.

    I think it’s almost there – when I print – print_r(array_values($orderTickets)) – $orderTickets’ values, I get differential outputs at each point, with a simple example here:

    Array ( [0] => Array ( [name] => Non-Member [type] => line_item [item_meta] => Array ( [_qty] => Array ( [0] => 1 ) [_tax_class] => Array ( [0] => ) [_product_id] => Array ( [0] => 316 ) [_variation_id] => Array ( [0] => 0 ) [_line_subtotal] => Array ( [0] => 7 ) [_line_total] => Array ( [0] => 7 ) [_line_subtotal_tax] => Array ( [0] => 0 ) [_line_tax] => Array ( [0] => 0 ) [_line_tax_data] => Array ( [0] => a:2:{s:5:"total";a:0:{}s:8:"subtotal";a:0:{}} ) ) [qty] => 1 [tax_class] => [product_id] => 316 [variation_id] => 0 [line_subtotal] => 7 [line_total] => 7 [line_subtotal_tax] => 0 [line_tax] => 0 [line_tax_data] => a:2:{s:5:"total";a:0:{}s:8:"subtotal";a:0:{}} ) )

    Ideally, I’d like to be able to access any one of those items (and sub-items).

    I think I can <i>probably</i> figure it out, but I have a feeling you may know off the top of your head why your suggestion didn’t work the first time (when do they ever?). If you would prefer, I can put further discussion on Github, but I suspect that a lot of would-be customizers scanning this forum would find instructions on getting those named values out of this $orderTickets array useful.

    in reply to: View Attendees List On-Line (new or adapted code) #940752
    Jeff
    Participant

    oops – forgot again to sign the above CK MacLeod

    in reply to: View Attendees List On-Line (new or adapted code) #940751
    Jeff
    Participant

    Sorry if I was being excessively polite, and thus confused you, Gustavo. Any help you can give me will be greatly appreciated.

    In short, all I need is the code that would be inserted in the spot indicated in the snippet below by [ticket name]. I hope it doesn’t confuse you, but the snipped includes the "$tickets = TribeEventsTickets::get_event_tickets( $event_id ); piece that I think might have the info I need to extract (used in attendees.php – see below):

    
    <?php
    //code from attendees.php, still trying to figure out how to extract $ticket->name outside of the foreach ticket
    $event = get_post( $event_id );
    $tickets = TribeEventsTickets::get_event_tickets( $event_id );
    $count = 0; 
    
            foreach ($customerList as $orderID => $totalAttendees) {
    	    $count = $count + 1;
                $order = new WC_Order($orderID);
    
    	   ?>
    	   <tr class="attendees"  >
    		<td class="att_tblcol_first" ><?php echo $count ; ?>.</td>
    		<td class="att_participant" width="30%"><?php echo "{$order->billing_first_name} {$order->billing_last_name}" ?><br/><small><?php echo $order->billing_company; ?></small></br></td>
    		<td class="att_signature" > </td>
    		<!--here is where I still haven't figured out what I can use: -->
    		<td class="att_ticket-type" >[ticket name]</td>	
    		<!-- the following works, but cost tells me what the ticket actually cost - 
                    might be better to choose from all available variables...
    		-->
    		<td class="att_ticket-price" align="center"><?php echo tribe_get_cost( null, true ) ?>*</td>
    		<td class="att_paid tblcol_last" > </td>
            </tr>	
    		
    	<?php	
    	}

    Attendees.php uses

    $event = get_post( $event_id );
    $tickets = TribeEventsTickets::get_event_tickets( $event_id );

    then extracts the “ticket type” like so in a foreach for its own list:

    foreach ( $tickets as $ticket ) : ?>
    <strong><?php echo esc_html( $ticket->name ) ?>: </strong>

    But my list is already iterating through a list of customers, getting, for example, the last names, one after the other, such as $order->billing_last_name as in the example above.

    So I think I just need to fill a slot with $ticket->name (and potentially other slots with other information), but I’m not sure how to get it in this context from $tickets.

    I’m confident if you provided the syntax, I could complete this sub-sub-sub-application/add-on, and maybe develop it in a form that other Wooticket users could apply.

    (The next thing we’re working on is group ordering.)

    in reply to: View Attendees List On-Line (new or adapted code) #940415
    Jeff
    Participant

    Thanks, Gustavo.

    I have modified single-events.php for our site so that

    1. Attendee List shows at bottom of event page only to logged users who are “editor”-level and above.

    2. Includes print/view button that opens new window with attendees list.

    3. Can be printed from there – it’s also possible, of course, to add a print button or pop-up, or even to initiate a printing sub-routine on open.

    4. At present, however, I have only preliminary values for Ticket Type and Ticket Price.

    My initial experiments with the methods you recommended achieved small success. I was on a deadline, so didn’t have enough time to research and experiment further. I was able to get the price or one price, but am up against a simple coding question here in relation to transferring a snippet from attendees.php to my new context, in order to get what’s in other locations called the “ticket type.”

    Is this the kind of question you are able to answer here, or do I need to start all over again explaining the whole thing in some other forum? I could try StackExchange, I guess, but it really is focused on a very specific task within your product. At that point, the big feature request will mostly be done, and maybe you’ll have a framework you can adapt for further development.

    –CK MacLeod

    in reply to: View Attendees List On-Line (new or adapted code) #940171
    Jeff
    Participant

    (again, you can call me CK – I’m working with Jeff)

    in reply to: View Attendees List On-Line (new or adapted code) #940170
    Jeff
    Participant

    Thanks – although somebody could have said you had nothing to offer a couple of days ago when I first posed the question.

    In actuality, it’s not THAT big a project. In fact, I’m very close to having the full-fledged piece done. The only thing I’m missing, and wasting precious time searching for, is the code for pulling 1) ticket description or title, the same product title used by the Woo Cart, for example, or by tickets.php as $ticket->name, and 2) the price that tickets.php echoes from get_price_html($product), and outputting it to the table on the same single-event.php page with the associated attendees gotten in the code above.

    The ticket name is already used in the email, I just don’t know how to get the two values from WC_Order like “billing_last_name” in the code above, or from $attendeeData, or whether I have to get them from somewhere else.

    Any help on this one problem would be greatly appreciated, the sooner the better!

    in reply to: View Attendees List On-Line (new or adapted code) #939600
    Jeff
    Participant

    (Note: questions by CKM writing for Jeff M)

Viewing 15 posts - 1 through 15 (of 16 total)