- Posts: 5
- Thank you received: 0
I need to display specific group extrafield
- petekan
- Topic Author
- Offline
- New Member
-
Less
More
10 years 7 months ago #1825
by petekan
I need to display specific group extrafield was created by petekan
Hello all:
I need to display only an specific extrafield group in k2 category view (named "common") and the rest of extrafield groups in the item view.
How do i do it???
Thank you all.
I need to display only an specific extrafield group in k2 category view (named "common") and the rest of extrafield groups in the item view.
How do i do it???
Thank you all.
Please Log in or Create an account to join the conversation.
- mmmaug1977
-
- Offline
- Moderator
-
10 years 7 months ago #1826
by mmmaug1977
Replied by mmmaug1977 on topic I need to display specific group extrafield
Hello Jose,
The below code was developed to display extrafields by group, you can use it with a little customization to display extrafields of a specific group with its group id:
The below code was developed to display extrafields by group, you can use it with a little customization to display extrafields of a specific group with its group id:
Code:
<?php if($this->item->params->get('itemExtraFields') && count($this->item->extra_fields)): ?>
<!-- Item extra fields -->
<div class="itemExtraFields">
<?php
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select("*")->from("#__k2_extra_fields_groups");
$db->setQuery($query);
$groups = $db->loadObjectList('id');
$extraFieldsByGroup = JArrayHelper::pivot($this->item->extra_fields, 'group');
foreach ($extraFieldsByGroup as $groupId => $groupFields){
?>
<h3><?php echo $groups[$groupId]->name; ?></h3>
<ul>
<?php foreach ($groupFields 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>
<?php } ?>
</div>
<?php endif; ?>
The following user(s) said Thank You: petekan
Please Log in or Create an account to join the conversation.
- petekan
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 5
- Thank you received: 0
10 years 7 months ago #1827
by petekan
Replied by petekan on topic I need to display specific group extrafield
OK. Thank you very much.
Please Log in or Create an account to join the conversation.
- petekan
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 5
- Thank you received: 0
10 years 7 months ago #1828
by petekan
Replied by petekan on topic I need to display specific group extrafield
Hello again:
One more question about extrafields. Now I need to display only two specific fields from a group of extrafields. Is it possible??
Thank you very very much, Mohamed.
One more question about extrafields. Now I need to display only two specific fields from a group of extrafields. Is it possible??
Thank you very very much, Mohamed.
Please Log in or Create an account to join the conversation.
- mmmaug1977
-
- Offline
- Moderator
-
10 years 7 months ago #1829
by mmmaug1977
Replied by mmmaug1977 on topic I need to display specific group extrafield
Hello Jose,
Yes it is possible using the field alias, like this example:
Replace 'FieldAlias' with the field alias you want to display.
Yes it is possible using the field alias, like this example:
Code:
<?php
echo $this->item->extraFields->FieldAlias->value;
?>
The following user(s) said Thank You: petekan
Please Log in or Create an account to join the conversation.
- petekan
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 5
- Thank you received: 0
10 years 7 months ago #1830
by petekan
Replied by petekan on topic I need to display specific group extrafield
It's really great !!!
Thank you very very much, Mohamed.
Thank you very very much, Mohamed.
Please Log in or Create an account to join the conversation.
- mmmaug1977
-
- Offline
- Moderator
-
10 years 7 months ago #1831
by mmmaug1977
Replied by mmmaug1977 on topic I need to display specific group extrafield
You are welcome!
If you want, you can post a review to JED: extensions.joomla.org/extensions/extensi...fields-groups-for-k2
If you want, you can post a review to JED: extensions.joomla.org/extensions/extensi...fields-groups-for-k2
Please Log in or Create an account to join the conversation.
- petekan
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 5
- Thank you received: 0
10 years 7 months ago - 10 years 7 months ago #1842
by petekan
Replied by petekan on topic specific group extrafield in k2 content module
Hello, it's me again:
Now I have the content as I wanted, but now I do the same with the k2 content module to display only selected extra fields (now all extra fields are displayed), and i need to show in three responsive columns (3 for computers / tablets, 1 for smartphones). Please tell me how much it cost me can you make this modification in the module.
Thanks in advance.
Now I have the content as I wanted, but now I do the same with the k2 content module to display only selected extra fields (now all extra fields are displayed), and i need to show in three responsive columns (3 for computers / tablets, 1 for smartphones). Please tell me how much it cost me can you make this modification in the module.
Thanks in advance.
Last edit: 10 years 7 months ago by petekan.
Please Log in or Create an account to join the conversation.
- mmmaug1977
-
- Offline
- Moderator
-
10 years 7 months ago #1843
by mmmaug1977
Replied by mmmaug1977 on topic specific group extrafield in k2 content module
Hello Jose,
Please send the url of your website, and if it is possible send backend access as well, to be able to estimate the cost.
Please send them via the contact us form.
Please send the url of your website, and if it is possible send backend access as well, to be able to estimate the cost.
Please send them via the contact us form.
Please Log in or Create an account to join the conversation.
- kewwel
- Offline
- New Member
-
Less
More
- Posts: 5
- Thank you received: 0
9 years 3 months ago #2118
by kewwel
Replied by kewwel on topic I need to display specific group extrafield
Do you have an updated code to display only a certain group?
I have a imobiliaria project and need groups in different places.
I had gotten a code with Krikor K2, but no longer works.
I have a imobiliaria project and need groups in different places.
I had gotten a code with Krikor K2, but no longer works.
Code:
<?php foreach ($this->item->extraFieldsGroups as $extraFieldGroup): ?>
<?php if($extraFieldGroup->id == 2): ?>
<h4><?php echo $extraFieldGroup->name; ?></h4>
<ul>
<?php foreach ($extraFieldGroup->fields as $key=>$extraField): ?>
<?php if($extraField->output): ?>
<li class="<?php echo ($key%2) ? "odd" : "even"; ?> type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>">
<span class="itemExtraFieldsLabel"><?php echo $extraField->name; ?>:</span>
<span class="itemExtraFieldsValue"><?php echo $extraField->output; ?></span>
</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php endforeach; ?>
Please Log in or Create an account to join the conversation.