I have a table called [Products] placed in the database i created for the Umbraco installation. I want to be able to Update, Delete or Add rows in this table through the site back-end.
Is it possible to edit the back-end interface and add controls for doing these tasks I specified?
The goal is to provide a specific user with permissions to change site content and modify the [Products] table through the back-end.
Another solution would be to create a page \productadmin and create controls for that page but I do not find that solution very attractive since I am working with an established CMS. I believe one should be able to work things like this through built in functions or by minor modifications, am I wrong?
Thank you guys! The DEWD solution looks really nice. On the description it sounds like something I've been looking for. Are there any drawbacks on that one compared to the project that Dirk linked?
The main reason I suggested DEWD is I think it's made for specifically what you want, ie an interface for modifying external/SQL data. The Dynamic Grid datatype doesn't hook into SQL or anything by default, you'd need to modify it. I think he was suggesting that as a table/grid type interface
The main difference is where your data is stored, with DEWD obviously your data is in an external database and this has performance implications when accessing this data via the web as you'll hit the database.
The Dynamic Grid Data Type will store the data in the same place that Umbraco content gets stored, ie in cached XML and also can be accessed by XSLT in the normal way.
Not saying one is better than the other but 'out the box' accessing the cached XML will be faster than accessing the database.
If you were considering using the Dynamic Grid Data Type then you might also consider holding the products as content nodes, basically the Dynamic Grid Data Type is a nice way of entering tabular data, but holding the data as nodes will give you more flexibility.
If you want some further info it would be helpful if you stated what information will be held about the 'Product'. for example is it just a product name, or images / text etc.?
Work with the data using XSLT (if you've not used it, it's not hard, it's flexible and fast) this means you won't be using usercontrols, it's mostly not necessary unless you are doing something very specific.
The most important thing to note is that you will be accessing published data which is cached xml so very fast.
With the content stucture I mentioned previously, ensure that you are using different DocTypes for content, Product Categories and products, this enables you to get a list of products, categories etc. as you can filter them via their 'DocType'
Add a new XSLT file and choose the 'List sub pages by document type' template, ensure you keep "Create Macro" ticked
Name this "ListProducts"
within the xslt file change the following to be the same as the doc type you want to list
<!-- Input the documenttype you want here --> <xsl:variable name="documentTypeAlias" select="string('Product')"/>
Now within the template where you want to list products (this must be on the Product Category Level to work in this case) just put the 'ListProducts' macro in
This will show display a basic list of products
You just need to create a few different ones of these to get what you need and just change the DocType you want to display so the basic idea is
- Home (Macro A here will list child ProductCategories)
- Product Category 1 (Macro B here would list child Products of Product Category 1)
- Product Category 2 (Macro B here would list child Products of Product Category 2)
Not sure if by your post you have two Product Category levels, but it shouldn't be too hard to work this out if you have.
How would you solve this? (Manage table data)
Hi,
I have a table called [Products] placed in the database i created for the Umbraco installation. I want to be able to Update, Delete or Add rows in this table through the site back-end.
Is it possible to edit the back-end interface and add controls for doing these tasks I specified?
The goal is to provide a specific user with permissions to change site content and modify the [Products] table through the back-end.
Another solution would be to create a page \productadmin and create controls for that page but I do not find that solution very attractive since I am working with an established CMS. I believe one should be able to work things like this through built in functions or by minor modifications, am I wrong?
/Fredrik
Fredrik,
Maybe this project can be useful to you.
Cheers,
/Dirk
Also check out DEWD
Another option is to manage the products as nodes outside your website, so your structure would be:
Content
- Home
- Events
- News
- Other Website Content
-Products
- Product 1
- Product 2
- etc.
Then you could use all the features that come out the box with regards to content.
Rich
Thank you guys! The DEWD solution looks really nice. On the description it sounds like something I've been looking for. Are there any drawbacks on that one compared to the project that Dirk linked?
The main reason I suggested DEWD is I think it's made for specifically what you want, ie an interface for modifying external/SQL data. The Dynamic Grid datatype doesn't hook into SQL or anything by default, you'd need to modify it. I think he was suggesting that as a table/grid type interface
Fredrik,
The main difference is where your data is stored, with DEWD obviously your data is in an external database and this has performance implications when accessing this data via the web as you'll hit the database.
The Dynamic Grid Data Type will store the data in the same place that Umbraco content gets stored, ie in cached XML and also can be accessed by XSLT in the normal way.
Not saying one is better than the other but 'out the box' accessing the cached XML will be faster than accessing the database.
If you were considering using the Dynamic Grid Data Type then you might also consider holding the products as content nodes, basically the Dynamic Grid Data Type is a nice way of entering tabular data, but holding the data as nodes will give you more flexibility.
If you want some further info it would be helpful if you stated what information will be held about the 'Product'. for example is it just a product name, or images / text etc.?
Rich
The Product table I am looking to be able to edit is used to show information about products and it has the following columns:
Personally I'd add them as nodes in the way I stated above or even within your content structure like this.
Content
- Home
- Events
- News
-Products
- Product 1
- Product 2
- Other Website Content
- etc.
What does the website do, are you going to display all the products on the website?
Rich
Yes.
The Category-column marks what node it will belong to in a treeview on the productspage.
Under each category the associated products are to be displayed.
It will be much easier in the long run (IMO) to structure your data like this
- Home
- Events
- News
-Products
-Product Category 1
- Product 1
- Product 2
-Product Category 2
- Product 3
- Product 4
- Other Website ContentRich
I decided not to go with DEWD(Topic not solved anymore!)
Instead I've structured the data in Umbraco like Rich suggested.
However for my usercontrols to work I need to be able to access the data from visual studio. How do I approach this problem?
Hey Fredrik,
You have a few options
Better link for Linq 2 Umbraco http://www.aaron-powell.com/umbraco
Rich
Thanks for all guidance so far.
Now I need help with some basic XSLT-coding to get things started!
My structure looks like this:
- Home
- Productcategorylvl1(Document Type: Product Category)
- Productcategorylvl2(Document Type: Product Category)
- Product1(Document Type: Product)
- Product2
I want to loop through Productcategorylvl2 and display the ArticleNr(textstring) property of each child node(Product)
How is this done?
Hi Fredrik,
This will get you started
Add a new XSLT file and choose the 'List sub pages by document type' template, ensure you keep "Create Macro" ticked
Name this "ListProducts"
within the xslt file change the following to be the same as the doc type you want to list
<!-- Input the documenttype you want here --><xsl:variable name="documentTypeAlias" select="string('Product')"/>
Now within the template where you want to list products (this must be on the Product Category Level to work in this case) just put the 'ListProducts' macro in
This will show display a basic list of products
You just need to create a few different ones of these to get what you need and just change the DocType you want to display so the basic idea is
- Home (Macro A here will list child ProductCategories)
- Product Category 1 (Macro B here would list child Products of Product Category 1)
- Product Category 2 (Macro B here would list child Products of Product Category 2)
Not sure if by your post you have two Product Category levels, but it shouldn't be too hard to work this out if you have.
Rich
Works nicely Rich, thanks!
There is just one small issue left. And that is to show the image that is set in the property(name: image) of type Mediapicker on Product.
<xsl:variable name="iconId" select="data [@alias = 'image']"/>
<!--and pass the id to show the image-->
<img>
<xsl:attribute name="src">
<xsl:value-of select="umbraco.library:GetMedia($iconId, 'false')/data [@alias = 'umbracoFile']"/>
</xsl:attribute>
</img>
</xsl:if>
What Umbraco version are you using?
V.4.5.2
The code you found was for an older version of umbraco
New snippet here this http://blog.leekelleher.com/2010/08/11/how-to-use-umbraco-library-getmedia-in-xslt-for-umbraco-v4-5/
Rich
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.