• Resolved befla.net

    (@beflanet)


    Hi. Very nice plugin.

    I′m using shopmagic example plugin for to get custom placeholders which works for me.
    Now I′m looking for a solution to get an output from a meta value.
    I have the meta_key _op_payment_methods and the meta_value a:1:{i:0;a:15:{s:4:"name";s:5:"Sears";s:4:"code";s:24:"jetpack_custom_gateway_4";s:3:"ref";s:10:"qwertzuiop";s:11:"description";s:0:"";s:23:"paid_currency_formatted";s:5:"99.99";s:4:"paid";d:99.99;s:25:"return_currency_formatted";s:4:"0.00";s:6:"return";i:0;s:10:"paid_point";i:0;s:4:"type";s:7:"offline";s:11:"online_type";s:8:"external";s:7:"partial";b:0;s:10:"status_url";s:0:"";s:19:"allow_online_refund";s:2:"no";s:13:"callback_data";a:0:{}}}. Now I want to create a placeholder for to get “qwertzuiop”.
    Someone can give me a snippet? Thanks a lot.

Viewing 1 replies (of 1 total)
  • Plugin Contributor Bartek

    (@bartj)

    Hi!

    meta_value is serialized, but when you call get_post_meta assuming that you have an ID of the object (order) for the key you want, you will get returned array.

    Now all you have to do is to return value from that array, what would be like:

    
    $payment_meta = get_post_meta( $ID, '_op_payment_methods' );
    return $payment_meta['ref'];
    
Viewing 1 replies (of 1 total)
  • The topic ‘Get from Array’ is closed to new replies.