Share » Forums » Developer » Creating a Complex Stockist Database...

Creating a Complex Stockist Database - Suggestions Needed

Creating a Complex Stockist Database - Suggestions Needed

Sunday 18 September 2005 9:29:18 pm - 5 replies

Modified on Sunday 18 September 2005 9:32:45 pm by Nathan Kelly

Author Message

Nathan Kelly

Monday 19 September 2005 4:46:26 pm

Ok no suggestions, how about this...

I went looking for an auto-populate script to find out how it is done and I found one that uses javascript, only problem is it has some bugs and to get around them the author has found adding a whole heap of empty <option> tags to the HTML kills the bugs, however it also kills validation (Client requests valid XHTML strict).

I may be able to rework the script to be more compliant but is it possible to pass information from a template to the system?

I also found this http://ajax.zervaas.com.au/examples/CountryRegionCityJax/
And I wondered if something like this could be made into an extension? Unfortunately I have no idea how to make my own extension, maybe someone could give me a few pointers (if it is a doable thing)?

Cheers!

Pardon me while I burst into flames...

Lex 007

Tuesday 20 September 2005 2:12:01 am

Hi,

This is very doable. You should have two classes :
- Country class
- State class

The country class has an attribute of type object relation (see the contributions section for a better datatype). In this attribute, for each country you create, you assign the states that belong sto this country.

About AJAX stuff, check out the AJAX menu in the contribs section, this should give you some good hints.

Hope it helps.

Lex

Nathan Kelly

Tuesday 20 September 2005 4:38:51 pm

Hi Lex Thanks for your input, I have already looked at the ezcountry datatype in the contribs, this looks like what I need for the first part but I'm not 100% sure what you mean when it comes to the states...

Are you saying that for each country I need to create a states class?

Or do you mean I should create just one states class that contains all of the states for all of the countries?

Or do you mean I should create a states datatype?

If I need to create a class for each country I'm going to end up with a lot of bloat in setup/classes, so I assume you don't mean for that.

I was thinking about trying to extend the current country datatype to include the states but I haven't looked to deep into the datatype yet as I was hoping someone may have a better idea.

Certainly I'll look into your suggestions and thankyou for them, if you could just clarify this method with a little more detail that would be great.

Cheers!

Pardon me while I burst into flames...

Lex 007

Wednesday 21 September 2005 1:03:33 am

In my method you have to create one OBJECT for each state, not one CLASS for each state. Each state object is an instance of the same State class.

This should work "out of the box" with eZ, but for sure the cleanest way is to write a new datatype, which should take you much much longer time.

Lex

Nathan Kelly

Wednesday 21 September 2005 4:10:45 pm

Cheers Lex I'll give it a go and see what I can come up with, I think creating a datatype is the way to go, as you said it will be much cleaner.

Now I just need to figure out how to create a datatype...(I don't really know PHP at all so this should be fun).

Pardon me while I burst into flames...

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu