Posted: June 26, 2014 at 2:22 am
|
Hi there, We’re having issues with the unique Reg-ID assigned to purchased tickets through Worldpay on EE3. We need to be able to customise these IDs to include the show name for the tickets purchased for accounting purposes. eg. instead of 5-53aa94b900dd9 it would be Ascot-5-53aa94b900dd9 How can I go about doing this? Thanks |
|
Actually sorry – it’s the Transaction ID or Cart ID for Worldpay that I need to change, not necessarily the Reg-ID that shows in the EE3 system. Any idea how I would change these as they must be linked somehow. Thanks |
|
Hi, You could amend the Cart ID to include it. In gateways/worldway/worldpay_vars.php, on line 22 is this: $myworldpay->addField('cartId', 'wp-' . event_espresso_session_id()); amend it to something like this $myworldpay->addField('cartId', 'wp-' . $payment_data['event_name'] . '-' . event_espresso_session_id()); Please note that updates to the plugin will over write these changes. |
|
Thanks. I tried this last week but it’s not working – my CartID on Worldpay is still something like ‘wp-ltfdekf3vk9ni4861i5bk4ouf7-53aa92eb8f9ec6.79929151’ with no mention of the show. Any idea why? Thanks |
|
Hi, The code definitely changes the Cart ID (screenshot http://take.ms/ZWEJ0), though I am unable to test whether this is correctly passed to WorldPay currently (having some issues with their test server). |
|
Thanks. I’ve checked the code and my one is still showing without the event name, despite adding the line of php above: <input type=”hidden” name=”cartId” value=”wp–o2h4o0dh7aah2ov6086kr2nhb1-53b17c40582db5.73546316″/> Have I done something wrong here? I went to add it in wp-content>plugins>event-espresso>gateways>worldpay>worldpay_vars.php Thanks |
You might try the following instead: $myworldpay->addField('cartId', 'wp-' . sanitize_title_with_dashes( $payment_data['event_name'] ) . '-' . event_espresso_session_id()); The sanitize_title_with_dashes function will replace the whitespace from the event’s title with dashes. If changing the code makes no difference when you run the transaction, perhaps you can post your code changes in context in a gist or pastebin and link to it here so we can take a look. |
|
|
Ok, unfortunately no change with this code. The file reads: <?php function espresso_display_worldpay($payment_data) { include_once (‘Worldpay.php’); global $wpdb, $org_options; $myworldpay = new Espresso_Worldpay(); // initiate an instance of the class event_espresso_session_id()); if (!empty($worldpay_settings[‘bypass_payment_page’])) { if ($use_sandbox) { echo ‘<h3 style=”color:#ff0000;” title=”Payments will not be processed”>’ . __(‘WorldPay Debug Mode Is Turned On’, ‘event_espresso’) . ‘</h3>’; add_action(‘action_hook_espresso_display_offsite_payment_gateway’, ‘espresso_display_worldpay’); |
|
<pre class=”brush: php; gutter: true; first-line: 1; highlight: []; html-script: false”> function espresso_display_worldpay($payment_data) { include_once ('Worldpay.php'); global $wpdb, $org_options; $myworldpay = new Espresso_Worldpay(); // initiate an instance of the class event_espresso_session_id()); if (!empty($worldpay_settings['bypass_payment_page'])) { if ($use_sandbox) { echo '<h3 style="color:#ff0000;" title="Payments will not be processed">' . __('WorldPay Debug Mode Is Turned On', 'event_espresso') . '</h3>'; add_action('action_hook_espresso_display_offsite_payment_gateway', 'espresso_display_worldpay'); |
|
Sorry, not sure why that posted twice but I can’t delete it now! The link to the pastebin is here: http://pastebin.com/29KrdiJs# Thanks |
Do you have any gateways within wp-content/uploads/espresso/gateways/? Specifically do you have a ‘worldpay’ directory there? |
|
|
No, this folder is empty at present. Thanks |
|
Barring a couple of line breaks in the code (I’m assuming that’s from pasting it in) the code looks right and adds the event name into the cart ID http://take.ms/eGDTq |
|
This is what I get…. Is it possible I haven’t put the event name in the correct place? Thanks |
Hello, Could you send an email to the following address so we can provide you with an updated version of the file? support [at] eventespresso.com Be sure to include a link to this existing support post. — |
|
|
Hi Brooke, Before we send the file over, can I just clarify are you using Multiple Event Manager (add to cart) to register these events? |
|
I’m not entirely sure – how would I know if I am? Thanks |
|
Hi, The plugin would be active in your Plugins list and if you go to the list of events on the front end, each one would say Register or Add to Cart. |
Hi, I checked your site and your events are using MER (the ‘cart’ system when you click ‘Register’) This is actually due to how MER handles the Event Name(s) in that when you use MER $payment_data[‘event_name’] is not set. I have created a ticket to alter this within a future version of Event Espresso 3 (likely 3.1.38) but can provide you with some code for this to work, however this would require modifying a core file which would need to be repeated with each EE update. If you open up \event-espresso\includes\process-registration\add_attendees_to_db.php On line 819 you’ll find: <?php foreach ($attendees as $attendee) { ?> Under that add: <?php $event_names[] = $attendee->event_name; ?> Then look for line 862, you’ll find 2 br tags. Under that add this: <?php $event_names_combined = array_unique($event_names); $event_names_combined = implode($event_names_combined, '-'); $event_name = apply_filters('filter_hook_espresso_combine_mer_event_names', $event_names_combined, $event_names); ?> So it will end up looking something like this: http://take.ms/qXZ3f Then the modification Dean provided should also work. A reminded that until this code is included within EE this will need to added with each update. |
|
|
This is now working. Thank you so much for your help on this one! |
The support post ‘Editing Reg-IDs’ 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.