Keyword

Advanced Search

Search Results (Searched for: extra field order)

  • BitSirenDev
  • BitSirenDev's Avatar
26 Nov 2014 11:18
Replied by BitSirenDev on topic K2 Plugin Development - Dynamic Extra Field

K2 Plugin Development - Dynamic Extra Field

Category: English K2 Community

OK. Got around this project again. Still struggling here. However, this may help Abu Reviewer (the code in example.xml below does work if item category condition does not matter.)

We can render a form item only if item is of cat X. We can dynamically populate a form field. It is the actual combination dynamic field and displaying it only if the item in question is of type X.

So here is where we are:

example.xml
Used by itself, it successfully populates the field with the data we want and it also saves the data to the item correctly.
... <fields group="item-other"> <field name="videoURL_venue" type="sql" query="SELECT id, title FROM jos3_k2_items WHERE catid != '2'" multiple="single" key_field="id" value_field="title" class="inputbox" label="fieldlabel" description="fielddesc" required="true" /> </fields>

example.php
Renders the field only in items with catid 2. However, it does not save the selected option to the DB.
... function onRenderAdminForm(&$item, $type, $tab='') { $mainframe = &JFactory::getApplication(); $pluginParams = $this->params; /* Only Execute Code on Extra Field tab */ if($type=='item' && $tab=='other') { /* Only add field for event type */ $db = &JFactory::getDBO(); $query = 'SELECT id, title FROM #__k2_items WHERE `catid` <> 2 AND `trash` = 0 ORDER BY `title`'; $db->setQuery( $query ); $venueitems = $db->loadObjectList(); if($item->catid==2) { $form = "<select id='videoURL_venue'>"; if ($venueitems) { foreach ( $venueitems as $venue ) { $form .= "<option id='" . $venue->id ."'>" . $venue->title ."</option>"; } } $form .= "</select>"; $plugin = new JObject; $plugin->set('name', 'Whatever'); $plugin->set('fields', $form); return $plugin; } } }

I am sure we are approaching this from the wrong way in the example.php. Is there no option to load the plugin from config (XML) when certain conditions are met?

Next Question

Also, the onRenderAdminForm method as we have it only works if the item already exists, i.e. has a catid in the object. How can we achieve the same effect with new items? (Similar to Extra Fields is populated only after category is selected.)

Really looking for some help here.
Adrian
  • Lefteris
  • Lefteris's Avatar
24 Nov 2014 16:01

Extrafield - Drop down selection deleting values

Category: English K2 Community

@Justin Place

This cannot be changed. Even if you edit the order in phpMyAdmin you will lose the data entered on the items. Unfortunately there is nothing you can do about this.
  • hristo
  • hristo's Avatar
24 Nov 2014 14:29 - 24 Nov 2014 19:37

change display order of images? and remove filename..

Category: Simple Image Gallery

Hi. This last post didn't work /mby its old and there have been updates/ but it was very helpfull. I'm not a coder, but with some luck and most by guessing I got sucsess. I made it possible to change pics name.. Also when upload new pics in empty gallery they are named 01.jpg 02.jpg and etc. Then if u upload new pics in same gallery it checks the number of files in DIR and also checks the max number of file in DIR and starts the new uploaded image count from the biggest+1 of these two.. i did this to prevent overwriting of images.. if some pics are deleted, or some pics have text names.. couse u can change them with A, B, C if u want...

Here are my changes: /make backup.. i'm not PRO and can't guarantee/
Edit in administrator/components/com_sigpro/controllers/gallery.php, in public function save(), you will see a bunch of set state statements...add lines
$newfilenames = JRequest::getVar('newfilenames'); $model->setState('newfilenames', $newfilenames);

Then, in administrator/components/com_sigpro/models/gallery.php, around line 114, in public function upload(), before the line $result = JFile::upload($file, $path.'/'.$folder.'/'.JFile::makeSafe($filename)); add this:
$max = 0; $directory = $path.'/'.$folder.'/'; if (($dir = opendir($directory)) !== false) { while (($filenam = readdir($dir)) !== false) { $int = intval(basename($filenam)); if ($int > $max) { $max= $int; } } closedir($dir); } $filecount = count(glob($directory . "*")); $filename = $max + 1; if ($filecount>$filename ) {$filename = $filecount;} if(strlen($filename)==1){$filename="0".$filename;} $filename .=".jpg";
Important.. only for uploading JPG pictures.. ned some changes if u want to upload diferent types of images.

In same file some lines down is public function save().. here in function add:
$newfilenames= $this->getState('newfilenames');

and also some lines down replace the whole foreach ($files as $key => $file) with:
foreach ($files as $key => $file){ if ($newfilenames[$key] != strtok(pathinfo($file, PATHINFO_FILENAME), '-') ) { if(strlen($newfilenames[$key])==1){$newfilenames[$key]="0".$newfilenames[$key];} $character_array = array_merge(range(a, z), range(0, 9)); $string = ""; for($i = 0; $i < 6; $i++) { $string .= $character_array[rand(0, (count($character_array) - 1))]; } $newfilenames[$key] .= "-" .$string; rename($path.'/'.$folder.'/'.$file, $path.'/'.$folder.'/'.$newfilenames[$key].'.jpg' ); } }

In administrator/com_sigpro/views/gallery/tmpl/default.php, you'll see the spot where you can edit the image descript. and title...add this over title field:
<label>Filename</label> <input type="text" name="newfilenames[]" value="<?php echo intval(strtok(pathinfo($image->name, PATHINFO_FILENAME), '-'));
I use pathinfo to get rid of .jpg and so i cant accidently delete image type which removes it from gallery - we add this .jpg in public save function.

And finaly in same file.. some lines down.. we need to ad the Filename field also for the fresh uploaded pics. Again over title field add this
<label>Filename</label> <input type="text" class="sigProFilename" name="newfilenames[]" value=""/>
Here i could not remove .jpg from file name, but i didnt try much because if u refresh page or hit save button it removes .jpg and then u can easyly rearenge files....

Many thanks to Matthew Cowan
Sorry if my english or code language is bad!
Hope i didnt forgot some line :) .. ..
And agan i'm not a coder, and there are mby lots of mistakes.. so make backups befor u try it.. or if u can rewrite it and post it here.. it works for me great for the moment :)

Ops.. i found BUG.. reordering not working corectly.. Pictures was overriding one another.. it was logical :) so I add unique random key to file name separated by "-" so i can extract and show from filename only the number infront. Code is fixed.. .
  • Justin Place
  • Justin Place's Avatar
23 Nov 2014 11:22
Replied by Justin Place on topic Extrafield - Drop down selection deleting values

Extrafield - Drop down selection deleting values

Category: English K2 Community

Hi Krikor.

I am really Battling with these dropdown values.

Currently, My City-Town Dropdown ExtraField has multiple values and so does my Area-Suburb Extrafield.

If i have a new Town and suburb, the value goes right at the bottom right?

Well when i want to edit the DB table of the ExtraField to change the order to make it alphabetical, all the K2 items change to another value below it.

Any suggestions on how to remedy this for every time i want to add a new value alphabetically?
  • Krikor Boghossian
  • Krikor Boghossian's Avatar
18 Nov 2014 12:47
Replied by Krikor Boghossian on topic List itemsin category only if they contain a tag?

List itemsin category only if they contain a tag?

Category: English K2 Community

I think you got it wrong here Brian.
You might need to display tags based on categories.
By mapping certain tags to menu items you can limit the results to these views to certain categories/y .

As for events, I think you can do this for free with default K2 items (-1 extension, -extra load on your site).

You can handle all the dates with extrafields. You can use different ordering and a different template as well.
The only catch is that you would need a K2 plugin so you can have ordering by extrafields (for the dates).

Another way around it, would be that the created date is the event's date and the published date is the current day.
I think it is worth a try.
  • Justin Thomas
  • Justin Thomas's Avatar
14 Nov 2014 01:09 - 14 Nov 2014 01:09
Replied by Justin Thomas on topic Date filter on Category View

Date filter on Category View

Category: English K2 Community

Thank you for that suggestion. Sadly I have already been using most of that methodology for the past 4 years on this site. At present I have the date of the event as an extra field and use 'publish_down' to have k2 automatically remove the event from the front-end. The disadvantage of this is that the page, with all the work it has done for the SEO, disappears completely. This reason is also, sadly, why having the user move the event is not going to work. Firstly we're adding a website management step into the process, which is counter-intuitive, and secondly this would change the url from abc.zzz/events/werwer to abc.zzz/past-events/werwer and would, therefore, require a redirect to be implemented (2 new stages and many more admin sessions).

I am already using a core hack for this site as that puts the control of the "complex" aspects back in my hands. I update the site and can immediately check to see if my hack still works. The present hack is simple enough as all it does is exchange 'r_alpha' sorting to be 'publish_down' to give perfect ordering of the events.

I have already tried to utilise the K2Tools archive function to do this and succeeded in having it interrogate the db with publish_down the only problem was that the item had "expired". If I could find a way to cancel the expiry but leave the date in the database then I could use a custom SQL query to retrieve items moving forwards or backwards and then the items just stay exactly where they are, never unpublished, keeping their search engine ranking and increasing the number of landing pages for the site. Basically I need to simplify the system and then make unique SQL queries based off now (much like the function in K2Tools archive) to achieve the front-end results needed.

Any hints as to where the syntax is that unpublishes/expires an item?
  • Justin Place
  • Justin Place's Avatar
17 Oct 2014 15:36 - 17 Oct 2014 15:39
Replied by Justin Place on topic Edit form Iframe stays open

Edit form Iframe stays open

Category: English K2 Community

Hi Krikor, Just sent the contact form. Thanks,

Btw, i checked in my public_html folder, And thought there was no error_log file, but found it:

[17-Oct-2014 08:12:43 Africa/Johannesburg] PHP Strict Standards: Declaration of JParameter::loadSetupFile() should be compatible with that of JRegistry::loadSetupFile() in /home/borderle/public_html/libraries/joomla/html/parameter.php on line 512PHP Notice: Use of undefined constant JPATH_COMPONENT_ADMINISTRATOR - assumed 'JPATH_COMPONENT_ADMINISTRATOR' in /home/borderle/public_html/plugins/k2/incptvk2multipleextrafieldgroups/models/item.php on line 15

[17-Oct-2014 08:12:43 Africa/Johannesburg] PHP Strict Standards: Declaration of JParameter::loadSetupFile() should be compatible with that of JRegistry::loadSetupFile() in /home/borderle/public_html/libraries/joomla/html/parameter.php on line 512

  • Saju
  • Saju's Avatar
04 Oct 2014 11:50 - 04 Oct 2014 12:01
Replied by Saju on topic [Solved] K2 extra fields alignment

[Solved] K2 extra fields alignment

Category: English K2 Community

after making some changes in item.php i was able to bring the extra fields below the image but what i exactly need is to show the extra fields to the right of the image


Attachment not found





the code in item.php now is
<div id="container_div"> <div class="k2_image"> <?php if($this->item->params->get('itemImage') && !empty($this->item->image)): ?> <!-- Item Image --> <div class="itemImageBlock"> <span class="itemImage"> <a class="modal" rel="{handler: 'image'}" href="<?php echo $this->item->imageXLarge; ?>" title="<?php echo JText::_('K2_CLICK_TO_PREVIEW_IMAGE'); ?>"> <img src="<?php echo $this->item->image; ?>" alt="<?php if(!empty($this->item->image_caption)) echo K2HelperUtilities::cleanHtml($this->item->image_caption); else echo K2HelperUtilities::cleanHtml($this->item->title); ?>" style="width:<?php echo $this->item->imageWidth; ?>px; height:<?php echo $this->item->imageWidth; ?>px;" /> </a> </span> <?php if($this->item->params->get('itemImageMainCaption') && !empty($this->item->image_caption)): ?> <!-- Image caption --> <span class="itemImageCaption"><?php echo $this->item->image_caption; ?></span> <?php endif; ?> <?php if($this->item->params->get('itemImageMainCredits') && !empty($this->item->image_credits)): ?> <!-- Image credits --> <span class="itemImageCredits"><?php echo $this->item->image_credits; ?></span> <?php endif; ?> <div class="clr"></div> </div> <?php endif; ?></div> <div class="k2_extra_fields"> <?php if($this->item->params->get('itemExtraFields') && count($this->item->extra_fields)): ?> <!-- Item extra fields --> <div class="itemExtraFields"> <h3><?php echo JText::_('K2_ADDITIONAL_INFO'); ?></h3> <ul> <?php foreach ($this->item->extra_fields as $key=>$extraField): ?> <?php if($extraField->value != ''): ?> <li class="<?php echo ($key%2) ? "odd" : "even"; ?> type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>"> <?php if($extraField->type == 'header'): ?> <h4 class="itemExtraFieldsHeader"><?php echo $extraField->name; ?></h4> <?php else: ?> <span class="itemExtraFieldsLabel"><?php echo $extraField->name; ?>:</span> <span class="itemExtraFieldsValue"><?php echo $extraField->value; ?></span> <?php endif; ?> </li> <?php endif; ?> <?php endforeach; ?> </ul> <div class="clr"></div> </div> <?php endif; ?> </div> </div>

