Skip to main content

Using Bricks Builder. Featured Product and {fct_product_image} do not work.

Neither {fct_product_image} or {featured_image} work in Bricks Builder.

Sarkar Ripon

We had a bug related to the featured image, but it has been fixed now. It’s possible that you have a product that was created during the time of the bug. In this case, you can simply delete the product image/featured image and then add and save it again. Hopefully, this will resolve the issue. Thank you.

Yann O

Hey Ripon Sarkar,

There is definitely an issue with {fct_product_image} tag.

Could you please double check this on your end?

I'm trying to do a simple Bricks product card loop to use in the product slider. Although I only created the product about a week ago (which should've been already after the bug was fixed as you mentioned above), neither of the {fct_product_image} or {featured_image}Β worked for me to get the product image in my loop.

That's how I ended up on this post.

I deleted the product featured image as per your suggestion above. Now the {featured_image} seems to work and I get the product image, however, I can confirm that the {fct_product_image} does not work, and I get 'Image not found' message just above the dynamic field for this tag.

Alan BlairΒ does the {fct_product_image} work for you now?

Madis Mark

Still doesnt work?

Madis Mark

This is the temporary fix for me:

/**

  • Fix FluentCart Bricks dynamic data
    */
    add_filter( 'bricks/dynamic_data/render_tag', function( $tag, $post, $context = 'text' ) {
    if ( ! is_string( $tag ) || strpos( $tag, 'fctproduct' ) === false ) {
    return $tag;
    }

    if ( ! $post ) {
    $post = \FluentCart\App\Modules\Templating\Bricks\BricksHelper::getFormCurrentPost();
    }

    if ( ! $post || $post->post_type !== 'fluent-products' ) {
    return $tag;
    }

    $clean = trim( $tag, '{}' );

    if ( $clean === 'fct_product_image' ) {
    $gallery = maybe_unserialize( get_post_meta( $post->ID, 'fluent-products-gallery-image', true ) );
    $image_id = isset( $gallery[0]['id'] ) ? (int) $gallery[0]['id'] : 0;

     if ( ! $image_id ) return $tag;
    
     return $context === 'image' ? [ $image_id ] : wp_get_attachment_image( $image_id, 'full' );

    }

    return $tag;
    }, 19, 3 );