Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • infernal Friend
    #160208

    I already posted in another thread but in the end i wasn’t sure are we after the same thing.

    I need to be able to sort my catalog. I wanted to achieve this effect, by placing the extra field filter module under the main menu and just showing the result. Thus i need:
    1) hide the search options that show up in the content area
    2) change the way it outputs the results.

    Changing the output would need to include the extra fields and the item image, preferably in the same formatting as the item formating set in the category.

    My friend is helping me on this, but he has no experience with Joomla and i have no experience with php. Its really hard to figure what is what since the comments are scarce. We managed to hide the search options in the content area, by placing following css in:
    pluginssearchjak2_filterstyle.css

    #searchForm
    {
    display:none;
    }

    Works fine for default milkeyway theme, but messes up the formating of my current theme. Probably its the fault of the theme, but unfortunately its still more like closing eyes on the problem rather than a real solution.

    Is this doable? Can you guys give any tips? Could anyone point me to the file and possably the
    function that is responsible for displaying the search output on the page? Really counting on you guys. If you need any more elaboration don’t hesitate to ask. thou i think i covered it all.
    Thank you in advance.

    thuanlq Friend
    #376783

    Hi Infernal,

    To hide the search options in the content area, please update this style in the file “plugins/search/jak2_filter/style.css”


    #searchform
    {
    display:none !important;
    }

    – To show up more information of k2 items in the search results page, please update some files as following:
    + Open file “plugins/search/jak2_filter.php”, find “onSearch” function to update:


    /*This function will get k2 items which were matched all filter.*/
    function onSearch($text, $phrase = '', $ordering = '', $areas = null) {
    ....
    /*custom sql query to get more fields which you want show on results page*/
    $query = "
    SELECT i.title,
    ...
    }

    – Now, jak2 filter has more information. Next, update the file “componentscom_searchviewssearchtmpldefault_results.php” to display all fields which were got before.

    Good lucks,

    infernal Friend
    #376856

    Using the Database query you provided we only managed to obtain the database fields and print them out. But how should we go about outputting the extra field list.

    Also we couldn’t find where does it store the pictured uploaded with the items.

    Also we were interested where is the file responsible for formating the category ( for reference how to format the search output)

    The end result in the filter would have to be something like this>> [/URL]

    thuanlq Friend
    #376948

    Hi Infernal,

    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:


    ..
    jimport('joomla.filesystem.file');
    foreach ($list as $key=>$item)
    {
    if (JFile::exists(JPATH_SITE.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$item->id).'_Generic.jpg'))
    $imageGeneric = JURI::root().'media/k2/items/cache/'.md5("Image".$item->id).'_Generic.jpg';
    $item->image = $imageGeneric;
    ...
    }
    ...

    – Open the file “componentscom_searchviewssearchtmpldefault_ results.php”, then add this code on the looping to show k2 image:


    <?php
    foreach( $this->results as $result ) : ?>

    ....
    <div>
    <div class="result_image">
    <?php
    if(!empty($result->image))
    {
    ?>
    <img src="<?php echo $result->image; ?>" alt="<?php echo $result->title; ?>" title="<?php echo $result->title;?>" width="100px" height="100px"/>
    <?php
    }
    ?>
    </div>
    <div class="result_text">
    <?php echo $result->text; ?>
    </div>
    </div>
    ....
    <?php endforeach; ?>
    ...

    – you can get orther k2 image as:


    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';
    ...

    Good lucks,

    trunkis Friend
    #377367

    It dosn’t work, when I make else in


    <?php
    if(!empty($result->image))
    {
    ?>
    <img src="<?php echo $result->image; ?>" alt="<?php echo $result->title; ?>" title="<?php echo $result->title;?>" width="100px" height="100px"/>
    <?php
    }
    ?>
    </div>

    like


    <?php
    if(!empty($result->image))
    {
    ?>
    <img src="<?php echo $result->image; ?>" alt="<?php echo $result->title; ?>" title="<?php echo $result->title;?>" width="100px" height="100px"/>
    <?php
    } else {
    print'Nothing';
    }
    ?>
    </div>

    Site print mi Nothing. Hmm?

    thuanlq Friend
    #377385

    Hi Trunkis,

    Please update the file “jak2_filter.php” in the folder “plugins/search/”, update sql query of “onSearch()” function as:


    $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} ";

    – I changed:


    $query = "
    SELECT i.title,

    to


    $query = "
    SELECT i.id, i.title,

    Good luck

    rodion6 Friend
    #388212

    Hi, I need put image in search but I can´t .¿have you a example of jak2_filter.php code?

    Pleaseeee :((

    tnk u

    rodion6 Friend
    ibd2005 Friend
    #407420

    Hello,
    I have install and confg the module but when i run a search i get no results at all as you can see here
    http://www.israel-vip.fr/index.php choose for example :
    Villa
    Ventes
    Jerusalem

    and click the search.
    I know for sure that i have a k2 item with those extra fields selected so why its not in the result?

    thanks for your help
    Itai

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

This topic contains 9 replies, has 5 voices, and was last updated by  ibd2005 13 years, 3 months ago.

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