Product tag formatting in search results

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Product tag formatting in search results

This topic contains 10 replies, has 2 voices, and was last updated by Preet Preet 6 years ago.

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #16865
    Preet
    Preet
    Participant

    Hi, I am having trouble finding how to format and change the product tag results, especially on mobile.

    It seems I can’t get rid of the tag itself, and then the Description is added afterwards and the results panel inherits formatting from the description itself. when I would prefer it was, Just the description, and in a format that matched the rest of the results.

    Thanks.

    #16869
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    I have run a few test queries, and I believe you are reffering to these: https://i.imgur.com/BuSI2Hk.png
    That should not look like that at all. The source tells, that these are h1 and h3 tags, but those should be stripped by default.

    If you don’t want the product tag results at all, then you can turn them off here: https://i.imgur.com/8CpBPCs.png

    If you need those in the results, then one possible cause of the unstripped tags could be, that they might be allowed. On the Advanced Options -> Content panel, make sure this option is empty: https://i.imgur.com/m0SuOf6.png
    This should remove all possible tags, and keep the text only.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #16875
    Preet
    Preet
    Participant

    Hi there,

    Yes. That’s the issue. that field contained <abbr><b>, which I deleted and cleared caches. But it didn’t seem to make much difference.

    We are very keen to retain the product tags as customers use and like them (they got used to them when we previously used YITH Ajax Search). The formatting difficuty I have is that both the Tag itself and the Description are returned in the results. This causes repetition.

    Ideally, I would be able to choose either just the Tag itself, or just the description.

    If just the Tag itself, it would be great to have a universal prefix, eg: “Department – Sugar-free” or “Section – Sugar-free” (Same for Product Categories, but we rely on these less)

    If just the description, then it would be good to format the title differently from the paragraph text, bearing in mind that the Description would normally be a headline related to the tag, but not exacty the tag, followed by some narrative text about the products in the tag.

    Many thanks.

    #16876
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    That is strange, it should be filtered from tags, I feel like something might be conflicting there, I’m not sure.

    You can actually turn off the the term descriptions here, to only display the tag names: https://i.imgur.com/444ayyJ.png

    With a custom code, it is possible to place a prefix to the tag results as well. Add this custom code to the functions.php in your theme/child theme directory (copy from line 3 only!). Before editing, please make sure to have a full site back-up just in case!

    Change the $prefix variable to whatever you want the product tags to be prefixed.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #16877
    Preet
    Preet
    Participant

    Thanks for prefix code. it works well.

    But the descriptions don’t want to turn off. H3 looks OK, but H2 is huge. And I’d really prefer to have description OR tag, but not both.

    Best,
    Christopher

    #16879
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi Christopher,

    In that case, I believe the best option is to simply style those section as the secription via custom CSS.

    Apply this code to your theme custom CSS field (if it supports it) or use the custom CSS field on the search plugin back-end.

    .asp_content h1, .asp_content h2, .asp_content h3:not(:first-of-type) {
        font-family: 'Open Sans' !important;
        font-size: 13px !important;
        font-weight: 400 !important;
        line-height: 18px !important;
        color: rgb(74,74,74) !important;
    }

    This will force all h1, h2 and h3 elements within the tag descriptions to appear styled as simple text.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #16880
    Preet
    Preet
    Participant

    That worked! We are definitely getting there. But what I am really trying to do is show either the Tag or the Description, but not both together.

    The reason for this is that the template only puts the Description on the archive page, not the Tag. So if I want the Tag as the title in h1 on the archive page, I have to put it in as part of the Description. And if I do that at the moment, I then get two copies if the title.

    Many thanks
    Christopher

    #16884
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi Christopher,

    In that case, if I understand correctly, the h1 is actually not needed (as it is the tag name duplicate). If so, then this custom CSS will hide it from the results content:

    .asp_content h1 {
        display: none !important;
    }

    Keep the previous custom CSS as well, as it will still affect the remaining h2 and h3 elements.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #16887
    Preet
    Preet
    Participant

    Brilliant! This makes all the difference. We can now populate all our Product Tag descriptions, for SEO and internal search purposes.
    Thank you.
    Christopher

    #16888
    Ernest Marcinko
    Ernest Marcinko
    Keymaster
    You cannot access this content. Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #16889
    Preet
    Preet
    Participant

    I just rated it already.
    Thanks again.

Viewing 11 posts - 1 through 11 (of 11 total)

The topic ‘Product tag formatting in search results’ is closed to new replies.