SOLVED: Dynamic rating value is not rendered in Builder

Browser: Chrome 130.0.6723.59
OS: Windows

Hi,

If we add a custom field to posts or CPT using Jet Engine or even WordPress custom field and use it to dynamically control the rating value, it works well in the front end, but in the rendering builder can’t. It works well for products ({woo_product_rating:value}) and there are no problems.

Custom field

Custom field

in builder

in frontend

Thanks

Works fine with me inside the builder as well as in the front end.

Did you chose the icon color for full and empty?

Yes, but it doesn’t work

For me it even works with my own dynamic tag.

1 Like

Strange, I’ll look into it further. I have this problem even in try.bricks builder.

Here the screen shot to show that it works for me in the builder with the dynamic tag

1 Like

Hi @HOSEIN,

just like @Patric said, it should be working. I’ve also tested locally, and it works. Was with ACF field, but this should not make a difference.
You said that you were able to replicate it on a try.bricksbuilder. Do you have a page where I can see this?

Thanks.
Matej

Hi Matej,

Yes, sure. But it works well in the front end.

https://try.bricksbuilder.io/t7b3ff1b/ideas/

Hi,
thank you. I see and I was able to reproduce it and I’ve added it to the internal task list.

It seems though, that it’s not working only for the first item, and works for all next ones.

And if the dynamic tag if from the options page, for example, it also works.

As always, we will update this topic as soon as the issue is fixed.

Thanks,
Matej.

1 Like

Hi Matej,

Thank you for reviewing this topic. Yes, I also confirm that this problem only occurs for the first item.

1 Like

Perfect, thanks for confirmation.

Matej

1 Like

Hi Hosein,
We’ve fixed this issue in Bricks 1.11.1, now available as a one-click update in your WordPress Dashboard.

Changelog: Bricks 1.11.1 Changelog – Bricks

Please let us know if you are still experiencing issues.

Best regards,
timmse

1 Like

Good evening

now with 1.11.1 my dynamic ratings are not showing at all anymore…

Rating

If I replace the dynamic data with a manual value, the rating appears:

It was working perfectly before. So was there a change in the code regarding the rating element and a dynamic value?

Best regards

Patric

Hi @Patric,

For me there is no problem and it works well. I suggest you disable the plugins. Is the problem still there?

The problem is with the own dynamic tag. My dynamic tag is selfmade and it seems something does not work anymore with the rating element and a selfmade tag:

Don’t know why yet. But if I change the selfmade dynamic tag to a function ({echo:…}), then the rating element works again.

Cheers

Patric

1 Like

hello @Patric

May I ask, how do you display the rating value as 3.7? Because it is displayed as 3.70 by default.

Hi @jolia

My function (link is in the post above) rounds the value to 1 digit after the comma.

Hi

I narrowed down the problem.

If I create two dynamic data codes in the same function, then the dynamic code does not work anymore in the rating element.

If I just create one dynamic data code, then the dynamic code works in the rating element.

Is there a mistake in my code?

function render_kkstar_rating( $content, $post, $context = 'text' ) {
  // $content might consists of HTML and other dynamic tags
  // Only look for dynamic tag {my_dd_tag}
  if ( strpos( $content, '{kk_star_rating}' ) === false && strpos( $content, '{chochete_url}' ) === false   ) {
    return $content;
  }

    switch (true) {
        case strpos( $content, '{kk_star_rating}' ): 
        $my_value = run_rating_dd_tag_logic();
        $content = str_replace( '{kk_star_rating}', $my_value, $content );
        break;
        case strpos( $content, '{chochete_url}' ): 
         $my_value = run_chocheteurl_dd_tag_logic();
        $content = str_replace( '{chochete_url}', $my_value, $content );
        break;
    }
  return $content;
}

because this code with only one dynamic data works:

function render_kkstar_rating( $content, $post, $context = 'text' ) {

  // $content might consists of HTML and other dynamic tags
  // Only look for dynamic tag {my_dd_tag}
  if ( strpos( $content, '{kk_star-rating}' ) === false ) {
    return $content;
  }
 
  // Do your custom logic here, you should define run_my_dd_tag_logic() function
  $my_value = run_rating_dd_tag_logic();
 
  // Replace the tag with the value you want to display
  $content = str_replace( '{kk_star-rating}', $my_value, $content );

  return $content;
}

The dynamic data code works in the title element, it only does not work in the rating element.

Strange.

OK, if I replace the case with if statements, it works.

  if (strpos( $content, '{kk_star_rating}' ) !== false ) {
        $my_value = run_rating_dd_tag_logic();
        $content = str_replace( '{kk_star_rating}', $my_value, $content );
        }
        if (strpos( $content, '{chochete_url}' ) !== false ) { 
        $my_value = run_chocheteurl_dd_tag_logic();
        $content = str_replace( '{chochete_url}', $my_value, $content );
        }

Must be something wrong in my case statement? Just curious why it worked before the latest version of Bricks and still works to print out the value. Just the rating element does not work anymore.

Cheers

Patric