Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-sales domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114
Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the better-click-to-tweet domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114
Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-amazon domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114
Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-stats domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114
Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wordpress-seo domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114 Code not working from Partial Payments wiki article | Event Espresso - Staging Server
Hi,
I’m trying to get partial payments to work with my event registration. I came across this wiki article: http://staging.eventespresso.com/wiki/setting-partial-payments-ee/
which explains everything very clearly. However, when I copy and paste the raw code for the second function (which starts with <?php
function espresso_get_total_cost_custom($payment_data) { etc) it just gives an error. I tried it in my functions.php (which made the whole site stop working!) and then tried it in the blank plugin for custom functions, where it said it was deactivated for a fatal error.
I would really appreciate some help, I’ve got a whole bunch of clients who have already made partial payments and now are struggling with trying to pay the correct amount owing.
Parse error: syntax error, unexpected ‘<‘ in /home/sites/activateyourlife.org.uk/public_html/wp-content/plugins/CustomFunctionsPlugin/CustomFunctionsPlugin.php on line 12
<pre class=”brush: php; gutter: true; first-line: 1; highlight: []; html-script: false”><?php
/**
* Plugin Name: Custom Functions Plugin
* Plugin URI: http://staging.eventespresso.com
* Description: A blank plugin where you can put custom functions
* Version: 1.0
* Author: Sidney Harrell
* Author URI: http://sidneyharrell.com
* License: GPL2
*/
<?php
function espresso_get_total_cost_custom($payment_data) {
remove_filter(‘filter_hook_espresso_get_total_cost’, ‘espresso_get_total_cost’);
global $wpdb;
//if for some reason attendee_session isn’t setin the payment data, set it now
if(!array_key_exists(‘attendee_session’,$payment_data) || empty($payment_data[‘attendee_session’])){
$SQL = “SELECT attendee_session FROM ” . EVENTS_ATTENDEE_TABLE . ” WHERE id=%d”;
$session_id = $wpdb->get_var( $wpdb->prepare( $SQL, $payment_data[‘attendee_id’] ));
$payment_data[‘attendee_session’]=$session_id;
}
//find all the attendee rows
$sql = “SELECT a.final_price, a.quantity, a.amount_pd FROM ” . EVENTS_ATTENDEE_TABLE . ” a “;
$sql .= ” WHERE a.attendee_session='” . $payment_data[‘attendee_session’] . “‘ ORDER BY a.id ASC”;
$tickets = $wpdb->get_results($sql, ARRAY_A);
$total_cost = 0;
$total_quantity = 0;
$amount_pd = 0;
//sum up their final_prices, as this should already take into account discounts
foreach ($tickets as $ticket) {
$total_cost += $ticket[‘quantity’] * $ticket[‘final_price’];
$total_quantity += $ticket[‘quantity’];
$amount_pd += $ticket[‘amount_pd’];
}
Alright, never mind, I got it to work. :) I just deleted the <?php part from right before function espresso_get_total_cost_custom($payment_data) and it stopped the error message. And, I followed the rest of the steps in article and my partial payments are now working beautifully! Thanks so much Event Espresso!
The support post ‘Code not working from Partial Payments wiki article’ 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.