Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • joeluvny Friend
    #662752

    How can I get the searchable label field to display more than one value with a comma between each value instead of just a blank space between the values?

    This is what I mean:
    If I have a searchable field called “Country:” and in that field I have the values USA, Germany, Spain
    then the K2 Item page will display Country: USA Germany Spain

    I would like the K2 Item page to display the Searchable field this way instead
    Country: USA, Germany, Spain

    Is this possible?

    Thank you
    Joseph

    Luna Garden Moderator
    #662874

    Hi Joseph,

    The display of extra field of Result page on JA K2 Filter used K2 layout so you must customize in component K2.

    It’s possible to change as your request.

    You can try this: in file componentscom_k2modelsitem.php
    find

    foreach ($labels as $label)
    {
    $label = JString::trim($label);
    $label = str_replace('-', ' ', $label);
    $value .= '<a href="'.JRoute::_('index.php?option=com_k2&view=itemlist&task=search&searchword='.urlencode($label)).'">'.$label.'</a> ';
    }

    change to

    foreach ($labels as $key => $label)
    {
    end($labels);
    $label = JString::trim($label);
    $label = str_replace('-', ' ', $label);

    if ($key === key($labels)){
    $value .= '<a href="'.JRoute::_('index.php?option=com_k2&view=itemlist&task=search&searchword='.urlencode($label)).'">'.$label.'</a>';
    }
    else
    {
    $value .= '<a href="'.JRoute::_('index.php?option=com_k2&view=itemlist&task=search&searchword='.urlencode($label)).'">'.$label.'</a>, ';
    }

    }

    joeluvny Friend
    #663058

    Thank you Luna,that worked perfectly!!! 🙂

    joeluvny Friend
    #746001

    Thank you Luna,that worked perfectly!!! 🙂

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

This topic contains 4 replies, has 2 voices, and was last updated by  joeluvny 8 years, 7 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum