COMMUNITY FORUM
Search Results (Searched for: extra field order)
- Marc
21 Dec 2011 18:17
Replied by Marc on topic How to order cat item view by extra field value
How to order cat item view by extra field value
Category: English K2 Community
Did you ever find a way to do this? I think if you could list items in asc or desc order according to the Extra field (date) you could then list events and open K2 up to a whole new area away from blogposts and products.
- Brian
22 Nov 2011 00:24
How to order cat item view by extra field value was created by Brian
How to order cat item view by extra field value
Category: English K2 Community
I have an extra fields > date field that I want to order my category item view with. How do I go about doing that?
- Tijuana Mou Cartelli
03 Nov 2011 14:59
Suggestion - Order Extra Fields in Alphabeticall O was created by Tijuana Mou Cartelli
Suggestion - Order Extra Fields in Alphabeticall O
Category: English K2 Community
Hi! Maybe it could be a good idea to give the possibility to order A/Z contents in extra fields :cheer:
Byee!
Byee!
- Marc
26 Oct 2011 00:57
Creating table for extra fields help was created by Marc
Creating table for extra fields help
Category: English K2 Community
Can someone please look at the following code for me please, the logic is right for 2 extra fields and I have echo 'New Row' and echo 'close row' in it so I know it should all be on one row, but for some reason it still is creating 2 new rows for the 2 extra fields.
<!-- Item extra fields --> <?php $table = '<table width="100%" border="0">'; ?> <?php $counter = 0; ?> <?php $total1 = count($this->item->extra_fields); ?> <?php if($this->item->params->get('catItemExtraFields') && count($this->item->extra_fields)): ?> <!-- Item extra fields --> <?php $columns = 2; ?> <div class="catItemExtraFields"> <h4><?php echo JText::_('K2_ADDITIONAL_INFO'); ?></h4> <ul> <?php foreach ($this->item->extra_fields as $key=>$extraField) : ?> <?php if($extraField->value) : ?> <?php $counter++; ?> <?php if ($counter%$columns == 1) : ?> <?php echo 'New Row'; ?> <?php '<tr>\n'; ?> <?php endif ; ?> <li class="<?php echo ($key%2) ? "odd" : "even"; ?> type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>"> </li> <?php 'td width ="95px"' ; ?> <span class="catItemExtraFieldsLabel"><?php echo $extraField->name; ?></span> <span class="catItemExtraFieldsValue"><?php echo $extraField->value; ?></span> <?php '</td>' ; ?> <?php if ($counter%$columns == 0): ?> <?php echo 'Close Row'; ?> <?php '</tr>' ?> <?php endif ; ?> <?php endif; ?> <?php endforeach; ?> <?php $table .= '</table>'; ?> </ul> <div class="clr"></div> </div> <?php endif; ?>
- richard frederick vincent
25 Oct 2011 22:03 - 25 Oct 2011 22:43
Cant save categories Unknown column 'language' was created by richard frederick vincent
Cant save categories Unknown column 'language'
Category: English K2 Community
Urgent please
Hello, after upgrading i tried to edit an existing category but then i got this message
TableK2Category: :store failed
Unknown column 'language' in 'field list' SQL=UPDATE `americas_k2_categories` SET `name`='National Post',`alias`='national-post',`description`='',`parent`='128',`extraFieldsGroup`='0',`published`='1',`access`='1',`params`='{\"inheritFrom\":\"9\",\"theme\":\"\",\"num_leading_items\":\"2\",\"num_leading_columns\":\"1\",\"leadingImgSize\":\"Large\",\"num_primary_items\":\"4\",\"num_primary_columns\":\"2\",\"primaryImgSize\":\"Medium\",\"num_secondary_items\":\"4\",\"num_secondary_columns\":\"1\",\"secondaryImgSize\":\"Small\",\"num_links\":\"4\",\"num_links_columns\":\"1\",\"linksImgSize\":\"XSmall\",\"catCatalogMode\":\"0\",\"catFeaturedItems\":\"1\",\"catOrdering\":\"\",\"catPagination\":\"2\",\"catPaginationResults\":\"1\",\"catTitle\":\"1\",\"catTitleItemCounter\":\"1\",\"catDescription\":\"1\",\"catImage\":\"1\",\"catFeedLink\":\"1\",\"feedLink\":\"1\",\"subCategories\":\"1\",\"subCatColumns\":\"2\",\"subCatOrdering\":\"\",\"subCatTitle\":\"1\",\"subCatTitleItemCounter\":\"1\",\"subCatDescription\":\"1\",\"subCatImage\":\"1\",\"itemImageXS\":\"\",\"itemImageS\":\"\",\"itemImageM\":\"\",\"itemImageL\":\"\",\"itemImageXL\":\"\",\"catItemTitle\":\"1\",\"catItemTitleLinked\":\"1\",\"catItemFeaturedNotice\":\"0\",\"catItemAuthor\":\"1\",\"catItemDateCreated\":\"1\",\"catItemRating\":\"0\",\"catItemImage\":\"1\",\"catItemIntroText\":\"1\",\"catItemIntroTextWordLimit\":\"\",\"catItemExtraFields\":\"0\",\"catItemHits\":\"0\",\"catItemCategory\":\"1\",\"catItemTags\":\"1\",\"catItemAttachments\":\"0\",\"catItemAttachmentsCounter\":\"0\",\"catItemVideo\":\"0\",\"catItemVideoWidth\":\"\",\"catItemVideoHeight\":\"\",\"catItemAudioWidth\":\"\",\"catItemAudioHeight\":\"\",\"catItemVideoAutoPlay\":\"0\",\"catItemImageGallery\":\"0\",\"catItemDateModified\":\"0\",\"catItemReadMore\":\"1\",\"catItemCommentsAnchor\":\"1\",\"catItemK2Plugins\":\"1\",\"itemDateCreated\":\"1\",\"itemTitle\":\"1\",\"itemFeaturedNotice\":\"1\",\"itemAuthor\":\"1\",\"itemFontResizer\":\"1\",\"itemPrintButton\":\"1\",\"itemEmailButton\":\"1\",\"itemSocialButton\":\"1\",\"itemVideoAnchor\":\"1\",\"itemImageGalleryAnchor\":\"1\",\"itemCommentsAnchor\":\"1\",\"itemRating\":\"1\",\"itemImage\":\"1\",\"itemImgSize\":\"Large\",\"itemImageMainCaption\":\"1\",\"itemImageMainCredits\":\"1\",\"itemIntroText\":\"1\",\"itemFullText\":\"1\",\"itemExtraFields\":\"1\",\"itemDateModified\":\"1\",\"itemHits\":\"1\",\"itemCategory\":\"1\",\"itemTags\":\"1\",\"itemAttachments\":\"1\",\"itemAttachmentsCounter\":\"1\",\"itemVideo\":\"1\",\"itemVideoWidth\":\"\",\"itemVideoHeight\":\"\",\"itemAudioWidth\":\"\",\"itemAudioHeight\":\"\",\"itemVideoAutoPlay\":\"0\",\"itemVideoCaption\":\"1\",\"itemVideoCredits\":\"1\",\"itemImageGallery\":\"1\",\"itemNavigation\":\"1\",\"itemComments\":\"1\",\"itemTwitterButton\":\"1\",\"itemFacebookButton\":\"1\",\"itemGooglePlusOneButton\":\"1\",\"itemAuthorBlock\":\"1\",\"itemAuthorImage\":\"1\",\"itemAuthorDescription\":\"1\",\"itemAuthorURL\":\"1\",\"itemAuthorEmail\":\"0\",\"itemAuthorLatest\":\"1\",\"itemAuthorLatestLimit\":\"5\",\"itemRelated\":\"1\",\"itemRelatedLimit\":\"5\",\"itemRelatedTitle\":\"1\",\"itemRelatedCategory\":\"0\",\"itemRelatedImageSize\":\"0\",\"itemRelatedIntrotext\":\"0\",\"itemRelatedFulltext\":\"0\",\"itemRelatedAuthor\":\"0\",\"itemRelatedMedia\":\"0\",\"itemRelatedImageGallery\":\"0\",\"itemK2Plugins\":\"1\",\"catMetaDesc\":\"\",\"catMetaKey\":\"\",\"catMetaRobots\":\"\",\"catMetaAuthor\":\"\"}',`language`='*' WHERE `id`='452'
meaning i cannot edit my categories anymore
Hello, after upgrading i tried to edit an existing category but then i got this message
TableK2Category: :store failed
Unknown column 'language' in 'field list' SQL=UPDATE `americas_k2_categories` SET `name`='National Post',`alias`='national-post',`description`='',`parent`='128',`extraFieldsGroup`='0',`published`='1',`access`='1',`params`='{\"inheritFrom\":\"9\",\"theme\":\"\",\"num_leading_items\":\"2\",\"num_leading_columns\":\"1\",\"leadingImgSize\":\"Large\",\"num_primary_items\":\"4\",\"num_primary_columns\":\"2\",\"primaryImgSize\":\"Medium\",\"num_secondary_items\":\"4\",\"num_secondary_columns\":\"1\",\"secondaryImgSize\":\"Small\",\"num_links\":\"4\",\"num_links_columns\":\"1\",\"linksImgSize\":\"XSmall\",\"catCatalogMode\":\"0\",\"catFeaturedItems\":\"1\",\"catOrdering\":\"\",\"catPagination\":\"2\",\"catPaginationResults\":\"1\",\"catTitle\":\"1\",\"catTitleItemCounter\":\"1\",\"catDescription\":\"1\",\"catImage\":\"1\",\"catFeedLink\":\"1\",\"feedLink\":\"1\",\"subCategories\":\"1\",\"subCatColumns\":\"2\",\"subCatOrdering\":\"\",\"subCatTitle\":\"1\",\"subCatTitleItemCounter\":\"1\",\"subCatDescription\":\"1\",\"subCatImage\":\"1\",\"itemImageXS\":\"\",\"itemImageS\":\"\",\"itemImageM\":\"\",\"itemImageL\":\"\",\"itemImageXL\":\"\",\"catItemTitle\":\"1\",\"catItemTitleLinked\":\"1\",\"catItemFeaturedNotice\":\"0\",\"catItemAuthor\":\"1\",\"catItemDateCreated\":\"1\",\"catItemRating\":\"0\",\"catItemImage\":\"1\",\"catItemIntroText\":\"1\",\"catItemIntroTextWordLimit\":\"\",\"catItemExtraFields\":\"0\",\"catItemHits\":\"0\",\"catItemCategory\":\"1\",\"catItemTags\":\"1\",\"catItemAttachments\":\"0\",\"catItemAttachmentsCounter\":\"0\",\"catItemVideo\":\"0\",\"catItemVideoWidth\":\"\",\"catItemVideoHeight\":\"\",\"catItemAudioWidth\":\"\",\"catItemAudioHeight\":\"\",\"catItemVideoAutoPlay\":\"0\",\"catItemImageGallery\":\"0\",\"catItemDateModified\":\"0\",\"catItemReadMore\":\"1\",\"catItemCommentsAnchor\":\"1\",\"catItemK2Plugins\":\"1\",\"itemDateCreated\":\"1\",\"itemTitle\":\"1\",\"itemFeaturedNotice\":\"1\",\"itemAuthor\":\"1\",\"itemFontResizer\":\"1\",\"itemPrintButton\":\"1\",\"itemEmailButton\":\"1\",\"itemSocialButton\":\"1\",\"itemVideoAnchor\":\"1\",\"itemImageGalleryAnchor\":\"1\",\"itemCommentsAnchor\":\"1\",\"itemRating\":\"1\",\"itemImage\":\"1\",\"itemImgSize\":\"Large\",\"itemImageMainCaption\":\"1\",\"itemImageMainCredits\":\"1\",\"itemIntroText\":\"1\",\"itemFullText\":\"1\",\"itemExtraFields\":\"1\",\"itemDateModified\":\"1\",\"itemHits\":\"1\",\"itemCategory\":\"1\",\"itemTags\":\"1\",\"itemAttachments\":\"1\",\"itemAttachmentsCounter\":\"1\",\"itemVideo\":\"1\",\"itemVideoWidth\":\"\",\"itemVideoHeight\":\"\",\"itemAudioWidth\":\"\",\"itemAudioHeight\":\"\",\"itemVideoAutoPlay\":\"0\",\"itemVideoCaption\":\"1\",\"itemVideoCredits\":\"1\",\"itemImageGallery\":\"1\",\"itemNavigation\":\"1\",\"itemComments\":\"1\",\"itemTwitterButton\":\"1\",\"itemFacebookButton\":\"1\",\"itemGooglePlusOneButton\":\"1\",\"itemAuthorBlock\":\"1\",\"itemAuthorImage\":\"1\",\"itemAuthorDescription\":\"1\",\"itemAuthorURL\":\"1\",\"itemAuthorEmail\":\"0\",\"itemAuthorLatest\":\"1\",\"itemAuthorLatestLimit\":\"5\",\"itemRelated\":\"1\",\"itemRelatedLimit\":\"5\",\"itemRelatedTitle\":\"1\",\"itemRelatedCategory\":\"0\",\"itemRelatedImageSize\":\"0\",\"itemRelatedIntrotext\":\"0\",\"itemRelatedFulltext\":\"0\",\"itemRelatedAuthor\":\"0\",\"itemRelatedMedia\":\"0\",\"itemRelatedImageGallery\":\"0\",\"itemK2Plugins\":\"1\",\"catMetaDesc\":\"\",\"catMetaKey\":\"\",\"catMetaRobots\":\"\",\"catMetaAuthor\":\"\"}',`language`='*' WHERE `id`='452'
meaning i cannot edit my categories anymore
- Garzarath
20 Oct 2011 08:04
Replied by Garzarath on topic add extra field with example plugin
add extra field with example plugin
Category: English K2 Community
Hi Jsmith,
Can you share the plugin with the community?
In order to solve my problem about relating k2 items I maybe will use an extended field.
I will save time if I can take a look on your plugin.
Thanks
Note: If I do it Iwill share mine too
Can you share the plugin with the community?
In order to solve my problem about relating k2 items I maybe will use an extended field.
I will save time if I can take a look on your plugin.
Thanks
Note: If I do it Iwill share mine too
- jmcruznet
19 Sep 2011 14:54
Replied by jmcruznet on topic How to make ordered/unordered list in k2extrafields?
How to make ordered/unordered list in k2extrafields?
Category: English K2 Community
I have
Amenities:
List One
List Two
List Three
Landmarks:
List One
List Two
List Three
Actually I might have 3 to 5 List. But if you could give me sample on how to code the list above, I can use them as my guide. Thanks again.
Amenities:
List One
List Two
List Three
Landmarks:
List One
List Two
List Three
Actually I might have 3 to 5 List. But if you could give me sample on how to code the list above, I can use them as my guide. Thanks again.
- william white
19 Sep 2011 14:49
Replied by william white on topic How to make ordered/unordered list in k2extrafields?
How to make ordered/unordered list in k2extrafields?
Category: English K2 Community
I see, didnt know you had other lists you wanted to display....You will probably have to extract the extra fields one by one for this in an override...How many fields do you have, how are they gruped, and what are their names?
- jmcruznet
19 Sep 2011 14:43
Replied by jmcruznet on topic How to make ordered/unordered list in k2extrafields?
How to make ordered/unordered list in k2extrafields?
Category: English K2 Community
But that will comment out all extrafields labels? I might have two unordered list like "Amenities List" and "Floor List"
- william white
19 Sep 2011 14:13
Replied by william white on topic How to make ordered/unordered list in k2extrafields?
How to make ordered/unordered list in k2extrafields?
Category: English K2 Community
Create an override.
Just above the foreach tht displays extra fields in item.php echo "Amenities"
Comment out the line in the foreach loop that displays the name of the extra fields and only display the value
This will be close to what you want i think.
Just above the foreach tht displays extra fields in item.php echo "Amenities"
Comment out the line in the foreach loop that displays the name of the extra fields and only display the value
This will be close to what you want i think.
- jmcruznet
19 Sep 2011 13:58
How to make ordered/unordered list in k2extrafields? was created by jmcruznet
How to make ordered/unordered list in k2extrafields?
Category: English K2 Community
How to make ordered/unordered list in k2extrafields?
I want to make something like this:
Amenities:
. List one
. List two
. List three
I want to make something like this:
Amenities:
. List one
. List two
. List three
- Jock
19 Sep 2011 11:40
Replied by Jock on topic Joomla search and extra fields
Joomla search and extra fields
Category: English K2 Community
I sure can:
tinyurl.com/6drzd4o
If you run a search for "test" you will see the 1st 16 results are from extra fields and therefore don't have a snippet. The last 4 results are where the search term is in the content tab area and NOT the extra fields (thus the snippet showing up).I appreciate your help Simon, perhaps some modification of the php is in order?
tinyurl.com/6drzd4o
If you run a search for "test" you will see the 1st 16 results are from extra fields and therefore don't have a snippet. The last 4 results are where the search term is in the content tab area and NOT the extra fields (thus the snippet showing up).I appreciate your help Simon, perhaps some modification of the php is in order?
- that library
08 Sep 2011 18:21
k2_categories table has no language field in db - Joomla 1.6 with K2 SVN 2.5(RC) was created by that library
k2_categories table has no language field in db - Joomla 1.6 with K2 SVN 2.5(RC)
Category: English K2 Community
I finally got upgraded (via Jupgrade) from Joomla v1.5.23 to 1.6.6, and installed the K2 SVN 2.5(RC) on the 1.6 site, which, thankfully is now acknowledged by J1.6 within the menu manager. This is a start but I'm having a strange issue that I hope someone can help me with:
I want to stress that the K2 content is in the j16_ database tables where it should be, I can see & access it within the admin area of the 1.6 site, but it's just not showing up on the front end at all. I think the major reason for this is because:
Each category's access column in the database j16_k2_categories is set to 0 instead of 1, when I try to change this for the parent category, I get a big db error, because:
There is no column for language, so when I try to change anything in the parent category (from which all others inherit their parameters (or any category), I get the following error:
TableK2Category: :store failedUnknown column 'language' in 'field list' SQL=UPDATE `j16_k2_categories` SET `name`='Library',`alias`='library-main',`description`=' **description went here**
',`parent`='0',`extraFieldsGroup`='1',`published`='1',`access`='1',`params`='{\"inheritFrom\":\"0\",\"theme\":\"\",\"num_leading_items\":\"2\",\"num_leading_columns\":\"1\",\"leadingImgSize\":\"Large\",\"num_primary_items\":\"4\",\"num_primary_columns\":\"2\",\"primaryImgSize\":\"Medium\",\"num_secondary_items\":\"4\",\"num_secondary_columns\":\"1\",\"secondaryImgSize\":\"Small\",\"num_links\":\"4\",\"num_links_columns\":\"1\",\"linksImgSize\":\"XSmall\",\"catCatalogMode\":\"0\",\"catFeaturedItems\":\"1\",\"catOrdering\":\"\",\"catPagination\":\"2\",\"catPaginationResults\":\"1\",\"catTitle\":\"1\",\"catTitleItemCounter\":\"1\",\"catDescription\":\"1\",\"catImage\":\"1\",\"catFeedLink\":\"1\",\"feedLink\":\"1\",\"subCategories\":\"1\",\"subCatColumns\":\"2\",\"subCatOrdering\":\"\",\"subCatTitle\":\"1\",\"subCatTitleItemCounter\":\"1\",\"subCatDescription\":\"1\",\"subCatImage\":\"1\",\"itemImageXS\":\"\",\"itemImageS\":\"\",\"itemImageM\":\"\",\"itemImageL\":\"\",\"itemImageXL\":\"\",\"catItemTitle\":\"1\",\"catItemTitleLinked\":\"1\",\"catItemFeaturedNotice\":\"0\",\"catItemAuthor\":\"1\",\"catItemDateCreated\":\"1\",\"catItemRating\":\"0\",\"catItemImage\":\"1\",\"catItemIntroText\":\"1\",\"catItemIntroTextWordLimit\":\"\",\"catItemExtraFields\":\"0\",\"catItemHits\":\"0\",\"catItemCategory\":\"1\",\"catItemTags\":\"1\",\"catItemAttachments\":\"0\",\"catItemAttachmentsCounter\":\"0\",\"catItemVideo\":\"0\",\"catItemVideoWidth\":\"\",\"catItemVideoHeight\":\"\",\"catItemVideoAutoPlay\":\"0\",\"catItemImageGallery\":\"0\",\"catItemDateModified\":\"0\",\"catItemReadMore\":\"1\",\"catItemCommentsAnchor\":\"1\",\"catItemK2Plugins\":\"1\",\"itemDateCreated\":\"1\",\"itemTitle\":\"1\",\"itemFeaturedNotice\":\"1\",\"itemAuthor\":\"1\",\"itemFontResizer\":\"1\",\"itemPrintButton\":\"1\",\"itemEmailButton\":\"1\",\"itemSocialButton\":\"1\",\"itemVideoAnchor\":\"1\",\"itemImageGalleryAnchor\":\"1\",\"itemCommentsAnchor\":\"1\",\"itemRating\":\"1\",\"itemImage\":\"1\",\"itemImgSize\":\"Large\",\"itemImageMainCaption\":\"1\",\"itemImageMainCredits\":\"1\",\"itemIntroText\":\"1\",\"itemFullText\":\"1\",\"itemExtraFields\":\"1\",\"itemDateModified\":\"1\",\"itemHits\":\"1\",\"itemTwitterLink\":\"1\",\"itemCategory\":\"1\",\"itemTags\":\"1\",\"itemShareLinks\":\"1\",\"itemAttachments\":\"1\",\"itemAttachmentsCounter\":\"1\",\"itemRelated\":\"1\",\"itemRelatedLimit\":\"5\",\"itemVideo\":\"1\",\"itemVideoWidth\":\"\",\"itemVideoHeight\":\"\",\"itemVideoAutoPlay\":\"0\",\"itemVideoCaption\":\"1\",\"itemVideoCredits\":\"1\",\"itemImageGallery\":\"1\",\"itemNavigation\":\"1\",\"itemComments\":\"1\",\"itemAuthorBlock\":\"1\",\"itemAuthorImage\":\"1\",\"itemAuthorDescription\":\"1\",\"itemAuthorURL\":\"1\",\"itemAuthorEmail\":\"0\",\"itemAuthorLatest\":\"1\",\"itemAuthorLatestLimit\":\"5\",\"itemK2Plugins\":\"1\"}',`language`='en-GB' WHERE id='23'
Even with the seo-friendly links turned on, J1.6 has /en/ within the links, so the language field in the k2_categories has to exist.
So clearly I need to add another field to not only the K2 categories, but where would it go? What I mean is where should I insert this field within that db table (in between something, at the end)? And would the items be able to be seen (retrieved properly) if it is only in the categories table after that?
Or do I need to execute a SQL query to insert it into the k2_items table as well?
It is worth noting that I do have a number of languages installed, but even before I installed them, all Joomla! categories & content are automatically listed as "Language - All."
Can someone please help me out with this?
Bueller? Bueller?
I want to stress that the K2 content is in the j16_ database tables where it should be, I can see & access it within the admin area of the 1.6 site, but it's just not showing up on the front end at all. I think the major reason for this is because:
Each category's access column in the database j16_k2_categories is set to 0 instead of 1, when I try to change this for the parent category, I get a big db error, because:
There is no column for language, so when I try to change anything in the parent category (from which all others inherit their parameters (or any category), I get the following error:
TableK2Category: :store failedUnknown column 'language' in 'field list' SQL=UPDATE `j16_k2_categories` SET `name`='Library',`alias`='library-main',`description`=' **description went here**
',`parent`='0',`extraFieldsGroup`='1',`published`='1',`access`='1',`params`='{\"inheritFrom\":\"0\",\"theme\":\"\",\"num_leading_items\":\"2\",\"num_leading_columns\":\"1\",\"leadingImgSize\":\"Large\",\"num_primary_items\":\"4\",\"num_primary_columns\":\"2\",\"primaryImgSize\":\"Medium\",\"num_secondary_items\":\"4\",\"num_secondary_columns\":\"1\",\"secondaryImgSize\":\"Small\",\"num_links\":\"4\",\"num_links_columns\":\"1\",\"linksImgSize\":\"XSmall\",\"catCatalogMode\":\"0\",\"catFeaturedItems\":\"1\",\"catOrdering\":\"\",\"catPagination\":\"2\",\"catPaginationResults\":\"1\",\"catTitle\":\"1\",\"catTitleItemCounter\":\"1\",\"catDescription\":\"1\",\"catImage\":\"1\",\"catFeedLink\":\"1\",\"feedLink\":\"1\",\"subCategories\":\"1\",\"subCatColumns\":\"2\",\"subCatOrdering\":\"\",\"subCatTitle\":\"1\",\"subCatTitleItemCounter\":\"1\",\"subCatDescription\":\"1\",\"subCatImage\":\"1\",\"itemImageXS\":\"\",\"itemImageS\":\"\",\"itemImageM\":\"\",\"itemImageL\":\"\",\"itemImageXL\":\"\",\"catItemTitle\":\"1\",\"catItemTitleLinked\":\"1\",\"catItemFeaturedNotice\":\"0\",\"catItemAuthor\":\"1\",\"catItemDateCreated\":\"1\",\"catItemRating\":\"0\",\"catItemImage\":\"1\",\"catItemIntroText\":\"1\",\"catItemIntroTextWordLimit\":\"\",\"catItemExtraFields\":\"0\",\"catItemHits\":\"0\",\"catItemCategory\":\"1\",\"catItemTags\":\"1\",\"catItemAttachments\":\"0\",\"catItemAttachmentsCounter\":\"0\",\"catItemVideo\":\"0\",\"catItemVideoWidth\":\"\",\"catItemVideoHeight\":\"\",\"catItemVideoAutoPlay\":\"0\",\"catItemImageGallery\":\"0\",\"catItemDateModified\":\"0\",\"catItemReadMore\":\"1\",\"catItemCommentsAnchor\":\"1\",\"catItemK2Plugins\":\"1\",\"itemDateCreated\":\"1\",\"itemTitle\":\"1\",\"itemFeaturedNotice\":\"1\",\"itemAuthor\":\"1\",\"itemFontResizer\":\"1\",\"itemPrintButton\":\"1\",\"itemEmailButton\":\"1\",\"itemSocialButton\":\"1\",\"itemVideoAnchor\":\"1\",\"itemImageGalleryAnchor\":\"1\",\"itemCommentsAnchor\":\"1\",\"itemRating\":\"1\",\"itemImage\":\"1\",\"itemImgSize\":\"Large\",\"itemImageMainCaption\":\"1\",\"itemImageMainCredits\":\"1\",\"itemIntroText\":\"1\",\"itemFullText\":\"1\",\"itemExtraFields\":\"1\",\"itemDateModified\":\"1\",\"itemHits\":\"1\",\"itemTwitterLink\":\"1\",\"itemCategory\":\"1\",\"itemTags\":\"1\",\"itemShareLinks\":\"1\",\"itemAttachments\":\"1\",\"itemAttachmentsCounter\":\"1\",\"itemRelated\":\"1\",\"itemRelatedLimit\":\"5\",\"itemVideo\":\"1\",\"itemVideoWidth\":\"\",\"itemVideoHeight\":\"\",\"itemVideoAutoPlay\":\"0\",\"itemVideoCaption\":\"1\",\"itemVideoCredits\":\"1\",\"itemImageGallery\":\"1\",\"itemNavigation\":\"1\",\"itemComments\":\"1\",\"itemAuthorBlock\":\"1\",\"itemAuthorImage\":\"1\",\"itemAuthorDescription\":\"1\",\"itemAuthorURL\":\"1\",\"itemAuthorEmail\":\"0\",\"itemAuthorLatest\":\"1\",\"itemAuthorLatestLimit\":\"5\",\"itemK2Plugins\":\"1\"}',`language`='en-GB' WHERE id='23'
Even with the seo-friendly links turned on, J1.6 has /en/ within the links, so the language field in the k2_categories has to exist.
So clearly I need to add another field to not only the K2 categories, but where would it go? What I mean is where should I insert this field within that db table (in between something, at the end)? And would the items be able to be seen (retrieved properly) if it is only in the categories table after that?
Or do I need to execute a SQL query to insert it into the k2_items table as well?
It is worth noting that I do have a number of languages installed, but even before I installed them, all Joomla! categories & content are automatically listed as "Language - All."
Can someone please help me out with this?
Bueller? Bueller?
- Panagiotis Sakellariou
07 Sep 2011 03:06
How to add k2 rating to search results? was created by Panagiotis Sakellariou
How to add k2 rating to search results?
Category: English K2 Community
Hello all
I've been trying to customise my search results page and while I managed to load the rating system for any k2 items that appear in a search, it loads as if noone has voted, and when you click to vote, it then loads the correct amount of votes.
Below is my default_results.php (of joomla's com_search, template override).
<?php defined('_JEXEC') or die('Restricted access'); ?><?php 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 = 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 = 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 = 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 = 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 = 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 = JURI::root().'media/k2/items/cache/'.md5("Image".$item->id).'_Generic.jpg'; return $arr_return; }?><?php ?><table class="contentpaneopen<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>"> <tr> <td> <?php $db = JFactory::getDBO(); foreach( $this->results as $result ) : ?> <?php $image =""; if(isset($result->extra_fields_search)) { $query = " SELECT i.id,i.title, i.metadesc, i.featured, i.featured_ordering, i.metakey, c.name as section, i.image_caption, i.image_credits, i.video_caption, i.video_credits, i.extra_fields_search, i.created, i.introtext 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 WHERE i.id = ". $result->id; $db->setQuery($query); $item = $db->loadObject(); if(!empty($item)) { $arr_k2image = getK2Images($item); $image = isset($arr_k2image["imageGeneric"])?$arr_k2image["imageGeneric"]:""; } } ?> <fieldset> <div class="sea1"> <span class="small<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>"> <?php echo $this->pagination->limitstart + $result->count.'. ';?> </span> <?php if ( $result->href ) : if ($result->browsernav == 1 ) : ?> <a class="modal" rel="{handler:'iframe',size:{x:800,y:600}}" href="<?php echo JRoute::_($result->href); ?>?tmpl=component" target="_blank"> <?php else : ?> <a class="modal" rel="{handler:'iframe',size:{x:800,y:600}}" href="<?php echo JRoute::_($result->href); ?>?tmpl=component"> <?php endif; echo $this->escape($result->title); if ( $result->href ) : ?> </a> <?php endif; if ( $result->section ) : ?> <br /> <span class="small<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>"> (<?php echo $this->escape($result->section); ?>) </span> <?php endif; ?> <?php endif; ?> </div> <!-- Item Rating --> <div class="catItemRatingBlock"> <span><?php echo JText::_('Rate this item'); ?></span> <div class="itemRatingForm"> <ul class="itemRatingList"> <li class="itemCurrentRating" id="itemCurrentRating<?php echo $result->id; ?>" style="width:<?php echo $result->votingPercentage; ?>%;"></li> <li><a href="#" rel="<?php echo $result->id; ?>" title="<?php echo JText::_('1 star out of 5'); ?>" class="one-star">1</a></li> <li><a href="#" rel="<?php echo $result->id; ?>" title="<?php echo JText::_('2 stars out of 5'); ?>" class="two-stars">2</a></li> <li><a href="#" rel="<?php echo $result->id; ?>" title="<?php echo JText::_('3 stars out of 5'); ?>" class="three-stars">3</a></li> <li><a href="#" rel="<?php echo $result->id; ?>" title="<?php echo JText::_('4 stars out of 5'); ?>" class="four-stars">4</a></li> <li><a href="#" rel="<?php echo $result->id; ?>" title="<?php echo JText::_('5 stars out of 5'); ?>" class="five-stars">5</a></li> </ul> <div id="itemRatingLog<?php echo $result->id; ?>" class="itemRatingLog"><?php echo $result->numOfvotes; ?></div> <div class="clr"></div> </div> <div class="clr"></div> </div> <?php if ( $result->featured == 1) : ?> <span class="feat"> <sup> <?php echo '<img class="sear" src="/images/stories/featuredItem.png" title="Designer" alt="Designer" />'; ?> </sup> </span> <?php endif; ?> <div> <div class="result_image"> <?php if(!empty($image)) { ?><a class="modal" rel="{handler:'iframe',size:{x:800,y:600}}" href="<?php echo JRoute::_($result->href); ?>?tmpl=component" title="<?php echo $result->title;?>"> <img class="search_image" src="<?php echo $image; ?>" alt="<?php echo $result->title; ?>" width="200px" height="auto"/></a> <?php } ?> </div> <div class="catItemIntroText"> <?php echo JHTML::_('content.prepare', $result->text); ?> </div> </div> </fieldset> <?php endforeach; ?> </td> </tr> <tr> <td colspan="3"> <div align="center"> <?php echo $this->pagination->getPagesLinks( ); ?> </div> </td> </tr></table>
I believe the problem is at line 116 and 123, and more specifically the votingPercentage @ line 116 and the numOfvotes @ line 123. (I have bolded the 2 lines of code).
How can I fix that? Any help will be greatly appreciated.
p.s. The code above contains hacks to show the item's image with a link, open title link and image link as popup, show the featured notice-graphic(if there is one), load content plugins that are being invoked with tags in introtext, show only introtext with full HTML and some more that I can't remember,
feel free to copy at will.
I've been trying to customise my search results page and while I managed to load the rating system for any k2 items that appear in a search, it loads as if noone has voted, and when you click to vote, it then loads the correct amount of votes.
Below is my default_results.php (of joomla's com_search, template override).
<?php defined('_JEXEC') or die('Restricted access'); ?><?php 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 = 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 = 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 = 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 = 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 = 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 = JURI::root().'media/k2/items/cache/'.md5("Image".$item->id).'_Generic.jpg'; return $arr_return; }?><?php ?><table class="contentpaneopen<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>"> <tr> <td> <?php $db = JFactory::getDBO(); foreach( $this->results as $result ) : ?> <?php $image =""; if(isset($result->extra_fields_search)) { $query = " SELECT i.id,i.title, i.metadesc, i.featured, i.featured_ordering, i.metakey, c.name as section, i.image_caption, i.image_credits, i.video_caption, i.video_credits, i.extra_fields_search, i.created, i.introtext 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 WHERE i.id = ". $result->id; $db->setQuery($query); $item = $db->loadObject(); if(!empty($item)) { $arr_k2image = getK2Images($item); $image = isset($arr_k2image["imageGeneric"])?$arr_k2image["imageGeneric"]:""; } } ?> <fieldset> <div class="sea1"> <span class="small<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>"> <?php echo $this->pagination->limitstart + $result->count.'. ';?> </span> <?php if ( $result->href ) : if ($result->browsernav == 1 ) : ?> <a class="modal" rel="{handler:'iframe',size:{x:800,y:600}}" href="<?php echo JRoute::_($result->href); ?>?tmpl=component" target="_blank"> <?php else : ?> <a class="modal" rel="{handler:'iframe',size:{x:800,y:600}}" href="<?php echo JRoute::_($result->href); ?>?tmpl=component"> <?php endif; echo $this->escape($result->title); if ( $result->href ) : ?> </a> <?php endif; if ( $result->section ) : ?> <br /> <span class="small<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>"> (<?php echo $this->escape($result->section); ?>) </span> <?php endif; ?> <?php endif; ?> </div> <!-- Item Rating --> <div class="catItemRatingBlock"> <span><?php echo JText::_('Rate this item'); ?></span> <div class="itemRatingForm"> <ul class="itemRatingList"> <li class="itemCurrentRating" id="itemCurrentRating<?php echo $result->id; ?>" style="width:<?php echo $result->votingPercentage; ?>%;"></li> <li><a href="#" rel="<?php echo $result->id; ?>" title="<?php echo JText::_('1 star out of 5'); ?>" class="one-star">1</a></li> <li><a href="#" rel="<?php echo $result->id; ?>" title="<?php echo JText::_('2 stars out of 5'); ?>" class="two-stars">2</a></li> <li><a href="#" rel="<?php echo $result->id; ?>" title="<?php echo JText::_('3 stars out of 5'); ?>" class="three-stars">3</a></li> <li><a href="#" rel="<?php echo $result->id; ?>" title="<?php echo JText::_('4 stars out of 5'); ?>" class="four-stars">4</a></li> <li><a href="#" rel="<?php echo $result->id; ?>" title="<?php echo JText::_('5 stars out of 5'); ?>" class="five-stars">5</a></li> </ul> <div id="itemRatingLog<?php echo $result->id; ?>" class="itemRatingLog"><?php echo $result->numOfvotes; ?></div> <div class="clr"></div> </div> <div class="clr"></div> </div> <?php if ( $result->featured == 1) : ?> <span class="feat"> <sup> <?php echo '<img class="sear" src="/images/stories/featuredItem.png" title="Designer" alt="Designer" />'; ?> </sup> </span> <?php endif; ?> <div> <div class="result_image"> <?php if(!empty($image)) { ?><a class="modal" rel="{handler:'iframe',size:{x:800,y:600}}" href="<?php echo JRoute::_($result->href); ?>?tmpl=component" title="<?php echo $result->title;?>"> <img class="search_image" src="<?php echo $image; ?>" alt="<?php echo $result->title; ?>" width="200px" height="auto"/></a> <?php } ?> </div> <div class="catItemIntroText"> <?php echo JHTML::_('content.prepare', $result->text); ?> </div> </div> </fieldset> <?php endforeach; ?> </td> </tr> <tr> <td colspan="3"> <div align="center"> <?php echo $this->pagination->getPagesLinks( ); ?> </div> </td> </tr></table>
I believe the problem is at line 116 and 123, and more specifically the votingPercentage @ line 116 and the numOfvotes @ line 123. (I have bolded the 2 lines of code).
How can I fix that? Any help will be greatly appreciated.
p.s. The code above contains hacks to show the item's image with a link, open title link and image link as popup, show the featured notice-graphic(if there is one), load content plugins that are being invoked with tags in introtext, show only introtext with full HTML and some more that I can't remember,
feel free to copy at will.
- Panagiotis Sakellariou
07 Sep 2011 03:02
Rating/Voting in Joomla Search Results was created by Panagiotis Sakellariou
Rating/Voting in Joomla Search Results
Category: English K2 Community
Hello all
I've been trying to customise my search results page and while I managed to load the rating system for any k2 items that appear in a search, it loads as if noone has voted, and when you click to vote, it then loads the correct amount of votes.
Below is my default_results.php (of joomla's com_search, template override).
<?php defined('_JEXEC') or die('Restricted access'); ?><?php 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 = 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 = 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 = 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 = 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 = 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 = JURI::root().'media/k2/items/cache/'.md5("Image".$item->id).'_Generic.jpg'; return $arr_return; }?><?php ?><table class="contentpaneopen<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>"> <tr> <td> <?php $db = JFactory::getDBO(); foreach( $this->results as $result ) : ?> <?php $image =""; if(isset($result->extra_fields_search)) { $query = " SELECT i.id,i.title, i.metadesc, i.featured, i.featured_ordering, i.metakey, c.name as section, i.image_caption, i.image_credits, i.video_caption, i.video_credits, i.extra_fields_search, i.created, i.introtext 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 WHERE i.id = ". $result->id; $db->setQuery($query); $item = $db->loadObject(); if(!empty($item)) { $arr_k2image = getK2Images($item); $image = isset($arr_k2image["imageGeneric"])?$arr_k2image["imageGeneric"]:""; } } ?> <fieldset> <div class="sea1"> <span class="small<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>"> <?php echo $this->pagination->limitstart + $result->count.'. ';?> </span> <?php if ( $result->href ) : if ($result->browsernav == 1 ) : ?> <a class="modal" rel="{handler:'iframe',size:{x:800,y:600}}" href="<?php echo JRoute::_($result->href); ?>?tmpl=component" target="_blank"> <?php else : ?> <a class="modal" rel="{handler:'iframe',size:{x:800,y:600}}" href="<?php echo JRoute::_($result->href); ?>?tmpl=component"> <?php endif; echo $this->escape($result->title); if ( $result->href ) : ?> </a> <?php endif; if ( $result->section ) : ?> <br /> <span class="small<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>"> (<?php echo $this->escape($result->section); ?>) </span> <?php endif; ?> <?php endif; ?> </div> <!-- Item Rating --> <div class="catItemRatingBlock"> <span><?php echo JText::_('Rate this item'); ?></span> <div class="itemRatingForm"> <ul class="itemRatingList"> <li class="itemCurrentRating" id="itemCurrentRating<?php echo $result->id; ?>" style="width:<?php echo $result->votingPercentage; ?>%;"></li> <li><a href="#" rel="<?php echo $result->id; ?>" title="<?php echo JText::_('1 star out of 5'); ?>" class="one-star">1</a></li> <li><a href="#" rel="<?php echo $result->id; ?>" title="<?php echo JText::_('2 stars out of 5'); ?>" class="two-stars">2</a></li> <li><a href="#" rel="<?php echo $result->id; ?>" title="<?php echo JText::_('3 stars out of 5'); ?>" class="three-stars">3</a></li> <li><a href="#" rel="<?php echo $result->id; ?>" title="<?php echo JText::_('4 stars out of 5'); ?>" class="four-stars">4</a></li> <li><a href="#" rel="<?php echo $result->id; ?>" title="<?php echo JText::_('5 stars out of 5'); ?>" class="five-stars">5</a></li> </ul> <div id="itemRatingLog<?php echo $result->id; ?>" class="itemRatingLog"><?php echo $result->numOfvotes; ?></div> <div class="clr"></div> </div> <div class="clr"></div> </div> <?php if ( $result->featured == 1) : ?> <span class="feat"> <sup> <?php echo '<img class="sear" src="/images/stories/featuredItem.png" title="Designer" alt="Designer" />'; ?> </sup> </span> <?php endif; ?> <div> <div class="result_image"> <?php if(!empty($image)) { ?><a class="modal" rel="{handler:'iframe',size:{x:800,y:600}}" href="<?php echo JRoute::_($result->href); ?>?tmpl=component" title="<?php echo $result->title;?>"> <img class="search_image" src="<?php echo $image; ?>" alt="<?php echo $result->title; ?>" width="200px" height="auto"/></a> <?php } ?> </div> <div class="catItemIntroText"> <?php echo JHTML::_('content.prepare', $result->text); ?> </div> </div> </fieldset> <?php endforeach; ?> </td> </tr> <tr> <td colspan="3"> <div align="center"> <?php echo $this->pagination->getPagesLinks( ); ?> </div> </td> </tr></table>
I believe the problem is at line 116 and 123, and more specifically the votingPercentage @ line 116 and the numOfvotes @ line 123. (I have bolded the 2 lines of code).
How can I fix that? Any help will be greatly appreciated.
p.s. The code above contains hacks to show the item's image with a link, open title link and image link as popup, show the featured notice-graphic(if there is one), load content plugins that are being invoked with tags in introtext, show only introtext with full HTML and some more that I can't remember,
feel free to copy at will.
I've been trying to customise my search results page and while I managed to load the rating system for any k2 items that appear in a search, it loads as if noone has voted, and when you click to vote, it then loads the correct amount of votes.
Below is my default_results.php (of joomla's com_search, template override).
<?php defined('_JEXEC') or die('Restricted access'); ?><?php 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 = 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 = 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 = 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 = 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 = 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 = JURI::root().'media/k2/items/cache/'.md5("Image".$item->id).'_Generic.jpg'; return $arr_return; }?><?php ?><table class="contentpaneopen<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>"> <tr> <td> <?php $db = JFactory::getDBO(); foreach( $this->results as $result ) : ?> <?php $image =""; if(isset($result->extra_fields_search)) { $query = " SELECT i.id,i.title, i.metadesc, i.featured, i.featured_ordering, i.metakey, c.name as section, i.image_caption, i.image_credits, i.video_caption, i.video_credits, i.extra_fields_search, i.created, i.introtext 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 WHERE i.id = ". $result->id; $db->setQuery($query); $item = $db->loadObject(); if(!empty($item)) { $arr_k2image = getK2Images($item); $image = isset($arr_k2image["imageGeneric"])?$arr_k2image["imageGeneric"]:""; } } ?> <fieldset> <div class="sea1"> <span class="small<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>"> <?php echo $this->pagination->limitstart + $result->count.'. ';?> </span> <?php if ( $result->href ) : if ($result->browsernav == 1 ) : ?> <a class="modal" rel="{handler:'iframe',size:{x:800,y:600}}" href="<?php echo JRoute::_($result->href); ?>?tmpl=component" target="_blank"> <?php else : ?> <a class="modal" rel="{handler:'iframe',size:{x:800,y:600}}" href="<?php echo JRoute::_($result->href); ?>?tmpl=component"> <?php endif; echo $this->escape($result->title); if ( $result->href ) : ?> </a> <?php endif; if ( $result->section ) : ?> <br /> <span class="small<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>"> (<?php echo $this->escape($result->section); ?>) </span> <?php endif; ?> <?php endif; ?> </div> <!-- Item Rating --> <div class="catItemRatingBlock"> <span><?php echo JText::_('Rate this item'); ?></span> <div class="itemRatingForm"> <ul class="itemRatingList"> <li class="itemCurrentRating" id="itemCurrentRating<?php echo $result->id; ?>" style="width:<?php echo $result->votingPercentage; ?>%;"></li> <li><a href="#" rel="<?php echo $result->id; ?>" title="<?php echo JText::_('1 star out of 5'); ?>" class="one-star">1</a></li> <li><a href="#" rel="<?php echo $result->id; ?>" title="<?php echo JText::_('2 stars out of 5'); ?>" class="two-stars">2</a></li> <li><a href="#" rel="<?php echo $result->id; ?>" title="<?php echo JText::_('3 stars out of 5'); ?>" class="three-stars">3</a></li> <li><a href="#" rel="<?php echo $result->id; ?>" title="<?php echo JText::_('4 stars out of 5'); ?>" class="four-stars">4</a></li> <li><a href="#" rel="<?php echo $result->id; ?>" title="<?php echo JText::_('5 stars out of 5'); ?>" class="five-stars">5</a></li> </ul> <div id="itemRatingLog<?php echo $result->id; ?>" class="itemRatingLog"><?php echo $result->numOfvotes; ?></div> <div class="clr"></div> </div> <div class="clr"></div> </div> <?php if ( $result->featured == 1) : ?> <span class="feat"> <sup> <?php echo '<img class="sear" src="/images/stories/featuredItem.png" title="Designer" alt="Designer" />'; ?> </sup> </span> <?php endif; ?> <div> <div class="result_image"> <?php if(!empty($image)) { ?><a class="modal" rel="{handler:'iframe',size:{x:800,y:600}}" href="<?php echo JRoute::_($result->href); ?>?tmpl=component" title="<?php echo $result->title;?>"> <img class="search_image" src="<?php echo $image; ?>" alt="<?php echo $result->title; ?>" width="200px" height="auto"/></a> <?php } ?> </div> <div class="catItemIntroText"> <?php echo JHTML::_('content.prepare', $result->text); ?> </div> </div> </fieldset> <?php endforeach; ?> </td> </tr> <tr> <td colspan="3"> <div align="center"> <?php echo $this->pagination->getPagesLinks( ); ?> </div> </td> </tr></table>
I believe the problem is at line 116 and 123, and more specifically the votingPercentage @ line 116 and the numOfvotes @ line 123. (I have bolded the 2 lines of code).
How can I fix that? Any help will be greatly appreciated.
p.s. The code above contains hacks to show the item's image with a link, open title link and image link as popup, show the featured notice-graphic(if there is one), load content plugins that are being invoked with tags in introtext, show only introtext with full HTML and some more that I can't remember,
feel free to copy at will.
- Marjorie COULIN
28 Aug 2011 02:36
Replied by Marjorie COULIN on topic (Solved) Access and print extra fields (K2) within slide
(Solved) Access and print extra fields (K2) within slide
Category: Frontpage Slideshow
Hi Fotis,
My opinion is that it might not be an overkill if a bunch of people use an extra field as for example, some subtitle (thus not a "detail"), like I do.
My goal is to fully integrate a particular extra-field within the slides (I above mentionned the subtitle concept). Meaning backoffice management, order, position and effects. I don't see any other solution than making the slides retrieve the information by themselves.
Not mentionning that using mod_k2_content and JS/CSS tricks in parallel of FPSS would be quite messy, not to say dirty.
My opinion is that it might not be an overkill if a bunch of people use an extra field as for example, some subtitle (thus not a "detail"), like I do.
I'm not sure I understand what you mean here.just use mod_k2_content and wrap it with a similar slideshow effect/script.
My goal is to fully integrate a particular extra-field within the slides (I above mentionned the subtitle concept). Meaning backoffice management, order, position and effects. I don't see any other solution than making the slides retrieve the information by themselves.
Not mentionning that using mod_k2_content and JS/CSS tricks in parallel of FPSS would be quite messy, not to say dirty.
- david nelband
23 Aug 2011 17:38
display extra field groups on category page was created by david nelband
display extra field groups on category page
Category: English K2 Community
hi,
first of all - this is my first post, and i got to say that k2 has really upgraded my joomla abillities, so thank you for developing this extension!
my question is this -
is it possible to display the extra field group that is assigned to the category on ites category view page?
to visualize what i need check out this page on dhgate - look on the left side ('refine your search')
www.dhgate.com/wholesale-hoody/OjpSMlZ1WkdWeQ%253D%253D-OjpUV1Z1/s014001006.html#DCP014022-L1-01
imagine that the left side is the extra field group, and every option group (for example - material) is an extra field.
is this possible with some php programming? and of course, what is exactly ? :)
if not - is it possible to contact you guys in order for you to make this for me custum made?
first of all - this is my first post, and i got to say that k2 has really upgraded my joomla abillities, so thank you for developing this extension!
my question is this -
is it possible to display the extra field group that is assigned to the category on ites category view page?
to visualize what i need check out this page on dhgate - look on the left side ('refine your search')
www.dhgate.com/wholesale-hoody/OjpSMlZ1WkdWeQ%253D%253D-OjpUV1Z1/s014001006.html#DCP014022-L1-01
imagine that the left side is the extra field group, and every option group (for example - material) is an extra field.
is this possible with some php programming? and of course, what is exactly ? :)
if not - is it possible to contact you guys in order for you to make this for me custum made?
- Dario Pintarić
14 Aug 2011 20:22
Get specific extra field from database to use outside of K2 was created by Dario Pintarić
Get specific extra field from database to use outside of K2
Category: English K2 Community
Hi,
I'm working on some customization on a RokStories module and i got caught up with few problems...
As I see it, RokStories is querying items from DB, and now i have a big problem....
1. each item has two extrafields, and i would like to display the second extrafield - how do i do that ?
So far i've been able to pull out the items date of creation and categoryname by editing RokStories "helper.php"....
Here's the K2 references inside RokStories helper.php
require_once (JPATH_SITE.DS.'components'.DS.'com_k2'.DS.'helpers'.DS.'route.php'); $query = "SELECT a.*, c.name as categoryname,c.id as categoryid, c.alias as categoryalias, c.params as categoryparams". " FROM #__k2_items as a". " LEFT JOIN #__k2_categories c ON c.id = a.catid"; $query .= " WHERE a.published = 1" ." AND a.access <= {$aid}" ." AND a.trash = 0" ." AND c.published = 1" ." AND c.access <= {$aid}" ." AND c.trash = 0" ; if ($params->get('catfilter')){ if (!is_null($cid)) { if (is_array($cid)) { $query .= " AND a.catid IN(".implode(',', $cid).")"; } else { $query .= " AND a.catid={$cid}"; } } } if ($params->get('FeaturedItems')=='0') $query.= " AND a.featured != 1"; if ($params->get('FeaturedItems')=='2') $query.= " AND a.featured = 1"; $query .= $where . ' ORDER BY ' . $orderby; // end K2 specific } $db->setQuery($query, 0, $count); $rows = $db->loadObjectList(); $i=0; $lists = array(); if (is_array($rows) && count($rows)>0) { foreach ( $rows as $row ) { //process content plugins $text = JHTML::_('content.prepare',$row->introtext,$cparams); $lists[$i]->id = $row->id; $lists[$i]->created = $row->created; $lists[$i]->modified = $row->modified; $lists[$i]->title = htmlspecialchars( $row->title ); $lists[$i]->introtext = modRokStoriesHelper::prepareContent($text, $params); $lists[$i]->garantirano = $row->garantirano; $lists[$i]->kategorija = $row->categoryname;
p.s. this goes and although i'm not a php pro i think i'll have to query/get the extra fields from DB and use helper or something to get the extra field...
Any one have any idea ?
I'm working on some customization on a RokStories module and i got caught up with few problems...
As I see it, RokStories is querying items from DB, and now i have a big problem....
1. each item has two extrafields, and i would like to display the second extrafield - how do i do that ?
So far i've been able to pull out the items date of creation and categoryname by editing RokStories "helper.php"....
Here's the K2 references inside RokStories helper.php
require_once (JPATH_SITE.DS.'components'.DS.'com_k2'.DS.'helpers'.DS.'route.php'); $query = "SELECT a.*, c.name as categoryname,c.id as categoryid, c.alias as categoryalias, c.params as categoryparams". " FROM #__k2_items as a". " LEFT JOIN #__k2_categories c ON c.id = a.catid"; $query .= " WHERE a.published = 1" ." AND a.access <= {$aid}" ." AND a.trash = 0" ." AND c.published = 1" ." AND c.access <= {$aid}" ." AND c.trash = 0" ; if ($params->get('catfilter')){ if (!is_null($cid)) { if (is_array($cid)) { $query .= " AND a.catid IN(".implode(',', $cid).")"; } else { $query .= " AND a.catid={$cid}"; } } } if ($params->get('FeaturedItems')=='0') $query.= " AND a.featured != 1"; if ($params->get('FeaturedItems')=='2') $query.= " AND a.featured = 1"; $query .= $where . ' ORDER BY ' . $orderby; // end K2 specific } $db->setQuery($query, 0, $count); $rows = $db->loadObjectList(); $i=0; $lists = array(); if (is_array($rows) && count($rows)>0) { foreach ( $rows as $row ) { //process content plugins $text = JHTML::_('content.prepare',$row->introtext,$cparams); $lists[$i]->id = $row->id; $lists[$i]->created = $row->created; $lists[$i]->modified = $row->modified; $lists[$i]->title = htmlspecialchars( $row->title ); $lists[$i]->introtext = modRokStoriesHelper::prepareContent($text, $params); $lists[$i]->garantirano = $row->garantirano; $lists[$i]->kategorija = $row->categoryname;
p.s. this goes and although i'm not a php pro i think i'll have to query/get the extra fields from DB and use helper or something to get the extra field...
Any one have any idea ?
- BNR Investment Group
06 Aug 2011 18:29
Replied by BNR Investment Group on topic Where and when I can download K2 for Joomla 1.7?
Where and when I can download K2 for Joomla 1.7?
Category: English K2 Community
@Mark - when did you try Zoo? I tried Zoo when I was evaluating CCKs and I didn't like it. K2 was much better and easier to understand, which is why I chose it for all client sites we've built since. If you have not looked at Zoo recently, you should. They got slaughtered by K2 and went back to the drawing board. The new version is much different. It has many more features and works much better.
Someone mentioned something about being constrained to apps. That's not actually the case. Not only is there an app bundle for $100, but you can easily modify apps to fit your needs. Think of an app as a subtemplate and extra field bundled in to a package. It doesn't really require more work than K2, just different work. The interface for ordering the content items is fantastic as well and much better than any other CCK I have looked at. It's really come a long way.As I mentioned before, I have dozens of sites I have to consider. We've started our first Zoo site and so far it is looking like that will be the path we take for all of our other clients as well. It's a shame because I really like K2. We've developed a lot of cool stuff for K2 that I guess we will have to adapt to Zoo, but we can't afford to wait around for the end of August to find out there has been another delay. April is only 9 months from now. If I convert 1 site a week I will be really pushing my luck. I cannot gamble on K2 being released when I am already looking at a lot of work to make the deadline now.
Someone mentioned something about being constrained to apps. That's not actually the case. Not only is there an app bundle for $100, but you can easily modify apps to fit your needs. Think of an app as a subtemplate and extra field bundled in to a package. It doesn't really require more work than K2, just different work. The interface for ordering the content items is fantastic as well and much better than any other CCK I have looked at. It's really come a long way.As I mentioned before, I have dozens of sites I have to consider. We've started our first Zoo site and so far it is looking like that will be the path we take for all of our other clients as well. It's a shame because I really like K2. We've developed a lot of cool stuff for K2 that I guess we will have to adapt to Zoo, but we can't afford to wait around for the end of August to find out there has been another delay. April is only 9 months from now. If I convert 1 site a week I will be really pushing my luck. I cannot gamble on K2 being released when I am already looking at a lot of work to make the deadline now.
- Rob Avey
24 Jul 2011 22:45
Need to attach "sub items" to main items to create a menu was created by Rob Avey
Need to attach "sub items" to main items to create a menu
Category: English K2 Community
Hello, I spent a couple of days looking around the web and can't seem to come up with a suitable answer to my problem.
Each of my items (27 in all) there are 3 accompanying info items. At first I used extra fields but because the extra items contain so much html it breaks the html when using joomfish...couldn't come up with a fix for that so I took each accompanying extra field and created a separate item for each.
I am also using tags to achieve the multi category item layout.
I can use mod_dmk2articlelistpro to list the accompanying item titles (the items that use to be extra fields)...that works okay but it also means that I have to create 27 modules that match up with the current items. I can't imagine my customer would be too impressed if every time they add a new item that they would then have to create another module in order to display the accompanying items.
Is there any way that this could be automated? So basically what I have is a top level item that has 3 info items attached to it...the main item is a shopping cart item (using K2mart).
Any input would be appreciated...hopefully I've explained myself clear enough but at this point i may have confused myself!
TIA
Each of my items (27 in all) there are 3 accompanying info items. At first I used extra fields but because the extra items contain so much html it breaks the html when using joomfish...couldn't come up with a fix for that so I took each accompanying extra field and created a separate item for each.
I am also using tags to achieve the multi category item layout.
I can use mod_dmk2articlelistpro to list the accompanying item titles (the items that use to be extra fields)...that works okay but it also means that I have to create 27 modules that match up with the current items. I can't imagine my customer would be too impressed if every time they add a new item that they would then have to create another module in order to display the accompanying items.
Is there any way that this could be automated? So basically what I have is a top level item that has 3 info items attached to it...the main item is a shopping cart item (using K2mart).
Any input would be appreciated...hopefully I've explained myself clear enough but at this point i may have confused myself!
TIA