darkhoros VIP
Total posts: 152
18 May 2015 08:47

Hi, I am building a realestate website and trying to use coblat as my CCK. But I am running in to some problems regarding site structure

My plan is to have 2 types sell and rent and in every type I will have categories like villa, townhouse, apartment and so on, the thing is when I am selling or renting a villa the fields need to be diffrent, as for an apartment I need to spacify a floor number and if there is an elevator or not, these fields are not needed for a villa, but the current structure of cobalt dosenot allow such design as the fields are related to tyoes and not categories, or am I wrong.

So what can I do to have such a structure, where I can have a fields related to categories rather than types, or if any one can help with an idea for a better structure.

Help is highly appriciated. Thank you.

Last Modified: 22 May 2015


djsmooth5 VIP
Total posts: 5
18 May 2015 09:48

Hi Darkhoros

from inside your catagories on the details page there are post button type so you can either inhrit from section or define your own if you have created multiple types

thanks Damien Slick Web Services +27879438875

admin AT slickwebservices DOT co DOT za


Sergey
Total posts: 13,748
19 May 2015 16:42

You are right. Ther are 2 main concepts in CCK. One is bind additional fields to categories and other is to bind fields to content types. And those 2 represent 2 different types of mentality. In Cobalt you just have to think differently.

Here is what you can do.

Reverse Logic

Create 2 categories Rent and Sell and types villa, townhouse, apartment. This is simply reverce logic but it makes total sense to me.

Why not?

darkhoros as for an apartment I need to spacify a floor number and if there is an elevator or not, these fields are not needed for a villa

I do not think so. Sometimes you rent a room in the villa that is 3 floors hight. So nice to now the floor. Villa is stilla building. I think you could even create one universal type and simply let people skeep properties that are not applicable. You create one type Item and (villa, townhouse, apartment) is a select field inside that type.

That what I would recommend. ANd if you are tottaly fixed on deliting unwonted fields, you may modify form template and add some Javascript that will hide certain fields when (villa, townhouse, apartment) select is selected.


Guest
20 May 2015 06:45

hi, ok i like to go with reverse logic, how do i bind additional fields to categories.

thank you.


darkhoros VIP
Total posts: 152
20 May 2015 10:53

Hi, Dear sergey, it seems I am lost here, i have tried multiple plans to do what I need, my current plan as you suggest will be as follows, types for villas, lands, buildings, apartments and so on.

I will create one section with form submit from all created types, so I can chose villas ro lands ..etc each with its own fields. In side this section I will create 2 categories sale and rent, sounds good, right?

Will it is not, I ran in to a wall, as I will need to create common fileds that I need to apply to all types, such as owner name and item description, and location, and address and image, and some more, all these must be common between all types as all these fields are basic, and some fields will be uniqe for each type as for lands I will need plot area, for villas I will need swimming pool yes/no and so on.

So is there a way to do this, or should I start concidering a new approch?

Thank you for your continous support. Regadrs.


Jeff VIP
Total posts: 745
21 May 2015 09:46

Sergey Create 2 categories Rent and Sell and types villa, townhouse, apartment. This is simply reverce logic but it makes total sense to me.

Yes, I would use this approach too.

real estate

Since a type can have a unique submission form and article template, you have more flexibility in the category->type scenario because the types are lower in the hierarchy. Whereas in the type->category scenario your templating options are more limited.

Sergey also suggests you create a universal form with all possible fields. That is a good starting point. In my own application I have chosen to copy the same form each time with some small alterations when needed. If you use field_key values instead of field_id values in your templates, a common field that shares the same name accross types will be treated and recognised as one and the same field. This is very useful if you perform searches / filters.

The only caveat with multiple submission forms with unique and common fields, is that it can be quite elaborate to set up, so planning/mind mapping before you start is strongly advised.

Good luck!


darkhoros VIP
Total posts: 152
21 May 2015 12:44

Dear Jeff, I have to thank you for the detailed response, and for the time you spent putting your ideas together.

