Sample Generic Content based module: Products module

Sample Generic Content based module: Products module

Posted on March 11, 2009 0 Comments

The content you're reading is getting on in years
This post is on the older side and its content may be out of date.
Be sure to visit our blogs homepage for our latest news, updates and information.

[This post is part of the developer's manual preview published on this blog. You can find temporary TOC here.]

 

 

In this article we are providing a sample Products module which is based on Generic Content module. The Products module supports following features:
  • Dynamic meta fields
  • Hierarchical categories
  • Tagging
  • Comments
  • Permissions
  • History (rollback)
  • Localization
  • Embedded templates
Generally speaking, it takes about 3-4 hours to build such a module and if the requirements for your module are similar to the features provided by Generic Content module, this is by far the simplest and fastest way to build a new module. We will explore different aspects of this approach in the articles to come.

 

You can download the module from here.

 

Installation instructions:
  • Download the module from here (if you haven't already)
  • Open an existing or create new Sitefinity website
  • Paste the contents of the Website folder in the root of your website (if asked to overwrite, say yes).
  • Add Telerik.Samples.Products project to your website, thus creating a solution (go to File > Add > Existing Project… Navigate to the Telerik.Samples.Products.csproj file that came with this sample)
  • Expand the References folder in the Telerik.Samples.Products and fix reference problems if any (this can happen if your website is using a different version of Sitefinity than the one I used to create a sample)
  • Reference Telerik.Samples.Products project from your website (right click on the website in the Solution Explorer, select “Add Reference…”, select “Projects” tab and then select the Telerik.Samples.Products from the available projects. Click OK.
  • Register the products configuration section by pasting the following line in the web.config file as an immediate child of <sectionGroup name=”telerik”>:
    <section name="products" type="Telerik.Samples.Products.Configuration.SectionHandler, Telerik.Samples.Products" requirePermission="false" />
  • Register Products module by pasting following line as an immediate child of telerik/framework/modules section:
    <add type="Telerik.Samples.Products.ProductsModule, Telerik.Samples.Products" /> 
  • Add new Generic Content provider by pasting following line as an immediate child of the telerik/cmsEngine/providers section:
    <add name="Products" urlRewriteFormat="[Name].aspx" urlWhitespaceChar="_" visible="False" defaultMetaField="Name" securityProviderName="" allowVersioning="True" applicationName="/Products" versioningProviderName="" allowComments="false" commentsModeration="true" connectionStringName="GenericContentConnection" type="Telerik.Cms.Engine.Data.Providers.DefaultProvider, Telerik.Cms.Engine.Data"></add> 
  • Declare the metafields for the products module by pasting following lines as an immediate child of telerik/cmsEngine/metaFields:
    <add key="Products.Name" valueType="ShortText" visible="True" searchable="True" sortable="True" defaultValue="Name this content" mandatory="True" /> 
    <add key="Products.Price" valueType="ShortText" visible="True" searchable="True" sortable="True" defaultValue="" /> 
    <add key="Products.SKU" valueType="ShortText" visible="True" searchable="True" sortable="True" defaultValue="" /> 
    <add key="Products.Weight" valueType="ShortText" visible="True" searchable="True" sortable="True" defaultValue="" /> 
    <add key="Products.Category" valueType="ShortText" visible="True" searchable="True" sortable="True" defaultValue="" /> 
     
  • Declare the products module section by pasting following lines as an immediate child of telerik/cmsEngine section:
    <products defaultGenericProvider="Products"
          <genericContentProviders> 
            <add providerName="Products" urlRewriteFormat="[Name].aspx" urlWhitespaceChar="_" /> 
          </genericContentProviders> 
    </products> 
     
  • Save web.config file, build your solution and run it. Products module will be available in the Modules section.
In case you have any questions or run into problems, please let us know. Also if there are some features that you would like explained in more detail, do not hesitate to leave a comment. Your feedback is greatly appreciated.

 


progress-logo

The Progress Team

View all posts from The Progress Team on the Progress blog. Connect with us about all things application development and deployment, data integration and digital business.

Comments

Comments are disabled in preview mode.
Topics

Sitefinity Training and Certification Now Available.

Let our experts teach you how to use Sitefinity's best-in-class features to deliver compelling digital experiences.

Learn More
Latest Stories
in Your Inbox

Subscribe to get all the news, info and tutorials you need to build better business apps and sites

Loading animation