Keyword

Extra Fields more Columns...

  • Periklis
  • Periklis's Avatar Topic Author
  • Offline
  • New Member
More
12 years 1 month ago - 12 years 1 month ago #110975 by Periklis
Extra Fields more Columns... was created by Periklis
Hello,
i am new to the community, not new to joomla ;)

I have to admit that K2 is an excellent tool that keeps things organized.

I create a website that is about Heat and Cool Systems. There are a lot of categories and of course a lot of items (products) inside them. Every item (product) has specifications like the Tank Capacity, Working Autonomy etc. So far so good...

A lot of these items (products) has different versions. That is to say, there is An Item that has 3 models. First model 10KW, second model 20KW and the third one 30KW.

We are thinking that would be better to have one item (product) and having the Extra Fields (as specifications) in four columns like the example below.

Specifications10KW20KW30KW
Tank Capacity (Kg)405060
Working Autonomy (h)506070
Voltage (Volt)220220220

Is this a way to accomplished that, using extra fields of course, in oder to avoid building an HTML table in Content area...

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

  • Mohamed Abdelaziz
  • Mohamed Abdelaziz's Avatar
  • Offline
  • Platinum Member
  • Joomla Developer
More
12 years 1 month ago #110976 by Mohamed Abdelaziz
Replied by Mohamed Abdelaziz on topic Re: Extra Fields more Columns...
I think this is possible, by using multiselect/checkbox fields as sepcifications.

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.

  • Periklis
  • Periklis's Avatar Topic Author
  • Offline
  • New Member
More
12 years 1 month ago #110977 by Periklis
Replied by Periklis on topic Re: Extra Fields more Columns...
Thank you for the reply, but i am afraid you misunderstand my issue. I need a way to show all three columns to the front end not a way to have multiple choices in back end for the administrator.

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

  • Mohamed Abdelaziz
  • Mohamed Abdelaziz's Avatar
  • Offline
  • Platinum Member
  • Joomla Developer
More
12 years 1 month ago #110978 by Mohamed Abdelaziz
Replied by Mohamed Abdelaziz on topic Re: Extra Fields more Columns...
The way to show three columns is to use template overrides feature of K2.

You can diplay extra fields by alias in the template file like this:
$this->item->extraFields->alias

If you think this is not something you can't do and need paid work, I can help to implement this for a fair price.

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.

  • Periklis
  • Periklis's Avatar Topic Author
  • Offline
  • New Member
More
12 years 1 month ago #110979 by Periklis
Replied by Periklis on topic Re: Extra Fields more Columns...
I am afraid this is not only appearance issue. It is more complicated. The administrator should have the option to add extra columns in the item editing options and these extra options should be saved in database.

The how-to procedure in order to appear these options from the database, seems more easy to be accomplished.

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

  • Mohamed Abdelaziz
  • Mohamed Abdelaziz's Avatar
  • Offline
  • Platinum Member
  • Joomla Developer
More
12 years 1 month ago #110980 by Mohamed Abdelaziz
Replied by Mohamed Abdelaziz on topic Re: Extra Fields more Columns...
Hi,

My imagination for how to implement the example you explained in the first post is:

For each one from the first column, you will create a multiselect field, with all the probable values it can have.

Then, while editing, choose the appropriate values for each field, and save.

At the frontend, you will display each field by alias as described before, and you will need to separate its values to show them one by one in a table for example.

Does it make sense for you?

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.

  • Periklis
  • Periklis's Avatar Topic Author
  • Offline
  • New Member
More
12 years 1 month ago #110981 by Periklis
Replied by Periklis on topic Re: Extra Fields more Columns...
Thank you for your time and patience my friend.

If i have understand you well, you say to enter for example the three values in a multiselect element and at front end to show all three values in the same order side by side.
It's clever enough.

I am trying to figure out a way to save an extra column of extraFields in database but i have difficulties to read the values back from database...

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

  • Mohamed Abdelaziz
  • Mohamed Abdelaziz's Avatar
  • Offline
  • Platinum Member
  • Joomla Developer
More
12 years 1 month ago #110982 by Mohamed Abdelaziz
Replied by Mohamed Abdelaziz on topic Re: Extra Fields more Columns...
No problem Periklis.

I don't know why do you need the additional extrafield column in the database, but I want to say that k2 extrafields are not saved directly in the database, they are converted to JSON format before saving.

According to MVC pattern, you will find the database manipulation in the model classes, which are inside the directories components/com_k2/models and administrator/components/com_k2/models

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.

  • Periklis
  • Periklis's Avatar Topic Author
  • Offline
  • New Member
More
12 years 1 month ago #110983 by Periklis
Replied by Periklis on topic Re: Extra Fields more Columns...
That's why i have a headache... :sick:

I am searching the way i can read or write the extrafields in database, two days now. I need an extra column, for example "extrafields2", in order to save the extra column of specifications.
(as i described above, i need two columns of extra fields, for the same item. Not multiple choices and select one of them. I need 3 choices and i need to show all the three values simultaneous)

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

  • Periklis
  • Periklis's Avatar Topic Author
  • Offline
  • New Member
More
12 years 1 month ago #110984 by Periklis
Replied by Periklis on topic Re: Extra Fields more Columns...
To help better understanding, i upload an image of Extra Field area in item editing, trying to visualize what i am trying to do...

(The fields name are in Greek)
Attachments:

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

  • Mohamed Abdelaziz
  • Mohamed Abdelaziz's Avatar
  • Offline
  • Platinum Member
  • Joomla Developer
More
12 years 1 month ago #110985 by Mohamed Abdelaziz
Replied by Mohamed Abdelaziz on topic Re: Extra Fields more Columns...
Its obvious now, and I'm sure it can be implemented by multiselect fields.

I recommend to use the available features to be able to update K2 in the future, your suggession will make updating K2 a headache when a new version released.

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.

  • Periklis
  • Periklis's Avatar Topic Author
  • Offline
  • New Member
More
12 years 1 month ago #110986 by Periklis
Replied by Periklis on topic Re: Extra Fields more Columns...
The update thing is something that i think very seriously. You are absolutely right and thank you for that.

I am thinking the multiselect solution, but i find out some serious difficulties.

It seems that every item that needs more columns in extra fields, needs all extra fields to be rewritten.
Let's take an example.
We have item1, with an extra field called "Color". The "Color" is multiselect and has three values, RED, BLACK, WHITE.
If we need another item, called item2 and let's say that we need the extra field "Color", with three different values, BLUE, WHITE, GREEN.

In this case and every similar case, the administrator should create extra field "Color", assign to different group and write the values for this color.

We must consider the case that an item may have only one Color and the programming for the front end should be only once and i cannot change the php code every time they change or create a new item.

That is to say, i have to think about flexibility.

How flexible is it with your suggestion ?

P.S. Mohamed, your help is priceless. Thank you very much for your advice and your time spending.

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

  • Mohamed Abdelaziz
  • Mohamed Abdelaziz's Avatar
  • Offline
  • Platinum Member
  • Joomla Developer
More
12 years 1 month ago #110987 by Mohamed Abdelaziz
Replied by Mohamed Abdelaziz on topic Re: Extra Fields more Columns...
No problem Periklis :)
I'm loving K2 and like such discussions.

Anyway, your example is very good to clarify mu proposed solution.

Please have a look at the multiselect field type and how it works.

If you have a multiselect field for the Color, its values will be all propable colors you can select for an item, so it will have RED, BLACK, WHITE, BLUE, GREEN... and so on.

For Item1 one, you will select RED, BLACK, WHITE for The Color field
For Item2 you will select BLUE, WHITE, GREEN
If any other item have only one color, you can select one color.
I don't think there will be a problem at the backend while you add/edit items.

All the tricky work will be at the frontend, and this is normal because each website has its private look&feel and its own presentation way.

When you customize the templates of K2, this will not break K2 maintainability, K2 will be updated seamlessly.

In fact the work at frontend has a lot of details and can't be disucssed here.
Anyway, I can help to complete this project for a fair cost.

You welcome anytime.

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.

  • Periklis
  • Periklis's Avatar Topic Author
  • Offline
  • New Member
More
12 years 1 month ago #110988 by Periklis
Replied by Periklis on topic Re: Extra Fields more Columns...
Mohamed,
your guides help me a lot and i have make some progress. But as i work in the way you propose, other problems have been arrived. Just to ask for your opinion, i try to describe what's the problem now.

Let's take an example as before and suppose that we have an extra field, multiselect and three values, 10, 20, 30.

An item has this extra field and its values with this order. 10, 20, 30.
An other item has also this extra field and the same values but with different order. 20, 10, 30.
And so on... But we can stay at this example and take another case that an item has this extra field and the values are 10, 10, 20.

Hmm, i don't know if i successfully explain these two special but not rare situations. What do you think that we can do to bypass these unpleasant situations ?

I attach a screenshot of the multiselect fields.
Attachments:

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

  • Mohamed Abdelaziz
  • Mohamed Abdelaziz's Avatar
  • Offline
  • Platinum Member
  • Joomla Developer
More
12 years 4 weeks ago #110989 by Mohamed Abdelaziz
Replied by Mohamed Abdelaziz on topic Re: Extra Fields more Columns...
Hello Periklis

Realy, the case you described is a problem, because ordering of mutliselect values is not supported.

But, I think this can be handled by using text fields instead of multiselect fields, and to use a separator like "|" or "," between the values.
And the the template, you will use php explode function to display each value in a separate column.

The multiselect fields scenario allows to use these value as filters or search criteria if this is required, but You can't order them differently for each item.

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.

  • Periklis
  • Periklis's Avatar Topic Author
  • Offline
  • New Member
More
12 years 4 weeks ago #110990 by Periklis
Replied by Periklis on topic Re: Extra Fields more Columns...
You are absolutely right Mohamed.

Today morning, i thought this way out. I have some problems with the server now but i try it right away when the server comes back again...

Thanks for one more time...

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


Powered by Kunena Forum