ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Custom Category Fields not showing up

November 09, 2009 11:55pm

Subscribe [3]
  • #1 / Nov 09, 2009 11:55pm

    Ville Walveranta

    72 posts

    I have a custom category field with short name access_path added to all categories on the site. When I attempt to reference that variable from within search results, nothing shows up.

    In other words, all categories I have defined - top level and sub-categories - have a custom category field with a short name access_path. That variable holds the URL routing for that category (the routing varies depending on the section of the site; in some cases I want the article to reference the parent category in the search results, yet in other cases I want both the parent and sub-category to be part of the path).

    On my search result page the following does not produce anything:

    {exp:search:search_results switch="resultRowOne|resultRowTwo"}
    {categories}{access_path}{/categories}
    {/exp:search:search_results}

    Why? All default (non-custom) category, search result, and weblog parameters work.

    Thanks!

    [Mod Edit: Moved to the Technical Support forum]

  • #2 / Nov 10, 2009 2:26am

    John Henry Donovan

    12339 posts

    Ville,

    I have tried what you have set-up and my results show fine.

    Can I ask what version and build of EE you are using?
    Also do you have any extensions installed?

    Is this for a MSM site?

  • #3 / Nov 10, 2009 2:55am

    Ville Walveranta

    72 posts

    Hi John,

    MSM is not installed. EE is 1.6.8 next to the latest patch (from July, I think).

    Currently enabled extensions:

    Longer titles 1.0.0
    Tag Submit 2.6.4
    LG Image Manager 1.2.0
    LG File Manager 1.2.0
    LG TinyMCE 1.3.3
    Required Category Extension 1.0.2

    To recap, I have six weblogs with eleven top-level categories and 68 sub-categories. I’ve set up “access_path” custom field in each category, and that custom field holds the correct path info for each category group (there are 11 category groups, one for each top level category).

    But when I try to pull the access_path detail to the search results, it comes back blank. So far, I haven’t figured out why it’s not working. Any ideas what I might try next?

    Thanks,

    Ville

  • #4 / Nov 10, 2009 3:05am

    John Henry Donovan

    12339 posts

    Ville,

    Any ideas what I might try next?

    Yes, try disabling your extensions. To do this use the large green button in the top right hand side of the page as opposed to disabling each one. This way you will not lose any settings.

    CP Home ›  Admin ›  Utilities ›  Extensions Manager

  • #5 / Nov 10, 2009 3:30am

    Ville Walveranta

    72 posts

    I disabled them temporarily and tried to search—made no difference, access_path custom category field contents are still not showing up. :long:

    On the other hand I can pull, for instance, information from category_image without any problems (also inside the {categories} ... {/categories} tags), the custom fields just don’t seem to work. Are there any limitations pertaining to the custom category fields? Should they work when searching across weblogs and across many categories/category groups?

  • #6 / Nov 10, 2009 4:29am

    Ville Walveranta

    72 posts

    Well I hacked around this.. with another terrible hackery! During this one year long development process (which I’m about to wrap up) I’ve started to increasingly question the value of a CMS in more complex projects. Sure, they bring a lot of routine back-end functions, but there has been equally many things that I’ve had to work around. Many things that would have been superbly simple and elegant in OO PHP have ended up being rather cumbersome when built around EE. I’m not saying other CMS:es would necessarily be any better, I’m just wondering how much I’ve actually gained development-time-wise by using a CMS as opposed to writing the whole thing from scratch.

    An alternative I’ll consider in the future is to build the front-end from scratch, and use a RAD tool like CodeCharge to build the back-end.

  • #7 / Nov 10, 2009 8:13am

    John Henry Donovan

    12339 posts

    Ville,

    There is no need to hack around this. As I mentioned I had it working in my set-up. This means I actually recreated your environment with as much detail as you provided. This is the first step in any sort of troubleshooting, to see if we can replicate what you are experiencing. The second is interference from an extension which we also covered.

    I understand if you are frustrated but lets try and get this sorted without a hack.

    Is the only code in your search results template just what you provided and nothing else as in CSS, headers footers etc. If not then make sure that this is all that is in it.

    You mentioned that you can get the category name to show up but the access_path is completely blank? Or does the variable actually show in the template {access_path}

  • #8 / Nov 10, 2009 3:56pm

    Ville Walveranta

    72 posts

    I understand if you are frustrated but lets try and get this sorted without a hack.

    Obviously I would prefer it to work with a custom variable since it would make maintenance of the site easier, so let’s see..

    Is the only code in your search results template just what you provided and nothing else as in CSS, headers footers etc. If not then make sure that this is all that is in it.

    I’ve created a results template that has nothing else in it; the same thing happens still.

    You mentioned that you can get the category name to show up but the access_path is completely blank? Or does the variable actually show in the template {access_path}

    It’s completely blank. I tried to move {access_path} outside of the {categories}...{/categories} tags and then it shows as “{access_path}”.

    My search template looks now like this:

    {exp:search:simple_form result_page="/search/test-results"}
    <label for="keywords">Search:</label>
    
    <input type="text" name="keywords" id="keywords" value="" size="18" maxlength="100" /> <input type="submit" value="submit" class="submit" /></p>
    {/exp:search:simple_form}

    And the corresponding result template like this:

    {exp:search:search_results}
    <a href="http://www.mysite.com/{categories}{access_path}{/categories}/{url_title}">{title}</a>
    
    {/exp:search:search_results}

    The links of the resulting hits look like this:
    http://www.mysite.com//some-post-uri-name
    .. even though the access_path field for the category the post is in has a value “it-management-spotlight”, and the parent category has an access_path value “spotlights”.

  • #9 / Nov 10, 2009 4:15pm

    Ingmar

    29245 posts

    It looks like something is wrong with your category custom field, perhaps. Have you tried it in a non-search related context? Does it work there?

  • #10 / Nov 10, 2009 4:35pm

    Ville Walveranta

    72 posts

    Haven’t tried it yet outside of search, but I’ll give it a try.

    I tried to create another custom field “custom_category_info” thinking that perhaps “access_path” was a reserved name, but that made no difference - the newly created field wasn’t accessible, either.

  • #11 / Nov 10, 2009 4:38pm

    Ingmar

    29245 posts

    Haven’t tried it yet outside of search, but I’ll give it a try.

    please do, let us know how it goes.

  • #12 / Nov 10, 2009 10:21pm

    Ville Walveranta

    72 posts

    It works outside of the search context, so the following works when it’s not part of a search results template:

    {exp:weblog:entries weblog="departments" limit="1"}
    {categories}{access_path}{/categories}
    {/exp:weblog:entries}

    Now what? 😊

  • #13 / Nov 11, 2009 2:02am

    John Henry Donovan

    12339 posts

    Please check your email.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases