Posted: August 17, 2020 at 5:34 pm
|
hi, apologies for multiple posts. The MER table mini cart displays the name of the event but not the date. I am trying to stay away from adding the date to the event title because they are repeated daily. As you can purchase multiple events for different days is there a way to add the date to the line item, i can’t see the date in $line_item object in EE_Mini_Cart_Table_Line_Item_Display_Strategy class Any pointers will be appreciated. |
Hi Wayne, The problem with doing this on an event level, is single events can have multiple datetimes and then individual tickets within that event can have access to specific datetimes within that event so outputting an ‘Event Date’ is actually more related to the datetime and ticket than it is the event itself. Right now we don’t have a hook you can use the event name on the event row, but you can do so on the ticket row using |
|
|
This sound perfect Tony, Thanks is there a code snippet for the date? Also, will this then show it across all line items when displayed i.e the minicart and checkout etc? I’m assuming the event name is passed in the filter but nothing is happening for me – is this the correct approach? add_filter( 'FHEE__EE_Mini_Cart_Table_Line_Item_Display_Strategy___ticket_row__line_item_name', 'ee_mer_change_item_name' ); |
No, the filter only applies to the mini cart display strategy. Let’s get the mini cart working how you want first and I’ll show you how you can apply the same logic elsewhere.
Event name? No, that row alters the ticket row, so its the ticket name. It’s the correct approach but to confirm you are looking in the same location, this is what it should output with your code: https://monosnap.com/file/eHbvw3VXWuMrwVlKVXW26SvzxFyU7L If you take a look at that filter you’ll see it has this:
Which means it is passed the current line item name in All of the above is done using our model system so if you haven’t done so already take a look here: https://github.com/eventespresso/event-espresso-core/tree/master/docs/G–Model-System As it makes it really simple to pull the various object that you need. |
|
|
Hi Tony I was using something similar
if( $line_item->ticket() instanceof EE_Ticket && $line_item->OBJ_type() !== 'Promotion' ) { |
Where are you adding the code on the site?
Yeah that’s my snippet from here: https://gist.github.com/Pebblo/2b0433f851e18d6ddd6fb85eca78b440 That’ll work on the Single Page Checkout (SPCO for short) but not on the mini cart widget. |
|
|
Hi Tony – apologies for losing momentum on this – Had a few other things to sort and missed your last reply. All the snippets are in my functions.php, however it seems some filters are not working. So far, the mini cart shows the time (name of the ticket) which is good but no date (this could simply be the start date of the event). I have also used your snippet https://gist.github.com/Pebblo/2b0433f851e18d6ddd6fb85eca78b440 to add append the date to the line as per your visual here https://monosnap.com/file/skTMJ4JGjhdFoWinXX8Sd1YZ1jART1 but this does not seem to work either which i assume is because its a multi cart check out not single? you can see the site here if easier http://kickabout.adigitalengagement.co.uk/sessions/technical-centre-free-play-2/ or see attached images Am I correct in thinking that using the multiple events- i can choose multiple events on separate days? Also if a choose multiple events it only asks for 1 attendee info which in the case of this site (booking a 1 hour football slot by a parent) could have separate details. Is using multiple events the wrong choice for the situation and would be best to remove it? |
Remove the code from functions.php and place it in a custom functions plugin: https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/ The code above works as I’m using it on a test site so it could be a load order issue.
All of those locations have different filters from the mini cart widget and your throwing various snippets into the mix here. Work through one section and at a time and I’ll show you how to expand that to the others, otherwise, you’ll end up with either incorrect/duplicated code or simply running in circles fighting against your own snippets. So which section would you like to get working first? What code are you using right now to change the display strategy of the line items? If any. —
Correct, MER allows you to select various tickets from multiple events (or event just the same event, which you can do without MER) and checkout as a single group. You have multiple tickets within single events, if you only need registrants to select tickets from a single event at a time you could leave MER out of this but it depends what you are doing.
Thats based on your events settings and means you are only collecting the Primary Registrant details. So do you want to only collect a single set of details for the group but want to separate out the parent info and send the email to them? Keeping the registration in the ‘childs’ name?
It really depends on what you want to do. What’s the goal with your ticket setup? |
|
|
September 17, 2020 at 10:18 am Hi Tony again thanks for your great support. Should i be using “FHEE__EEW_Mini_Cart__widget__minicart_line_item_display_strategy” instead of “FHEE__EE_Mini_Cart_Table_Line_Item_Display_Strategy___ticket_row__line_item_name” as I have hard coded the widget in the single_espresso_events.php template using <?php the_widget(‘EEW_Mini_Cart’); ?> I am comfortable with the attendee settings and will grab all attendees to be COVID safe. Thanks again |
The code you posted above HERE works fine for my in a custom functions plugin, if it’s not working on your site there is something else going on than the code itself. This is using that code pretty much as is: https://monosnap.com/file/k6uwrPuLp1NlC2OOXKSgiMO8xP07oM I’ve altered it to add a space at the beginning but nothing else. The fact that you’ve mentioned my others snippets not working (which are know good with other users) suggests the code isn’t loading on your site. This is the exact code I’m using: https://gist.github.com/Pebblo/35b194a7f091dd6346b156f6aa5cd72b
Not unless you want to load your own display strategy class.
Hardcoding the widget shouldn’t make any difference, that’s just calling the widget itself, everything else is from within EE itself on an ajax call. |
|
|
September 21, 2020 at 10:02 am Hi Tony – I can’t find any reference to where the apply_filters for “FHEE__EE_Mini_Cart_Table_Line_Item_Display_Strategy___ticket_row__line_item_name” in any of the plugins in the core, MER, or table template. For some reason, it was not in …display_strategy.php file and hadn’t searched for it beforehand (sorry). I have re-uploaded a fresh EE4 MER and is working – so am now working on getting the start date. |
September 21, 2020 at 11:35 am
It’s in MER, specifically Line 147 here: https://github.com/eventespresso/ee4-mer/blob/master/EE_Mini_Cart_Table_Line_Item_Display_Strategy.php#L146-L150
The gist you linked to above shows you how to pull the datetime fro the ticket: https://gist.github.com/Pebblo/2b0433f851e18d6ddd6fb85eca78b440 Depends how you want to output the date what you use on the datetime object but that should get you going. |
|
|
Thanks again Tony – not sure why it wasn’t in my files – anyways sorted for the mini cart. I have also used ‘FHEE__EE_Event_Cart_Line_Item_Display_Strategy___ticket_row__name_and_desc’ to update the description to a similar format in the session cart, however, I cant find a similar filter for the check out section (3 steps) see https://freeimage.host/i/25J5sn. Is there another filter for this? Again thanks for your continued support. W |
Yes, for the above you’ll need this filter:
And possibly:
Take a look in |
|
The support post ‘ee4 mer add date to title in mini cart’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.