Keyword

[SOLVED] Extra fields groups in different places

  • Roman Lipatov
  • Roman  Lipatov's Avatar Topic Author
  • Offline
  • New Member
More
9 years 8 months ago - 9 years 8 months ago #146647 by Roman Lipatov
Hi!

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.
Last edit: 9 years 8 months ago by Roman Lipatov.

Please Log in or Create an account to join the conversation.

  • Mohamed Abdelaziz
  • Mohamed Abdelaziz's Avatar
  • Offline
  • Platinum Member
  • Joomla Developer
More
9 years 8 months ago #146654 by Mohamed Abdelaziz
Replied by Mohamed Abdelaziz on topic Extra fields groups in different places
Are you using K2 V3?

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.

More
9 years 8 months ago #146655 by Roman Lipatov
Replied by Roman Lipatov on topic Extra fields groups in different places
No...
Is it already released?

Please Log in or Create an account to join the conversation.

  • Mohamed Abdelaziz
  • Mohamed Abdelaziz's Avatar
  • Offline
  • Platinum Member
  • Joomla Developer
More
9 years 8 months ago #146656 by Mohamed Abdelaziz
Replied by Mohamed Abdelaziz on topic Extra fields groups in different places
You can download development version anyway.

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.

More
9 years 8 months ago #146657 by Joe Campbell
Replied by Joe Campbell on topic Extra fields groups in different places
Hi Roman & Mohamed,

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
  • Mohamed Abdelaziz's Avatar
  • Offline
  • Platinum Member
  • Joomla Developer
More
9 years 8 months ago #146659 by Mohamed Abdelaziz
Replied by Mohamed Abdelaziz on topic Extra fields groups in different places
Hi Joe,

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.

More
9 years 8 months ago #146660 by Joe Campbell
Replied by Joe Campbell on topic Extra fields groups in different places
Hi Mohamed,

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.

More
9 years 8 months ago - 9 years 8 months ago #146661 by Roman Lipatov
Replied by Roman Lipatov on topic Extra fields groups in different places
Ok, thanks. I use aliases to separate extrafields.
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 ?!
Last edit: 9 years 8 months ago by Roman Lipatov.

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 8 months ago #146676 by Krikor Boghossian
Replied by Krikor Boghossian on topic Extra fields groups in different places
K2 v2.x does support multiple groups.
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
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 8 months ago #146677 by Krikor Boghossian
Replied by Krikor Boghossian on topic Extra fields groups in different places
K2 v2.x does support multiple groups.
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.

More
9 years 7 months ago #147755 by Kewwel Oliveira
Replied by Kewwel Oliveira on topic [SOLVED] Extra fields groups in different places
How to display separate groups on the item page?
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
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 7 months ago #147768 by Krikor Boghossian
Replied by Krikor Boghossian on topic [SOLVED] Extra fields groups in different places
You cannot actually.
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.

More
9 years 5 months ago #149592 by Kewwel Oliveira
Replied by Kewwel Oliveira on topic [SOLVED] Extra fields groups in different places
I forgot to mention that I'm using k2v3.

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
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 5 months ago #149608 by Krikor Boghossian
Replied by Krikor Boghossian on topic [SOLVED] Extra fields groups in different places
<?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.

More
9 years 5 months ago #149615 by Kewwel Oliveira
Replied by Kewwel Oliveira on topic [SOLVED] Extra fields groups in different places
Yes, I am using this code. Where it that I set the group id? I am newbie php, sorry.
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
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 5 months ago #149629 by Krikor Boghossian
Replied by Krikor Boghossian on topic [SOLVED] Extra fields groups in different places
Checking $extraFieldGroup->id == ID will do the trick.

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.

More
9 years 5 months ago #149642 by Kewwel Oliveira
Replied by Kewwel Oliveira on topic [SOLVED] Extra fields groups in different places
I inserted this code, but not works. I changed ID for 2 ( ID of group).
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
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 5 months ago #149656 by Krikor Boghossian
Replied by Krikor Boghossian on topic [SOLVED] Extra fields groups in different places
This is just a dummy code, if you entered the correct code (proper if/ then/ else) then it should work fine.

Please Log in or Create an account to join the conversation.

More
9 years 5 months ago #149663 by Kewwel Oliveira
Replied by Kewwel Oliveira on topic Extra fields groups in different places
Excuse me Krikor, but as I said earlier I am new to php and still do not understand anything, so the difficulty. My strong it is only css.
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
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 5 months ago #149675 by Krikor Boghossian
Replied by Krikor Boghossian on topic Extra fields groups in different places
This is the code that you should use:
<?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.


Powered by Kunena Forum