and in k2.css is
div.itemExtraFields {margin:16px 0 0 0;padding:8px 0 0 0;border-top:1px dotted #ddd;} div.itemExtraFields h3 {margin:0;padding:0 0 8px 0;line-height:normal !important;} div.itemExtraFields ul {margin:0;padding:0;list-style:none;} div.itemExtraFields ul li {align:right;display:block;} div.itemExtraFields ul li span.itemExtraFieldsLabel {display:block;float:left;font-weight:bold;margin:0 4px 0 0;width:30%;} div.itemExtraFields ul li span.itemExtraFieldsValue {} div.itemImageBlock {padding:8px;margin:0 0 16px 0;} span.itemImage {display:block;align:left;text-align:l;margin:0 0 8px 0;} span.itemImage img {border:1px solid #ccc;padding:8px;} span.itemImageCaption {color:#666;float:left;display:block;font-size:11px;} span.itemImageCredits {color:#999;float:right;display:block;font-style:italic;font-size:11px;}

i am using gantry framework template , so i have added some parts of thirdparty-k2.css
 body #k2Container.itemView .itemImageBlock{margin:0;padding:0;float:none;} body #k2Container.itemView .itemImage{margin:0;} body #k2Container.itemView .itemImage a.modal{position:inherit;margin:0;border:0;} body #k2Container.itemView .itemImage img{margin:10px 0 15px 0;padding:0;max-width:300px;width:100% !important;border:1px solid rgba(0,0,0,0.4);}

any one overhear please help me
  • Jc PlugnGeek
  • Jc PlugnGeek's Avatar
22 Sep 2014 18:20 - 22 Sep 2014 18:21
K2 search does not work (SQL error) was created by Jc PlugnGeek

K2 search does not work (SQL error)

Category: English K2 Community

Hi,

I have a new website with K2 and 1000 imported item from joomla content

Search engine is totally broken. I have this error :

Error: 1214 - The used table type doesn't support FULLTEXT indexes SQL=SELECT i.id, i.title AS 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 xxx_k2_items AS i INNER JOIN xxx_k2_categories AS c ON c.id=i.catid AND c.access IN(1,1,5) WHERE (MATCH(i.title, i.introtext, i.`fulltext`,i.extra_fields_search,i.image_caption,i.image_credits,i.video_caption,i.video_credits,i.metadesc,i.metakey) AGAINST ('+android*' IN BOOLEAN MODE) ) AND i.trash = 0 AND i.published = 1 AND i.access IN(1,1,5) AND c.published = 1 AND c.access IN(1,1,5) AND c.trash = 0 AND ( i.publish_up = '0000-00-00 00:00:00' OR i.publish_up <= '2014-09-22 15:18:27' ) AND ( i.publish_down = '0000-00-00 00:00:00' OR i.publish_down >= '2014-09-22 15:18:27' ) GROUP BY i.id ORDER BY i.created DESC LIMIT 0, 50

website: www.plugngeek.net/newpng/

K2 Version: 2.6.8
Joomla version : 3.3.x

Database is not modified.
  • Krikor Boghossian
  • Krikor Boghossian's Avatar
19 Sep 2014 13:55
Replied by Krikor Boghossian on topic Extra Fields - Reordering Drop-Down Selection list

Extra Fields - Reordering Drop-Down Selection list

Category: English K2 Community

I think you should post this a job, Although with minimal coding skills this is not difficult to do manually. (But do backup first :) )
  • Seth Fischer
  • Seth Fischer's Avatar
19 Sep 2014 05:37
Replied by Seth Fischer on topic Extra Fields - Reordering Drop-Down Selection list

Extra Fields - Reordering Drop-Down Selection list

Category: English K2 Community

Thanks for the reply.

This makes sense. So, I could have someone write a me script that I could run on the database to periodically sort the Drop-down Selection list?

Seth
  • Krikor Boghossian
  • Krikor Boghossian's Avatar
18 Sep 2014 13:10
Replied by Krikor Boghossian on topic Extra Fields - Reordering Drop-Down Selection list

Extra Fields - Reordering Drop-Down Selection list

Category: English K2 Community

Hello Seth,

I am sorry but this is not possible from the backend.
The only way that this would be possible it would be from the DB

They are stored in a json format in the xx__k2_extra_fields table.
  • Seth Fischer
  • Seth Fischer's Avatar
18 Sep 2014 05:55

Extra Fields - Reordering Drop-Down Selection list

Category: English K2 Community

Hi All,

I have a list of about 200 brands in an Extra Field Drop-down selection. They were entered in alphabetical order. When I add more items, they are at the end of the list and not alphabetical. How do I resort the list?

Thanks,

Seth
  • Kevin
  • Kevin's Avatar
08 Sep 2014 17:47

Is there a way to manage extra fields on categorie

Category: English K2 Community

Hello,

I need to attache extra fields on category levels in order to display them on the category.php e.g.: text blocks, images, links, etc.

Is it something possible ?

K2 version : 2.6.7
  • Astrid Pedersen
  • Astrid Pedersen's Avatar
30 Aug 2014 15:37
Replied by Astrid Pedersen on topic Custom display extra fields

Custom display extra fields

Category: English K2 Community

Okay. I got some help from a friend. Here's how far it got us (if anyone should wonder).

In order to have the extra fields displayed independently, you need to split them up. So replace the "foreach ..." line in you item.php with this:

<!-- START: Call to prepare extra fields -->
<?php
//convertArray to use ids as key
$extrafields = array();
foreach($this->item->extra_fields as $item)
{
$extrafields[$item->id] = $item->value;
}
?>
<!-- END: Call to prepare extra fields -->

Then, to call the extra field you need in, do this:

<?php if(isset($extrafields[*X*]) === true):?>
<?php echo $extrafields[*X*]; ?>
<?php endif; ?>

Where *X* is the numeric ID of the extra field.

Now here comes the fun part. I wanted to create a 1-6 stars rating system for my client who is a music journalist. He should be able to select a rating from a dropdown, and this value should be displayed as stars in the item view.

I decided to use the css and sprite based article rating system which comes with K2 - then I could "recycle" the nice star images and the css already created.

Heres how it looks:

<?php if(isset($extrafields[3]) === true):?>

<ul class="itemRatingList">
<li class="itemCurrentRating" id="itemCurrentRating<?php echo $this->item->id; ?>" style="width:<?php echo round($extrafields[3]*100/6); ?>%;"></li>
<li><?php if(isset($extrafields[3]) == 1):?><a href="#" title="<?php echo JText::_('K2_1_STAR_OUT_OF_5'); ?>" class="one-star">1</a></li><?php endif; ?>
<li><?php if(isset($extrafields[3]) == 2):?><a href="#" title="<?php echo JText::_('K2_2_STARS_OUT_OF_5'); ?>" class="two-stars">2</a></li><?php endif; ?>
<li><?php if(isset($extrafields[3]) == 3):?><a href="#" title="<?php echo JText::_('K2_3_STARS_OUT_OF_5'); ?>" class="three-stars">3</a></li><?php endif; ?>
<li><?php if(isset($extrafields[3]) == 4):?><a href="#" title="<?php echo JText::_('K2_4_STARS_OUT_OF_5'); ?>" class="four-stars">4</a></li><?php endif; ?>
<li><?php if(isset($extrafields[3]) == 5):?><a href="#" title="<?php echo JText::_('K2_5_STARS_OUT_OF_5'); ?>" class="five-stars">5</a></li><?php endif; ?>
<li><?php if(isset($extrafields[3]) == 6):?><a href="#" title="<?php echo JText::_('K2_6_STARS_OUT_OF_5'); ?>" class="six-stars">6</a></li><?php endif; ?>
</ul>

<?php endif; ?>

When I at some point can manage to get my hands down, I will look into replacing the a tags with span or something. But now it works.

Best regards,

Astrid
  • Juan
  • Juan's Avatar
14 Aug 2014 20:58

Error after install K2 import extension Joomla3.3.

Category: English K2 Community

Hi all,

After install K2import commercial extension

I have this error code:

k2_categories' doesn't exist SQL=SELECT c.*, g.title AS groupname, exfg.name as extra_fields_group FROM mba3i_k2_categories as c LEFT JOIN mba3i_viewlevels AS g ON g.id = c.access LEFT JOIN mba3i_k2_extra_fields_groups AS exfg ON exfg.id = c.extraFieldsGroup WHERE c.id>0 AND c.trash=0 ORDER BY c.ordering

Anyone help me with this issue,

Regards,


Juan
  • Stas
  • Stas's Avatar
14 Aug 2014 12:34
  • Leonard
  • Leonard's Avatar
30 Jul 2014 01:01 - 30 Jul 2014 01:05
How to style a specific extra field? was created by Leonard

How to style a specific extra field?

Category: English K2 Community

Hi,

I am going to start by bringing to your attention the fact that I am not very confident in building a web site. However, I am trying my best in order to achieve what I want :) .
At this point I am stacked in customising a specific extra field.
My intention is to create a similar look with the one you can find at www.reed.co.uk/jobs
If you’ll have a look to the following page on my web site www.chesteradvisor.co.uk/index.php/component/jak2filter/?Itemid=949&jakeyword=&btnSubmit=SEARCH, you will see listed 2 jobs. I want to do some tests in the first one: Finance Ledger Manager. I am interested to display the extra fields on the top of the listing and another extra field containing the logo of the company on the right of them.
How can I style a specific extra field (the one with logo) in order to be displayed on the right of the other extra fields?
Second, how can I display the all extra field on the top of the article not in the bottom, in the exact way are displayed on the reeds website?
I have also prepared on Photoshop an image of haw I want them to look, in order to get even a clearer picture of what I want to achieve, but for some reason, I cannot uploaded it. I will try again latter.

Thank you very much for your help.
  • Joe Campbell
  • Joe Campbell's Avatar
28 Jul 2014 21:48
Feature Request: K2 v3 was created by Joe Campbell

Feature Request: K2 v3

Category: English K2 Community

Please consider providing the ability to reorder Extra Fields display on Item Submit/Edit page. Thanks
  • Krikor Boghossian
  • Krikor Boghossian's Avatar
25 Jul 2014 13:20
Replied by Krikor Boghossian on topic Logo area dimensions and text style in slideshow

Logo area dimensions and text style in slideshow

Category: Commercial Joomla Templates

Sorry I mislead you on my previous post.
The title is also an extrafield.

To have the item's title mimick the extrafield, insert this in your custom.css file.
.slideshow a.moduleItemTitle { font-family: 'Titillium Web', serif; float: right; text-align: right; text-shadow: 0 1px 1px rgba(0,0,0,0.33); -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; max-width: 700px; background: rgba(243, 235, 1, 0.9); margin: 0 0 10px; font-size: 45px; letter-spacing: -1px; font-weight: 400; line-height: 1em; display: inline-block; padding: 8px 20px; }

You can also use the extrafield if you want your item to have a different title in the slideshow.
Displaying 161 - 180 out of 530 results.

Powered by Kunena Forum