More in this section

Forums / Developing with Sitefinity / Creating custom module following products sample

Creating custom module following products sample

7 posts, 1 answered
  1. Qian
    Qian avatar
    6 posts
    Registered:
    26 May 2011
    03 Jun 2011
    Link to this post
    I have hard time to build custom module following the sample example of products module, and I have been looking for solution by reading the forum and blogs but could not find very good solution, it looks like I am not alone for this problem. I have a few questions and I will base them on the products module since it is the model people wants to follow.
    1. How does the data mapping works in the backend module? e.g. the price field  in the main section(prodcutsDefinitions.cs), a TextFieldDefinitionElement is created with DataFieldName set to "Price", how is this used to map the content of the text field to dataprovider and eventually saved in sitefinity database? I can set the breakpoint in ProductItem.cs and see the value has been set in productItem's Price property but could not get any call stack information. Could you explain the code flow and how the content from definition fields been saved? 

    2. I was trying to add a image field to the module. I add an Image member variable to ProductItem class the same way as "Price" but with the type of "Image", and add a imageFieldElement to show/load image, but it gives me the following error:
    [MetadataException: No database type mapping found for field 'image': CLR type 'Telerik.Sitefinity.Libraries.Model.Image' or column type '' unmapped. ] OpenAccessRuntime.Relational.metadata.RelationalMappingResolver.resolveMapping(RelationalJavaTypeMapping fieldMapping, String fieldName, Class javaType, Boolean complain) +437 OpenAccessRuntime.Relational.RelationalMetaDataBuilder.createColumn(DataObjectsExtension[] nested, String fieldName, Class javaType, String oType, Boolean secondaryTable) +49 OpenAccessRuntime.Relational.RelationalMetaDataBuilder.createJdbcSimpleField(FieldMetaData fmd) +173 OpenAccessRuntime.Relational.RelationalMetaDataBuilder.createJdbcField(FieldMetaData fmd, Boolean quietParam) +69 [MetadataException: The metadata for field 'image' of class 'Products.Model.ProductItem' cannot be initialized: No database type mapping found for field 'image': CLR type 'Telerik.Sitefinity.Libraries.Model.Image' or column type '' unmapped. ] DynamicModule.ns.Wrapped_OpenAccessProvider_3ab5f363aef442af99a7bf174fe5454f.GetSecurityRoot() +162 Telerik.Sitefinity.Data.ManagerBase`1.GetSecurityRoot() +30 Telerik.Sitefinity.Web.UI.ContentUI.Views.Backend.Master.MasterGridView.GetSecurityRoot() +33 Telerik.Sitefinity.Web.UI.ContentUI.Views.Backend.Master.MasterGridView.OnInit(EventArgs e) +369 System.Web.UI.Control.InitRecursive(Control namingContainer) +140 System.Web.UI.Control.AddedControl(Control control, Int32 index) +197 System.Web.UI.ControlCollection.Add(Control child) +79 Telerik.Sitefinity.Web.UI.ContentUI.ContentView.LoadView(String viewName) +301 Telerik.Sitefinity.Web.UI.ContentUI.ContentView.CreateChildControls() +57 System.Web.UI.Control.EnsureChildControls() +102 System.Web.UI.Control.PreRenderRecursiveInternal() +42 System.Web.UI.Control.PreRenderRecursiveInternal() +175 System.Web.UI.Control.PreRenderRecursiveInternal() +175 System.Web.UI.Control.PreRenderRecursiveInternal() +175 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496

    What should I do to implement this? Some sample code would be appreciated.

    3. How to create more complex UI for backend view? Sitefinity provides some nice out of box fields we can use, but most of time, we need more complex UI, what should we do? How does the data binding work in this situation assume we need to create a user control (.ascx) for the complex UI? Exact steps with explanation would be good.
  2. Nikolay Datchev
    Nikolay Datchev avatar
    87 posts
    Registered:
    01 Nov 2016
    10 Jun 2011
    Link to this post
    Hello Qian,

    It seems that we are already discussing your issues in ticket 431647, so i guess we can close this one.

    All the best,
    Nikolay Datchev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
    Answered
  3. Qian
    Qian avatar
    6 posts
    Registered:
    26 May 2011
    10 Jun 2011
    Link to this post
    Sure. I marked it as "answered"
  4. don
    don avatar
    9 posts
    Registered:
    18 Dec 2008
    10 Aug 2011
    Link to this post
    I hate it when you guys do this - I finally find a forum post that is asking the questions I need answered... and you all take it private to the ticket.  So now I am still not finding any answers.
  5. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    11 Aug 2011
    Link to this post
    Hi Don,

    Ok, could you tell us what the problem you have is so we can try to help ?

    Regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. don
    don avatar
    9 posts
    Registered:
    18 Dec 2008
    11 Aug 2011
    Link to this post
    Thanks, but I am in contact with Steve Miller out of San Diego and it looks like 4.2 will be awesome!
  7. R. Atanasov
    R. Atanasov avatar
    19 posts
    Registered:
    03 Nov 2014
    18 Jun 2012
    Link to this post
    Just for the sake of completeness:

    The bottom-line of the discussion in the aforementioned ticket 431647 is that the "Product Catalog Module" SDK sample now features a custom "ProductImage" field, installed in the ProductsModule.InstallCustomTaxonomies method (I know, it should have been renamed to InstallCustomFields :) ).

    All the best,
    R. Atanasov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
7 posts, 1 answered