• Resolved zerodotnine

    (@zerodotnine)


    Hi
    I am attempting to pull in the tab content using wp-lister for ebay. There is an option that allows the meta data to be pulled into the template from a product.
    I have tried to pull in frs_woo_product_tabs but I just get the product ID, is there a different meta value I can use to get the tab content. I need this as the ingredients are stored in the custom tab.

    Many thanks for any advice!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hello zerodotnine.

    You can use the meta shortcode to pull any custom meta field value into the listing description:

    [[meta_custom-meta-field-name]]

    But if that doesn’t work (because the content you want isn’t stored in just a single custom meta field) then you can find more information on how to create a custom shortcode that is tailored to your needs in the API docs: WP-Lister for eBay API – Hooks and Filters

    Kind regards,
    John

    Thread Starter zerodotnine

    (@zerodotnine)

    Hi John
    That is the meta code I was using, do you know the field name that I would need to put in place of custom-meta-field-name to pull in the tab content? I cannot find a reference to this after looking.

    Plugin Author SkyVerge

    (@skyverge)

    Hey John & @zerodotnine!

    I’m not 100% sure if this is going to be possible out of the box. You’re right that the data is stored in the frs_woo_product_tabs product meta, but this isn’t just content; instead it’s an array of tab data like this:

    tab data = array(
     [0] => array(
       'id'      => 'tab ID',
       'title'   => 'the tab title',
       'content' => 'the tab content',
     )
    );
    

    So you’d need to get the meta, only use the $tab_data[0]['content'], not the entire piece of data.

    – @ John, I’m not familiar with your plugin — is there another way to get data into a listing?
    – @ zerodotnine I’m not sure yet if we’ll be able to make these work together but we’ll see if we can find a workaround ??

    Cheers, Beka

    Thread Starter zerodotnine

    (@zerodotnine)

    Hi Beka
    The piece of code I have been pointed at is:

    // list all product attributes names and values
    // usage: product_attributes_list
    add_filter( 'wplister_process_template_html', 'my_wplister_template_filter_product_attributes_list', 10, 3 );
    function my_wplister_template_filter_product_attributes_list( $html, $item, $images ) {
     
        $post_id    = $item['parent_id'] ? $item['parent_id'] : $item['post_id'];
        $attributes = ProductWrapper::getAttributes( $post_id );
     
        $attributes_list = '';
        foreach ($attributes as $name => $value) {
            $value = str_replace( '|', ', ', $value );
            $attributes_list .= $name . ': ' . $value . '<br>';
        }
     
        $html = str_replace( 'product_attributes_list', $attributes_list, $html );
        return $html;
    }

    I’ve tried to implement this call into the code but I am not succeeding. Any help would be very much appreciated as php is not my strong point.

    Many thanks in advance for any assistance!

    Plugin Author SkyVerge

    (@skyverge)

    @zerodotnine,

    Thanks for that, I’ll take a stab here. Please note I have not tested this code, so only use this on a staging or development site! I’m just modeling it off what I see from that snippet, so it should not be put on a site without testing somewhere.

    This should let you use a [ custom_product_tab_content ] shortcode (delete the spaces though) to insert the tab content. Careful with copying the opening <?php tag depending on where you put this: https://gist.github.com/bekarice/205fbb54004fb242981f796562e261d1

    cheers, Beka

    Thread Starter zerodotnine

    (@zerodotnine)

    YES! Thank you, that works very well!

    Excellent support, thanks for helping me get around this issue!

    Have a great day!

    Plugin Author SkyVerge

    (@skyverge)

    @zerodotnine, thanks for confirming! Glad to hear it ??

    @wp-lab-support perhaps something you’d like to include in addition to your “Tab Manager” support section then? Please feel free to add it if so.

    Best, Beka

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Pulling in meta field’ is closed to new replies.