0

We have just started to reuse our renewals templates for 2016. Last year everything worked successfully and we processed thousands of transactions. I have just carried out a few tests and i'm getting an error in the models/more_event_cp_data.php program.

Transaction Log

Can anyone identify the likely cause?

The code in question is as follows:-


public function get_event_tx($event_tx_id='')
{
    $this->EE->db->where("id", $event_tx_id);
    $q = $this->EE->db->get("moreevents_tx")->row_array();

    $c = MoreEventCurrency::get($q['currency']);

    $q['amount_paid'] = $c['htmlEntity'].number_format($q['amount_paid'], 2);
    $q['price'] = $c['htmlEntity'].number_format($q['price'], 2);

    $str = "<ul>";
    foreach(unserialize($q['attendees']) as $attendee){
        $str .= "<li>". $attendee['name']."</li>";
    }
    $str .= "</ul>";

    $q['attendees'] = $str;


    $q['raw_response'] = "<pre>".print_r(unserialize($q['raw_response']), TRUE)."</pre>";
    $q['last_activity'] = date("r", $q['last_activity'] );

    unset($q['success_template']);
    unset($q['fail_template']);


    return $q;
}

0

My guess is that you have an event which has no attendees, and the code assumes that each event will have attendees, hence the error.

Try replacing:

$str = "<ul>";
foreach(unserialize($q['attendees']) as $attendee){
    $str .= "<li>". $attendee['name']."</li>";
}
$str .= "</ul>";

$q['attendees'] = $str;

With:

if($attendees = unserialize($q['attendees'])
{    
    $str = "<ul>";
    foreach($attendees as $attendee){
        $str .= "<li>". $attendee['name']."</li>";
    }
    $str .= "</ul>";

    $q['attendees'] = $str;
}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.