0

The following NEVER displays a name, how can I get it to output a name? Here is what I have:

{exp:rating:entries
    limit="10"
    entry_id="{embed:the_entry_id}"}

    <h4>{if screen_name}
            {screen_name}
        {if:elseif fullname}
            {fullname}
        {if:elseif name}
            {name}
        {/if}</h4>
{/exp:rating:entries}

This is the form I am using, which does actually save the name in the ratings module within the backend.

{exp:rating:form
    entry_id="{embed:the_entry_id}"
    collection="Products"
    return="product/thanks"
    form:class="form validate"
    status="closed"
    anonymous="yes"
    allow_duplicates="no"}

    <input type="text" name="name" value="{name}" class="required" />
{/exp:rating:form}

I heard somewhere deleting the name field, then recreating it with the same name seemed to fix it, though I've not experienced that myself.

2
  • Could you edit your question and actually include a clear question?
    – jrothafer
    Sep 15 '15 at 13:58
  • Done, though thought my objective was pretty obvious.
    – joep
    Sep 15 '15 at 15:37
0

First, you don't need a limit if you are explicitly setting one entry_id. 2nd, have you turned on template debug to check that you are getting the values correctly passed to your embed? 3rd, try eliminating the conditionals, and just leave all 3 variables and see what you get back. 4th, make sure you have submitted some ratings for that entry. :-}

Also go to tools/data/sql manager and look at the exp_ratings table and see what your data looks like. i. e. was a name saved?

3
  • 1.I do want to keep the limit though I'm guessing doesn't matter. 2.I'll try template debugging and get back to you. 3. I'll let you know 4. there are plenty saved! 5. names are saved in exp_ratings table
    – joep
    Sep 15 '15 at 15:58
  • 2. template debugging did not show anything suspicious, 3. tried that all the variables returned nothing. Figured out a fix and added as another answer.
    – joep
    Sep 16 '15 at 8:14
  • 2. Did Template Debugging show entry_id="{embed:the_entry_id}", entry_id="" or entry_id="123" (123 would be the channel entry_id)? 3. Did you write the following as-is, without conditionals: {name}|{screen_name}|{fullname}, and got no output from it?
    – Solspace
    Sep 17 '15 at 2:47
0

No idea why its broken, still a mystery to me, though here is what I did to fix.

In my initial template create an embed and pass it the rating_id :

{embed="product/.testimonial_name" the_rating_id="{rating_id}"}

Then in that:

{exp:query sql="SELECT name FROM exp_ratings WHERE rating_id='{embed:the_rating_id}'"}
    {if name}
        <h4>{name}</h4>
    {/if}
{/exp:query}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.