• Resolved beeweebee

    (@beeweebee)


    Hello and thanks for your plugin,

    I saw the post here: >> post << but it’s a bit old so I’m wondering if it’s been updated. I’m trying to export values into separate columns from a Tribe Events custom field.

    The name of the meta field is: _tribe_tickets_meta.

    The form of the field value is:

    a:1:{i:21450;a:1:{i:0;a:5:{s:34:"name-to-display-on-the-certificate";s:16:"John Doe";s:19:"massage-association";s:4:"MTAA";s:8:"referral";s:8:"Internet";s:25:"other-massage-association";s:0:"";s:14:"other-referral";s:0:"";}}}

    Three fields are interesting for me:

    • massage-association
    • referral
    • other-massage-association

    I’ve currently added a PHP hook that allows me to isolate the referral field in my XLS export:

    // remove everything around the referral value in the tribe events meta key
    add_filter('woe_get_order_value__tribe_tickets_meta',function ($value, $order,$fieldname) {
    	$value = strstr($value, 's:8:"');	
    	$end_to_remove = strstr($value, ';s:25:"');
            //$value = substr($value, 0, strpos($value, "\";s:25:"));
    	$value = str_replace($end_to_remove,"", $value);
    	$value = str_replace("\"","", $value);
     	$value = str_replace("s:8:referral;s:12:","", $value);
     	$value = str_replace("s:8:referral;s:8:","", $value);
     	$value = str_replace("s:8:referral;s:5:","", $value);
     	$value = str_replace("s:8:referral;s:13:","", $value);
     	$value = str_replace("s:8:referral;s:9:","", $value);	
    	return $value;
    },10,3);

    But problem is I can’t do that for each field and have three separate columns onto the same export. Is there a solution?

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author algol.plus

    (@algolplus)

    Hello

    This forum has damaged serialized data, so I can’t help you.

    Can you save “_tribe_tickets_meta” to text file and upload to helpdesk ?

    thanks, Alex

    Thread Starter beeweebee

    (@beeweebee)

    Hey Alex,

    What I see on the forum is entirely correct. Sorry my client doesn’t want me to spend more time on this so I won’t use your helpdesk.
    The workaround I do is I export two files on Excel and aggregate the columns I want. Between both exports I change the hook to export the data I want from my serialized field.

    Thanks again for your help.

    Cheers,

    Bruno

    Plugin Author algol.plus

    (@algolplus)

    hi Bruno

    I’ve pasted data to https://www.unserialize.com/ and it can’t parse it.

    ok, I understand the situation.
    but small tip ??
    function maybe_unserialize is more stable way than str_replace.

    thanks, Alex

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Explode serialized data in several columns’ is closed to new replies.