Not sure if this is the right section to ask this, but here it goes. Basically, I'm working on a site that needs to store information about products and each of those products are then associated to a location. I know that I can add product information to a template and manage it that way, but I don't know how I would go about doing the relations between the product data and the locations. I've done some research and I think I have an idea on what to do, but since this is my first Umbraco site, I wanted to make sure I did it right the first time...
My first idea was to create a custom section in the admin screen and model the data that way. I've read enough to know how to implement all the parts of that, except for how I actually display that information on a page. I guess I could use a custom .ascx macro, but that seems a bit overkill...
My second idea was to somehow use the builtin relations api to relate a product type to a location type. However, I'm not sure how well that would work, or it that even makes sense.
How many products? How many locations? Makes a big difference. For a very small set of data you could conceivably use the built-in umbraco templates etc to store your data, but ultimately, umbraco really isn't a database for storing and manipulating large amounts of data - it can do it for a while, but the concept falls apart pretty quickly as you add data and complexity.
I tend to store my real 'data' in my own sql server tables (usally in the same umbraco database), and then use entity framework to get at and manipulate that data.I use the umbraco parts of the systems to do a lot of the UI stuff.
As far as displaying the data - you can still do all your templates/css in umbraco and then I use razor to get at the data to display it - works just fine. You can write a lot of those data access helper methods in C# and then call them from razor. An ascx macro would also do the job, but I prefer the combination of razor macors calling custom C# code when I can.
I created some custom sections, but stopped with that after I found the DEWD package. It's really easy to manage data from custom tables and you can still use the Umbraco datatypes to manage the date. Here is the documentation: http://dewd.codeplex.com/documentation
There aren't that many products in the database, but there are a bunch of locations. Essentially, the site has a listing of products for this company, and a custom store locator that displays locations for each product. I have no problem letting Umbraco manage the product data, but creating a DocumentType for a location and associating them to a product doesn't seem easy/managable/sane. I guess I could store them in a separate table, and associate the NodeID of each product to a location? Then, using the SqlHelper in Razor, access the location information? That seems to make sense, but I'm guessing there's a better way.
I've done this kind of thing before, but not in Umbraco, so I'm not really sure where to begin with it. It probably doesn't help that this the first site I've done in Umbraco.... :/
Managing Custom Data
Not sure if this is the right section to ask this, but here it goes. Basically, I'm working on a site that needs to store information about products and each of those products are then associated to a location. I know that I can add product information to a template and manage it that way, but I don't know how I would go about doing the relations between the product data and the locations. I've done some research and I think I have an idea on what to do, but since this is my first Umbraco site, I wanted to make sure I did it right the first time...
My first idea was to create a custom section in the admin screen and model the data that way. I've read enough to know how to implement all the parts of that, except for how I actually display that information on a page. I guess I could use a custom .ascx macro, but that seems a bit overkill...
My second idea was to somehow use the builtin relations api to relate a product type to a location type. However, I'm not sure how well that would work, or it that even makes sense.
Thanks,
Robbie
How many products? How many locations? Makes a big difference. For a very small set of data you could conceivably use the built-in umbraco templates etc to store your data, but ultimately, umbraco really isn't a database for storing and manipulating large amounts of data - it can do it for a while, but the concept falls apart pretty quickly as you add data and complexity.
I tend to store my real 'data' in my own sql server tables (usally in the same umbraco database), and then use entity framework to get at and manipulate that data.I use the umbraco parts of the systems to do a lot of the UI stuff.
As far as displaying the data - you can still do all your templates/css in umbraco and then I use razor to get at the data to display it - works just fine. You can write a lot of those data access helper methods in C# and then call them from razor. An ascx macro would also do the job, but I prefer the combination of razor macors calling custom C# code when I can.
I created some custom sections, but stopped with that after I found the DEWD package. It's really easy to manage data from custom tables and you can still use the Umbraco datatypes to manage the date. Here is the documentation: http://dewd.codeplex.com/documentation
Jeroen
There aren't that many products in the database, but there are a bunch of locations. Essentially, the site has a listing of products for this company, and a custom store locator that displays locations for each product. I have no problem letting Umbraco manage the product data, but creating a DocumentType for a location and associating them to a product doesn't seem easy/managable/sane. I guess I could store them in a separate table, and associate the NodeID of each product to a location? Then, using the SqlHelper in Razor, access the location information? That seems to make sense, but I'm guessing there's a better way.
I've done this kind of thing before, but not in Umbraco, so I'm not really sure where to begin with it. It probably doesn't help that this the first site I've done in Umbraco.... :/
Hmm maybe these packages can help?
http://our.umbraco.org/projects/backoffice-extensions/locator-package
http://our.umbraco.org/projects/developer-tools/locator-razor-style
More info in this blog: http://www.nibble.be/?p=68
Jeroen
is working on a reply...