Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • drimwerk Friend
    #160600

    Hi Thuanlq,

    Is there a more easy explanation or instruction to realise these topics.

    http://www.joomlart.com/forums/topic/search-landing-page/
    http://www.joomlart.com/forums/topic/customizing-ja-k2-filter/

    I’m not a programmer (“into the loop”??? etc) but I know how to replace codes.

    I’m also want to customize the search result page:
    Preferably the same as K2 genericItemView (at least I can customize this in CSS)
    Showing only the “Extra fields Filter & Search” module

    For this page http://kaitak.drwontwikkeling.nl/en/component/search/?searchword=custom+search&ordering=&searchphrase=all&areas[0]=jak2_filter

    Something like:
    Open file “default_form.php” in the folder “componentscom_searchviewssearchtmpl”

    Replace this

    <?php foreach ($this->searchareas[‘search’] as $val => $txt) : ?>
    <?php $checked = is_array( $this->searchareas[‘active’] ) && in_array( $val, $this->searchareas[‘active’] ) ? ‘checked=”checked”‘ : ”; ?>

    For

    This would help a lot. I’ve been trying for hours now but this is to complex for me. Would be even great of you could set parameters for this in the plugin. Maybe in a next release.

    Please could you help me with this? Thanks in advance.

    Regards, Perry

    thuanlq Friend
    #378234

    Hi Perry,

    Thanks for your comment, i can set some parameters for ja k2 extrafields filter plugin to get more k2 item information. However, the search results page is the view page of the default joomla content component, this plugin gets only data, it can’t change the search results page. So, if you want to customize result page, you must custom code in the k2 filter plugin and com_search’s view page.

    Thanks,

    drimwerk Friend
    #378429

    Hi Thuanlq,

    Thanks for your quick reaction. That was my conclusions as well and in the topics I mention above you give the answers how to do. However I’m not a programmer, so I would like to ask you if you could give me the coding so I can easily replace them.

    Especialy: “To get k2 image and view it into the search results page, please update your code as following:
    – Open file”plugins/search/jak2_filter.php”, on “onSearch” function add this code into the looping:”

    Where do I exactly place these codes into the looping. On al my efforts I get an error.
    I’m hoping that you will make this easier for me to do.

    Regards, Perry

    thuanlq Friend
    #378798

    Hi Drimwerk,

    Get k2 image to view it on the search results page, you must edit “onSearch” function to get it before view, do as following:
    – Change $query of “onSearch” function:


    /*this query i changed ( added "i.id" before "i.title" )*/
    $query = "
    SELECT i.id,i.title,
    i.metadesc,
    i.metakey,
    c.name as section,
    i.image_caption,
    i.image_credits,
    i.video_caption,
    i.video_credits,
    i.extra_fields_search,
    i.created,
    CONCAT(i.introtext, i.fulltext) AS text,
    CASE WHEN CHAR_LENGTH(i.alias) THEN CONCAT_WS(':', i.id, i.alias) ELSE i.id END as slug,
    CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(':', c.id, c.alias) ELSE c.id END as catslug
    FROM #__k2_items AS i
    INNER JOIN #__k2_categories AS c ON c.id=i.catid AND c.access <= {$access} ";

    – Define new function “getK2Images()” in “plgsearchJAK2_Filter” class, place it after “onSearch” function:


    function getK2Images( $item)
    {
    jimport('joomla.filesystem.file');
    //Image
    $arr_return = array();
    if (JFile::exists(JPATH_SITE.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$item->id).'_XS.jpg'))
    $arr_return['imageXSmall'] = JURI::root().'media/k2/items/cache/'.md5("Image".$item->id).'_XS.jpg';

    if (JFile::exists(JPATH_SITE.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$item->id).'_S.jpg'))
    $arr_return['imageSmall'] = JURI::root().'media/k2/items/cache/'.md5("Image".$item->id).'_S.jpg';

    if (JFile::exists(JPATH_SITE.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$item->id).'_M.jpg'))
    $arr_return['imageMedium'] = JURI::root().'media/k2/items/cache/'.md5("Image".$item->id).'_M.jpg';

    if (JFile::exists(JPATH_SITE.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$item->id).'_L.jpg'))
    $arr_return['imageLarge'] = JURI::root().'media/k2/items/cache/'.md5("Image".$item->id).'_L.jpg';

    if (JFile::exists(JPATH_SITE.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$item->id).'_XL.jpg'))
    $arr_return['imageXLarge'] = JURI::root().'media/k2/items/cache/'.md5("Image".$item->id).'_XL.jpg';

    if (JFile::exists(JPATH_SITE.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$item->id).'_Generic.jpg'))
    $arr_return['imageGeneric'] = JURI::root().'media/k2/items/cache/'.md5("Image".$item->id).'_Generic.jpg';

    return $arr_return;
    }

    – This is looping which need custom:


    foreach ($list as $key=>$item)
    {
    $item->href = JRoute::_(K2HelperRoute::getItemRoute($item->slug, $item->catslug));
    $item->tag = $searchText;
    $item->browsernav ='';
    if (searchHelper::checkNoHTML($item, $searchText, array('text', 'title', 'metakey', 'metadesc', 'section', 'image_caption', 'image_credits', 'video_caption', 'video_credits', 'extra_fields_search', 'tag')))
    {
    $results[] = $item;
    }
    }

    Add lines code into this looping:


    foreach ($list as $key=>$item)
    {
    $arr_k2image = getK2Images($item);
    $item->image = isset($arr_k2image["imageGeneric"])?$arr_k2image["imageGeneric"]:"";
    ...
    }

    – Now, the go to the search results file in the “views” folder of com_search, and show image for k2 item:


    <img src="<?php echo $result->image; ?>" alt="<?php echo $result->title; ?>" title="<?php echo $result->title;?>" width="100px" height="100px"/>

    Regards,

    drimwerk Friend
    #378866

    Thanks very much, Thuanlq.
    This helps a lot.

    Regards, Perry

    David Porré Friend
    #470974

    Hello,

    Nice one thuanlq !!!
    Thanks a lot !

    Best regards,
    David aka Shapes

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

This topic contains 6 replies, has 3 voices, and was last updated by  David Porré 11 years, 6 months ago.

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