Archive for DotShoppingCart

How to add dynamic page in DotshoppingCart V2.0 OpenSource

In this post, I will show the way to add dynamic page in DotshoppingCart based step by step and how this page store in database. This dynamic page is the same as MyAccount.aspx, Search.aspx, or News.aspx etc. This page includes many part:

· The site navigation

· The default content of this dynamic page

To be easy building I will build a Contact page (~/ContactUs.aspx), this page will be add the Controls/Blocks/ContactForm.ascx user control

Step 1: Modify the config page (include Module.config, Web.sitemap)

  • Open Module.config, after line 21 (<add name=”Search” blockTypeId=”20″ />), you add you line <add name=”ContactUs” blockTypeId=”35″ />

I use blockTypeId=”35” because on DSC_Block_Type_lkp table record has blockTypeId=35 will have virtualPath=”~/Controls/Blocks/ContactForm.ascx”

  • Add SitemapNode on Web.sitemap, after line 5 (<siteMapNode url=”~/Login.aspx” title=”Log In”/>) you add new line (<siteMapNode url=”~/ContactUs.aspx” title=”Contact Us”/>)

Step 2: Add record define new dynamic page

Open dotshoppingcart database on Microsoft SQL Server

Execute query

SET IDENTITY_INSERT [dbo].[DSC_Block] ON

INSERT INTO [dbo].[DSC_Block] [blockTypeId], [data], [headerData], [name], [conditions]) VALUES (35, NULL, NULL, N’ContactUs Content’, NULL)

SET IDENTITY_INSERT [dbo].[DSC_Block] ON

Now you open web browser, open page http://yoursite.com/ContactUs.aspx you will see you dynamic page. On the first time open your dynamic page on web browser, the web server will create new record to save the content of dynamic page on DSC_Block table with data column is: “”<table style=”width:100%;”><tr><td colspan=”3″>%%BlockRef,MainSiteMapPath%%%%PlaceHolder1%%</td></tr><tr><td>%%PlaceHolder2%%</td><td>%%{0}%%</td><td>%%PlaceHolder3%%</td></tr><tr><td colspan=”3″>%%PlaceHolder4%%</td></tr></table>”. If you want to change data column on the first time open dynamic page, please change value of the blockContainerFormat on <dynamicPageConfiguration> of Module.config

Good luck to you

Leave a Comment