COMMUNITY FORUM
[SOLVED] Extra fields groups in different places
- Roman Lipatov
-
Topic Author
- Offline
- New Member
I have created 3 extra fields groups.
How I can place 1 group in the top of the template,
2 - in the middle,
and 3 at the bottom?
Thanks.
Please Log in or Create an account to join the conversation.
- Mohamed Abdelaziz
-
- Offline
- Platinum Member
- Joomla Developer
Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store
Please Log in or Create an account to join the conversation.
- Roman Lipatov
-
- Offline
- Premium Member
- Posts: 98
Is it already released?
Please Log in or Create an account to join the conversation.
- Mohamed Abdelaziz
-
- Offline
- Platinum Member
- Joomla Developer
Do you use a specific plugin to assign multiple groups to a category?
Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store
Please Log in or Create an account to join the conversation.
- Joe Campbell
-
- Offline
- Platinum Member
- Posts: 438
Another solution is to output each extra field individually, that way it does not matter what group each extra field is assigned to.
I personally prefer outputing extra fields in this manner, as it gives me a greater level of control.
Regards,
Joe Campbell
Please Log in or Create an account to join the conversation.
- Mohamed Abdelaziz
-
- Offline
- Platinum Member
- Joomla Developer
The point is how they will be managed in the item edit form, I think your solution is based on only one group for all the fields.
Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store
Please Log in or Create an account to join the conversation.
- Joe Campbell
-
- Offline
- Platinum Member
- Posts: 438
Roman stated "top of the template", so I assumed he was referring to the item template override file.
Regards,
Joe
Please Log in or Create an account to join the conversation.
- Roman Lipatov
-
- Offline
- Premium Member
- Posts: 98
But of course, it will be great to create subgroups in K2 with own aliases.
For example, category "Cars" have 1 assigned group, that contains 2 subgroups with aliases (Key Details, Installed Options)
So would be able to displays extrafields from subgroups separatly.
Something like this
$this->item->Subgroups->SubgroupsAlias->value
But I don't know, may be this feature already exist in K2 v.3 ?!
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
What you can do is use one group with multiple fields and echo these fields separately in your template.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
What you can do is use one group with multiple fields and echo these fields separately in your template.
Please Log in or Create an account to join the conversation.
- Kewwel Oliveira
-
- Offline
- New Member
- Posts: 7
Which code for this? I remember there was one that showed only the result of the field. I needed that exhibits the entire group.
prntscr.com/8k1w7k
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
One group per K2 category can only be assigned.
You can however render specific sets extrafields in our template
Please Log in or Create an account to join the conversation.
- Kewwel Oliveira
-
- Offline
- New Member
- Posts: 7
How to Display in a particular area, only one group?
I have 3 groups with 20 field types each, if I set this manually will take a lot of work.
I tried several times to edit the code of extra fields, but without success.
I believe that with this implement, we can have better templates to specific sites of real estate, cars and directories.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
<?php foreach ($this->item->extraFieldsGroups as $extraFieldGroup): ?>
<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 endforeach; ?>
As you can see each group is rendered sequentially.
You can check the groups's id and depending on the group's id render (or don't) the fields.
Please Log in or Create an account to join the conversation.
- Kewwel Oliveira
-
- Offline
- New Member
- Posts: 7
It is this part that I can not to set to display only one group and not three.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
Eg:
[/code]
<?php foreach ($this->item->extraFieldsGroups as $extraFieldGroup):
$extraFieldGroup->id == ID:
// Regular loop
endif;
endforeach;
?>
[/code]
Please Log in or Create an account to join the conversation.
- Kewwel Oliveira
-
- Offline
- New Member
- Posts: 7
I do correctly?
[/code]
<?php foreach ($this->item->extraFieldsGroups as $extraFieldGroup):
$extraFieldGroup->id == 2:
// Regular loop
endif;
endforeach;
?>
[/code]
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
Please Log in or Create an account to join the conversation.
- Kewwel Oliveira
-
- Offline
- New Member
- Posts: 7
I copied your code and just changed the ID for the group id. K2 kept the original code, but still did not work. I have 3 groups with id's 1-3.
I tried to use this: [code} <? Php echo $ extraFieldGroup [2];?> [/ Code]
I know I am abusing your good will, but what is the code ready to make this happen?
Excuses and thank you for your attention
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
<?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.