We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

How to output the Category Name as a Select_Category Variable of ProVariables?

How Do I?

yzs's avatar
yzs
58 posts
one year ago
yzs's avatar yzs

Hi! Update…

So I did not use the Pro-variables field anymore as there is no need for it but I still have issue on my the category name does not show up on the frontend of the site.

Overview: I have 2 variable groups, added code on template but the pro-variables select_category does not output category name but just the ID

Below is the code:

=var group 1…Only numbers shows and not the names of the category= (var type used for all 3 variables is Select_Category)

{exp:pro_variables:parse var="custom_categories_a" multiple="yes" limit="5"} {custom_categories_a:data}{custom_categories_a:data_label} {/exp:pro_variables:parse} {exp:pro_variables:parse var="custom_categories_b" multiple="yes" limit="5"} {custom_categories_b:data}{custom_categories_b:data_label} {/exp:pro_variables:parse} {exp:pro_variables:parse var="custom_categories_c" multiple="yes" limit="5"} {custom_categories_c:data}{custom_categories_c:data_label} {/exp:pro_variables:parse} <br>
<br>

==var group 2…it works as intended== (var types used are radio group and checkbox group) Survey <select name=”options”> {exp:pro_variables:options var="pv_star_rating"} <option value=”{pv_star_rating:data}”{selected}>{pv_star_rating:data_label}</option> {/exp:pro_variables:options} </select> <select name=”options”> {exp:pro_variables:options var="pv_checklist"} <option value=”{pv_checklist:data}”{selected}>{pv_checklist:data_label}</option> {/exp:pro_variables:options} </select>

       
yzs's avatar
yzs
58 posts
one year ago
yzs's avatar yzs

I think the Pro Variable :data_label is not working or does not output the data label when using Select_Category??

here is new code and i added select_entries variable type to see if output is different and it is…and change select_category from parse to pair and it still the same output…

PV Samples

{exp:pro_variables:pair var="pv_cat_a" multiple="yes" limit="5"}

{pv_cat_a:data} {pv_cat_a:data_label}

{/exp:pro_variables:pair}

{exp:pro_variables:pair var="pv_cat_b" multiple="yes" limit="5"}

{pv_cat_b:data}

{pv_cat_b:data_label}

{/exp:pro_variables:pair}

{exp:pro_variables:pair var="pv_cat_c" multiple="yes" limit="5"}

{pv_cat_c:data}

{pv_cat_c:data_label}

{/exp:pro_variables:pair} <br> {exp:pro_variables:parse var="pv_related_entries" multiple="yes" limit="5"}

{pv_related_entries:data} {pv_related_entries:data_label}

{/exp:pro_variables:parse} <br> Survey <select name=”options”> {exp:pro_variables:options var="pv_star_rating"} <option value=”{pv_star_rating:data}”{selected}>{pv_star_rating:data_label}</option> {/exp:pro_variables:options} </select> <select name=”options”> {exp:pro_variables:options var="pv_checklist"} <option value=”{pv_checklist:data}”{selected}>{pv_checklist:data_label}</option> {/exp:pro_variables:options} </select>

=====Below is the frontend output=====

PV Samples 9

11

2

5

4

10

12

8

9

blog

game_unit

Survey ★★★★★

Shareable Commentary

================================= Any code suggestion is appreciated

       
Rob Allen's avatar
Rob Allen
3,105 posts
one year ago
Rob Allen's avatar Rob Allen

First enable Early parsing in Pro vars settings and on the variable field field.

You should now be able to use your field tag to get category information into a channel categories tag like this.

{exp:channel:categories channel="CHANNEL_NAME" category_group="CAT_GROUP_ID" show="{PV_FIELD_NAME}" style="linear"}
    {category_name}
    {YOUR_CUSTOM_CATEGORY_FIELD}
{/exp:channel:categories}

Replace items in caps with your own values.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.