11 Posts
jimie
8 years ago
15
Topic

Hello,

Is it possible with Seblod to create a country/city field, and allow me to add multi countries, cities for a record ? Like that listing may be available in different countries and cities.

If so what field do I need to use to achieve that ?

Regards

Get a VIP membership
1283 Posts
Bucklash
8 years ago
5
Level 1

Hi

The first choice with Seblod would be to use 'field x'

ie Create a text field ('my_city_field') with storage set to none

create a field x field ('my_city_fieldx') referencing the text field and set storage to "custom | article | my_city_fieldx[my_city_field]

quite a few tutorials on it

Plus, it also depends on whether the cities are from a predefined list and what sort of funky things you want to do with the cities once stored....

11 Posts
jimie
8 years ago
4
Level 2

Hello Bucklash,


Thanks for your reply, I tried that, but seams when using "Address to Coordinates" field, for fieldx at "Field" area, when submitting, when I click "+" button the google live search for city,country is not working for the next field, it only seams to be working if I set "Default" to lets say 4. Any idea ?

Rgds

1283 Posts
Bucklash
8 years ago
0
Level 3

Hi

Never user that field.  Erm.... don't know, sorry

4229 Posts
Kadministrator
8 years ago
2
Level 3

I don't think address to coordinates field will work in fieldX, in fact any field that sues javascript to do it's job is likely to have a problem (tags, select cascade etc.)

11 Posts
jimie
8 years ago
1
Level 4

Outch :( same limitation on Seblod then :( no CCK on the market can allow you to have listings with more the 1 country / 1 city. Any plans for this in future ?

Is like this your company can have offices in UK, France, Italty etc.. none tough about this ?

Rgds

11 Posts
jimie
8 years ago
0
Level 5

@Klas any suggestion ? Can I achieve that ?

251 Posts
Viktor Iwan
8 years ago
6
Level 1

Do you actually need Google Maps feature ? i would suggest you to use groupX, but it really depend if you need to have a list for country/city.. groupX has limitation for this due the custom seblod format.. because data stored on the intro text field, i don't think you can make a list for each country/city

11 Posts
jimie
8 years ago
5
Level 2

What I'd like to achieve is:

Country - City

When you select country, then show the cities corresponding to that country, and also to be able to filter listings using country / city as filter.

And with ability to insert multiple country/city per listing

rgds

1283 Posts
Bucklash
8 years ago
4
Level 3

Hi

Would this do it (I currently do something similar)?

Each country is a category 

Each city is an article content type (ie #__cck_store_form_city) in whuch the appropriate catid would be set.

In the 'business' content type add a fieldx to store references to countries id and another to reference cities id.


In the business form you can add a button to create a new country, and another button to add a new city....

If that is close I can post more info if it helps

11 Posts
jimie
8 years ago
3
Level 4

Thanks guys for sharing your ideas, @Bucklash unfortunately that's not what I want, people always ignore what you tell them, and they are always tempted to write city/country names in their own language => ugly names and confusing

That why I'd like to make a predefine db of countries and their corresponding cities but to be able to add multiple county/city per listing.

Rgds

251 Posts
Viktor Iwan
8 years ago
2
Level 5

Well, in that case: 

Yes, you can build such solution with seblod
No, it's not "out of the box" solution, you'll have to write some code for a custom plugin

May i know how's your confidence level to code custom field for seblod ?

"And with ability to insert multiple country/city per listing" <- this is something you like to avoid isn't ?

11 Posts
jimie
8 years ago
1
Level 6

Hello Vik,

I have some basic code knoewledge, that's why I want to use a CCK :) never wrote a Seblod plugin.

  • "And with ability to insert multiple country/city per listing" <- this is something you like to avoid isn't ?

That's most important, having ability to select multiple county/city per listing

Rgds

1283 Posts
Bucklash
8 years ago
0
Level 7

Hi

If you were doing just one entry then select dynamic cascade would be ideal ie select the city based upon the previously selected country, but doing multiple with fieldx could cause issues with  javascript (maybe, not tried).

you could do select dynamic cascade and have 10 in your form that the user could fill in. in db you would have 10 columns ie city_1, city_2 etc

You could apply javascript to show only the first field, then if it is filled, show the next etc.... 

(That is the same idea as conditionals but I don't have much luck with those).

Jon 

4229 Posts
Kadministrator
8 years ago
1
Level 1

I think easiest way to do this is to use groupX, but put template in the address mode, this way you don't need to use address to coordinates field, Also see tutorial for groupX storage details:

https://www.seblod.com/resources/extensions/plug-ins/group-x-field

11 Posts
jimie
8 years ago
0
Level 2

Hi Klas,

Let me see if I understand you correctly, are you suggesting to use this combination?:

select dynamic cascade + groupX ?

Rgds

Get a VIP membership