Pardon me asking, you said "copy the same form" how did you manage to do so?

Yes advice to use field_key... where exactly should I use that?

YOu said a submission form can have unique and common fields.. how can I do that?

It seems I am missing alot in cobalt and alot to learn.

Thank you alot.


pepperstreet VIP
Total posts: 3,837
21 May 2015 15:46

Hello darkhoros, just wanted to point out an important info about the terminology "common fields". Cobalt fields can't be shared or re-used in multiple types. Actually, you deal with real copies. Just make sure you keep the same field name/label in your types. This will have an important impact on sorting/filtering.


darkhoros VIP
Total posts: 152
21 May 2015 16:50

hello pepper, I am lost now, so what you mean by copy is create new field but with same name and same field type, so they are actully 2 fields not 1 shared field, so if I have 2 fields with type text for the name filed, how can I filter items based on 2 separate fields? Thank you.


Jeff VIP
Total posts: 745
21 May 2015 23:20

darkhoros Dear Jeff, I have to thank you for the detailed response, and for the time you spent putting your ideas together.

You are welcome :-)

darkhoros Pardon me asking, you said "copy the same form" how did you manage to do so?

http://docs.mintjoomla.com/en/cobalt/custom-templates-general/#make-templates-copies

darkhoros Yes advice to use field_key... where exactly should I use that?

http://docs.mintjoomla.com/en/cobalt/custom-templates-article/

darkhoros It seems I am missing alot in cobalt and alot to learn.> darkhoros

No worries. That is how everyone starts. Just remember: there are many ways to achieve the same result. The only way to really master something is by doing it. Just make mistakes and learn....

@pepperstreet You are as precise as always... :-)


Jeff VIP
Total posts: 745
21 May 2015 23:28

darkhoros so what you mean by copy is create new field but with same name and same field type, so they are actully 2 fields not 1 shared field

Correct

darkhoros how can I filter items based on 2 separate fields?

If they share the same name/label Cobalt treats them as the same field by giving them the same (auto generated) key_value.

Please try this concept first and find out that it really works.


Sergey
Total posts: 13,748
22 May 2015 04:32

@Jeff WOOOW!

darkhoros I will create one section with form submit from all created types, so I can chose villas ro lands ..etc each with its own fields. In side this section I will create 2 categories sale and rent, sounds good, right?

Right and not. I mean it is good but to be categoryless section would be the best. But this how i think. I would create section without categories and make Rent and Sell check box field. Why? First because some appartments are on sale but while it is not yet sold it is rented. Especialy appartments with short terms rent. Thus that would avoid user to add same appartment twice. Second, you can never see the list of Villas for example that are for sale AND for rent if those are difefrent categories.

Those 2 limitations goes away with fields instead of categories. At the same time user always may filter and see only rent or sell items.

darkhoros Will it is not, I ran in to a wall, as I will need to create common fileds that I need to apply to all types, such as owner name and item description, and location, and address and image, and some more, all these must be common between all types as all these fields are basic, and some fields will be uniqe for each type as for lands I will need plot area, for villas I will need swimming pool yes/no and so on.

As I have mentioned earlier, realestate is realestate not matter it is villa or condo. Like in your example condo also may have a swiming pool as appartment. It might be common swiming pool, but it is there. Some condos or even small hotels have plot area, some land that is attached to building where you can walk, excercise, ...

I would not do different types. I would do the same type and made "Type of realestat" field as checkbox (Villa, Condo, Appartment, ...) and Another field like "Item features" also checkbox (Private pool, Common Pool, Gym, Sunset view, Sea view, Great View, ...)

If there is something that is not for that item user just skip it no matter if it is fit to "Type of realestat" or not.

But it will create best expiriance for end user to search for property, you fill have less efforts to wrap it all up, It will work quicker and other advantagies.

But this is only a way I would do it personaly, not the way it have to be done. Of course other methods will work as great.

Powered by Cobalt