<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>Footprints in the snow of a warped mind</title>
    <link>http://blogs.thesitedoctor.co.uk/test/</link>
    <description>newtelligence powered</description>
    <language>en-us</language>
    <copyright>Tim</copyright>
    <lastBuildDate>Mon, 20 Dec 2010 22:17:56 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.3.9074.18820</generator>
    <managingEditor>timgaunt@gmail.com</managingEditor>
    <webMaster>timgaunt@gmail.com</webMaster>
    <item>
      <trackback:ping>http://blogs.thesitedoctor.co.uk/test/Trackback.aspx?guid=27a12b18-e449-4f48-8c79-d3ea6a3758d5</trackback:ping>
      <pingback:server>http://blogs.thesitedoctor.co.uk/test/pingback.aspx</pingback:server>
      <pingback:target>http://blogs.thesitedoctor.co.uk/test/PermaLink,guid,27a12b18-e449-4f48-8c79-d3ea6a3758d5.aspx</pingback:target>
      <dc:creator>Tim</dc:creator>
      <wfw:comment>http://blogs.thesitedoctor.co.uk/test/CommentView,guid,27a12b18-e449-4f48-8c79-d3ea6a3758d5.aspx</wfw:comment>
      <wfw:commentRss>http://blogs.thesitedoctor.co.uk/test/SyndicationService.asmx/GetEntryCommentsRss?guid=27a12b18-e449-4f48-8c79-d3ea6a3758d5</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="240510c239ad497f876efc732b22a2f1_7" border="0" alt="240510c239ad497f876efc732b22a2f1_7" align="right" src="http://blogs.thesitedoctor.co.uk/tim/images/Understanding-what-an-employee-will-cost_BC82/240510c239ad497f876efc732b22a2f1_7.jpg" width="240" height="240" />As
people are now looking to employ I thought it would be helpful to overview the general
costs involved with employing someone in the UK and how you can factor that back to
an hourly charge.
</p>
        <h2>Some Assumptions
</h2>
        <ol>
          <li>
As most of my readers are within the IT industry, I've based these figures on hiring
within our sector 
</li>
          <li>
For simplicity's sake, someone who is over 21 (minimum wage and the factors vary when
employing someone younger). 
</li>
          <li>
The employ won't earn over £844 (around £44,000pa) to avoid needing to account for
different NI values (<a href="http://www.direct.gov.uk/en/MoneyTaxAndBenefits/Taxes/BeginnersGuideToTax/NationalInsurance/IntroductiontoNationalInsurance/DG_190048" target="_blank">refer
to Directgov for more information</a>) 
</li>
        </ol>
        <h2>The calculations
</h2>
        <p>
I've created a <a href="http://blogs.thesitedoctor.co.uk/tim/files/Hourly_Rates_Breakdown.xls" target="_blank">spreadsheet</a> for
you which calculates the hourly cost for employees on various salary levels. It should
be fairly self explanatory, if it's not, leave a comment and I'll explain as necessary.
</p>
        <p>
          <img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="SalaryGrades" border="0" alt="SalaryGrades" src="http://blogs.thesitedoctor.co.uk/tim/images/Understanding-what-an-employee-will-cost_BC82/SalaryGrades.png" width="555" height="445" />
        </p>
        <p>
Download: <a title="http://blogs.thesitedoctor.co.uk/tim/files/Hourly_Rates_Breakdown.xls" href="http://blogs.thesitedoctor.co.uk/tim/files/Hourly_Rates_Breakdown.xls">Hourly_Rates_Breakdown.xls</a></p>
        <h2>Other costs to consider
</h2>
        <p>
Once employed, there are a number of other costs that haven't been factored into <a href="http://blogs.thesitedoctor.co.uk/tim/files/Hourly_Rates_Breakdown.xls" target="_blank">the
spreadsheet</a>:
</p>
        <h3>Downtime
</h3>
        <p>
It's unlikely that your employee will be working at full capacity (if they are you
should consider employing another!) so it is important factor in some downtime within
your calculations.
</p>
        <h3>First Year
</h3>
        <p>
Although the process of employment doesn't have to be too costly by using <a href="http://www.jobtube.com" target="_blank">free</a><a href="http://www.thejobsite.co.uk" target="_blank">job</a><a href="http://www.theitjobboard.co.uk/index.php?Mode=ViewPostJob" target="_blank">sites</a> and <a href="http://online.businesslink.gov.uk/London_files/Contract_of_Employment__Fulltime_Working_template1.doc" target="_blank">pre-written
employment contracts</a>, there is still an inherent cost with employing someone. 
</p>
        <p>
Think carefully about what you'll need to buy for the new employee -you will need
to give them somewhere to work (i.e. a desk), something to use to do the work (i.e.
a computer) and importantly somewhere for them to sit!
</p>
        <h3>On-going
</h3>
        <p>
As everything in business needs to be broken down to a monetary value so here are
some other things that you will need to factor into your calculations:
</p>
        <ul>
          <li>
Office space -apportion the employee's area of the office's rent 
</li>
          <li>
Stationary -pens, paper and ink all costs 
</li>
          <li>
Telephone 
</li>
          <li>
Training/course fees 
</li>
          <li>
Electricity 
</li>
          <li>
Software and licenses 
</li>
          <li>
Business insurance (if this is your first employee this is likely to increase substantially) 
</li>
        </ul>
        <h2>Conclusion
</h2>
        <p>
Breaking the salary down to an hourly charge should help give you confidence in being
able to afford the additional resource. If you're working flat out at £50ph and finding
that work isn't getting done, you can in theory employ someone at around £25,000pa
and by keeping them busy still earn £55,594.66 (approximately!) yourself without needing
to do any work. I'm sure you can see that by adding to your team and keeping them
busy you can very quickly start growing your business.
</p>
        <p>
It's also worth noting, when making a considerable investment such as employing someone,
it would be wise to have a contract written specifically for your role.
</p>
        <p>
 
</p>
        <p>
          <strong>Update:</strong> I've already had some great feedback on the spreadsheet courtesy
of Sean Ronan from Active Pixels. He added a new table "Weekly billable hours needed
to break even". This breaks the total cost of employing someone down into the weeks
they can actually work. As they're unlikely to work 52 weeks a year, it works out
the number of weeks based on the other information you entered. Great idea, thanks
Sean.
</p>
        <img width="0" height="0" src="http://blogs.thesitedoctor.co.uk/test/aggbug.ashx?id=27a12b18-e449-4f48-8c79-d3ea6a3758d5" />
      </body>
      <title>Calculating what an employee will cost you</title>
      <guid isPermaLink="false">http://blogs.thesitedoctor.co.uk/test/PermaLink,guid,27a12b18-e449-4f48-8c79-d3ea6a3758d5.aspx</guid>
      <link>http://blogs.thesitedoctor.co.uk/test/2010/12/20/CalculatingWhatAnEmployeeWillCostYou.aspx</link>
      <pubDate>Mon, 20 Dec 2010 22:17:56 GMT</pubDate>
      <description>&lt;p&gt;
&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="240510c239ad497f876efc732b22a2f1_7" border="0" alt="240510c239ad497f876efc732b22a2f1_7" align="right" src="http://blogs.thesitedoctor.co.uk/tim/images/Understanding-what-an-employee-will-cost_BC82/240510c239ad497f876efc732b22a2f1_7.jpg" width="240" height="240" /&gt;As
people are now looking to employ I thought it would be helpful to overview the general
costs involved with employing someone in the UK and how you can factor that back to
an hourly charge.
&lt;/p&gt;
&lt;h2&gt;Some Assumptions
&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;
As most of my readers are within the IT industry, I've based these figures on hiring
within our sector 
&lt;/li&gt;
&lt;li&gt;
For simplicity's sake, someone who is over 21 (minimum wage and the factors vary when
employing someone younger). 
&lt;/li&gt;
&lt;li&gt;
The employ won't earn over £844 (around £44,000pa) to avoid needing to account for
different NI values (&lt;a href="http://www.direct.gov.uk/en/MoneyTaxAndBenefits/Taxes/BeginnersGuideToTax/NationalInsurance/IntroductiontoNationalInsurance/DG_190048" target="_blank"&gt;refer
to Directgov for more information&lt;/a&gt;) 
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;The calculations
&lt;/h2&gt;
&lt;p&gt;
I've created a &lt;a href="http://blogs.thesitedoctor.co.uk/tim/files/Hourly_Rates_Breakdown.xls" target="_blank"&gt;spreadsheet&lt;/a&gt; for
you which calculates the hourly cost for employees on various salary levels. It should
be fairly self explanatory, if it's not, leave a comment and I'll explain as necessary.
&lt;/p&gt;
&lt;p&gt;
&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="SalaryGrades" border="0" alt="SalaryGrades" src="http://blogs.thesitedoctor.co.uk/tim/images/Understanding-what-an-employee-will-cost_BC82/SalaryGrades.png" width="555" height="445" /&gt;
&lt;/p&gt;
&lt;p&gt;
Download: &lt;a title="http://blogs.thesitedoctor.co.uk/tim/files/Hourly_Rates_Breakdown.xls" href="http://blogs.thesitedoctor.co.uk/tim/files/Hourly_Rates_Breakdown.xls"&gt;Hourly_Rates_Breakdown.xls&lt;/a&gt;
&lt;/p&gt;
&lt;h2&gt;Other costs to consider
&lt;/h2&gt;
&lt;p&gt;
Once employed, there are a number of other costs that haven't been factored into &lt;a href="http://blogs.thesitedoctor.co.uk/tim/files/Hourly_Rates_Breakdown.xls" target="_blank"&gt;the
spreadsheet&lt;/a&gt;:
&lt;/p&gt;
&lt;h3&gt;Downtime
&lt;/h3&gt;
&lt;p&gt;
It's unlikely that your employee will be working at full capacity (if they are you
should consider employing another!) so it is important factor in some downtime within
your calculations.
&lt;/p&gt;
&lt;h3&gt;First Year
&lt;/h3&gt;
&lt;p&gt;
Although the process of employment doesn't have to be too costly by using &lt;a href="http://www.jobtube.com" target="_blank"&gt;free&lt;/a&gt; &lt;a href="http://www.thejobsite.co.uk" target="_blank"&gt;job&lt;/a&gt; &lt;a href="http://www.theitjobboard.co.uk/index.php?Mode=ViewPostJob" target="_blank"&gt;sites&lt;/a&gt; and &lt;a href="http://online.businesslink.gov.uk/London_files/Contract_of_Employment__Fulltime_Working_template1.doc" target="_blank"&gt;pre-written
employment contracts&lt;/a&gt;, there is still an inherent cost with employing someone. 
&lt;/p&gt;
&lt;p&gt;
Think carefully about what you'll need to buy for the new employee -you will need
to give them somewhere to work (i.e. a desk), something to use to do the work (i.e.
a computer) and importantly somewhere for them to sit!
&lt;/p&gt;
&lt;h3&gt;On-going
&lt;/h3&gt;
&lt;p&gt;
As everything in business needs to be broken down to a monetary value so here are
some other things that you will need to factor into your calculations:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Office space -apportion the employee's area of the office's rent 
&lt;/li&gt;
&lt;li&gt;
Stationary -pens, paper and ink all costs 
&lt;/li&gt;
&lt;li&gt;
Telephone 
&lt;/li&gt;
&lt;li&gt;
Training/course fees 
&lt;/li&gt;
&lt;li&gt;
Electricity 
&lt;/li&gt;
&lt;li&gt;
Software and licenses 
&lt;/li&gt;
&lt;li&gt;
Business insurance (if this is your first employee this is likely to increase substantially) 
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Conclusion
&lt;/h2&gt;
&lt;p&gt;
Breaking the salary down to an hourly charge should help give you confidence in being
able to afford the additional resource. If you're working flat out at £50ph and finding
that work isn't getting done, you can in theory employ someone at around £25,000pa
and by keeping them busy still earn £55,594.66 (approximately!) yourself without needing
to do any work. I'm sure you can see that by adding to your team and keeping them
busy you can very quickly start growing your business.&gt;
&lt;/p&gt;
&lt;p&gt;
It's also worth noting, when making a considerable investment such as employing someone,
it would be wise to have a contract written specifically for your role.
&lt;/p&gt;
&lt;p&gt;
&amp;#160;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Update:&lt;/strong&gt; I've already had some great feedback on the spreadsheet courtesy
of Sean Ronan from Active Pixels. He added a new table "Weekly billable hours needed
to break even". This breaks the total cost of employing someone down into the weeks
they can actually work. As they're unlikely to work 52 weeks a year, it works out
the number of weeks based on the other information you entered. Great idea, thanks
Sean.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blogs.thesitedoctor.co.uk/test/aggbug.ashx?id=27a12b18-e449-4f48-8c79-d3ea6a3758d5" /&gt;</description>
      <comments>http://blogs.thesitedoctor.co.uk/test/CommentView,guid,27a12b18-e449-4f48-8c79-d3ea6a3758d5.aspx</comments>
      <category>Business</category>
      <category>Business/Business Start-up Advice</category>
      <category>Business/Expanding Your Business</category>
      <category>Employment</category>
    </item>
    <item>
      <trackback:ping>http://blogs.thesitedoctor.co.uk/test/Trackback.aspx?guid=06a7ede9-ec1f-417c-b460-9487f269a078</trackback:ping>
      <pingback:server>http://blogs.thesitedoctor.co.uk/test/pingback.aspx</pingback:server>
      <pingback:target>http://blogs.thesitedoctor.co.uk/test/PermaLink,guid,06a7ede9-ec1f-417c-b460-9487f269a078.aspx</pingback:target>
      <dc:creator>Tim</dc:creator>
      <wfw:comment>http://blogs.thesitedoctor.co.uk/test/CommentView,guid,06a7ede9-ec1f-417c-b460-9487f269a078.aspx</wfw:comment>
      <wfw:commentRss>http://blogs.thesitedoctor.co.uk/test/SyndicationService.asmx/GetEntryCommentsRss?guid=06a7ede9-ec1f-417c-b460-9487f269a078</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top: 0px; border-right: 0px; padding-top: 0px" title="error[2]" border="0" alt="error[2]" align="right" src="http://blogs.thesitedoctor.co.uk/tim/images/616c06524d21_ABF1/error2.png" width="260" height="260" />We
were contacted the other day by a client with issues selecting data from one of their
tables after a recent server crash (not running on our servers or a site that we were
involved in developing). The issue was easy enough to recreate as you just needed
to select records after the server crash and you'd get the error:
</p>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:066de93b-0bfa-4bff-ab25-4f6d104e0588" class="wlWriterEditableSmartContent">
          <pre class="brush: text;">Warning: Fatal error 823 occurred at date / time Note the error and time, and contact your system administrator.</pre>
        </div>
        <p>
A quick Google suggests a physical disk drive error and having a quick look at the
issues it wasn't pretty. Running:
</p>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:4ef19624-c777-4d57-b382-bf4757d70a3a" class="wlWriterEditableSmartContent">
          <pre class="brush: sql;">DBCC CHECKDB('DatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS</pre>
        </div>
        <p>
Resulted in:
</p>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:5aa36243-c2a8-4d90-bb96-b88e4bdf61a9" class="wlWriterEditableSmartContent">
          <pre class="brush: xml;">Msg 8909, Level 16, State 1, Line 5 
Table error: Object ID 0, index ID 12341, page ID (1:5880). The PageId in the page header = (9728:16777220). 
CHECKTABLE found 0 allocation errors and 1 consistency errors not associated with any single object. 


....


DBCC results for 'TableName'. 
Msg 8928, Level 16, State 1, Line 5 
Object ID 871674153, index ID 0: Page (1:5880) could not be processed. See other errors for details. 


....


There are 20993 rows in 584 pages for object 'TableName'. 
CHECKTABLE found 0 allocation errors and 8 consistency errors in table 'TableName' (object ID 871674153). 
Msg 8909, Level 16, State 1, Line 5 
Table error: Object ID 1109413712, index ID 24940, page ID (1:5883). The PageId in the page header = (25198:1632843825). 
CHECKTABLE found 0 allocation errors and 1 consistency errors in table '(Object ID 1109413712)' (object ID 1109413712). </pre>
        </div>
        <p>
Most of the solutions found on Google resulted in some form of system restore but
that's no good in this instance as the backups only existed for after the problem
was identified (great eh!) so were useless.
</p>
        <p>
Although it's not an ideal solution, you can use DBCC CHECKTABLE which in our case
fixed the issue:
</p>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:7aaaa196-804c-4161-afb0-12132fca51e1" class="wlWriterEditableSmartContent">
          <pre class="brush: sql;">--Put the database into single user mode
ALTER DATABASE [db2370] SET SINGLE_USER WITH NO_WAIT
--Check the erors and fix any issues found (that you can)
DBCC CHECKTABLE ('Orders', REPAIR_REBUILD)
--Put the database back into multiuser mode
ALTER DATABASE [db2370] SET MULTI_USER WITH NO_WAIT</pre>
        </div>
        <p>
 
</p>
        <p>
I'd be interested to know other solutions people may have to this issue.
</p>
        <p>
          <strong>Note to readers:</strong> Check that your hosting provider performs regular
backups and checks the health of your server regularly to avoid this happening to
you.
</p>
        <img width="0" height="0" src="http://blogs.thesitedoctor.co.uk/test/aggbug.ashx?id=06a7ede9-ec1f-417c-b460-9487f269a078" />
      </body>
      <title>SQL Server: Warning: Fatal error 823 occurred at date / time Note the error and time, and contact your system administrator.</title>
      <guid isPermaLink="false">http://blogs.thesitedoctor.co.uk/test/PermaLink,guid,06a7ede9-ec1f-417c-b460-9487f269a078.aspx</guid>
      <link>http://blogs.thesitedoctor.co.uk/test/2010/12/14/SQLServerWarningFatalError823OccurredAtDateTimeNoteTheErrorAndTimeAndContactYourSystemAdministrator.aspx</link>
      <pubDate>Tue, 14 Dec 2010 12:46:42 GMT</pubDate>
      <description>&lt;p&gt;
&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top: 0px; border-right: 0px; padding-top: 0px" title="error[2]" border="0" alt="error[2]" align="right" src="http://blogs.thesitedoctor.co.uk/tim/images/616c06524d21_ABF1/error2.png" width="260" height="260" /&gt;We
were contacted the other day by a client with issues selecting data from one of their
tables after a recent server crash (not running on our servers or a site that we were
involved in developing). The issue was easy enough to recreate as you just needed
to select records after the server crash and you'd get the error:
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:066de93b-0bfa-4bff-ab25-4f6d104e0588" class="wlWriterEditableSmartContent"&gt;&lt;pre class="brush: text;"&gt;Warning: Fatal error 823 occurred at date / time Note the error and time, and contact your system administrator.&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
A quick Google suggests a physical disk drive error and having a quick look at the
issues it wasn't pretty. Running:
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:4ef19624-c777-4d57-b382-bf4757d70a3a" class="wlWriterEditableSmartContent"&gt;&lt;pre class="brush: sql;"&gt;DBCC CHECKDB('DatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
Resulted in:
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:5aa36243-c2a8-4d90-bb96-b88e4bdf61a9" class="wlWriterEditableSmartContent"&gt;&lt;pre class="brush: xml;"&gt;Msg 8909, Level 16, State 1, Line 5 
Table error: Object ID 0, index ID 12341, page ID (1:5880). The PageId in the page header = (9728:16777220). 
CHECKTABLE found 0 allocation errors and 1 consistency errors not associated with any single object. 


....


DBCC results for 'TableName'. 
Msg 8928, Level 16, State 1, Line 5 
Object ID 871674153, index ID 0: Page (1:5880) could not be processed. See other errors for details. 


....


There are 20993 rows in 584 pages for object 'TableName'. 
CHECKTABLE found 0 allocation errors and 8 consistency errors in table 'TableName' (object ID 871674153). 
Msg 8909, Level 16, State 1, Line 5 
Table error: Object ID 1109413712, index ID 24940, page ID (1:5883). The PageId in the page header = (25198:1632843825). 
CHECKTABLE found 0 allocation errors and 1 consistency errors in table '(Object ID 1109413712)' (object ID 1109413712). &lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
Most of the solutions found on Google resulted in some form of system restore but
that's no good in this instance as the backups only existed for after the problem
was identified (great eh!) so were useless.
&lt;/p&gt;
&lt;p&gt;
Although it's not an ideal solution, you can use DBCC CHECKTABLE which in our case
fixed the issue:
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:7aaaa196-804c-4161-afb0-12132fca51e1" class="wlWriterEditableSmartContent"&gt;&lt;pre class="brush: sql;"&gt;--Put the database into single user mode
ALTER DATABASE [db2370] SET SINGLE_USER WITH NO_WAIT
--Check the erors and fix any issues found (that you can)
DBCC CHECKTABLE ('Orders', REPAIR_REBUILD)
--Put the database back into multiuser mode
ALTER DATABASE [db2370] SET MULTI_USER WITH NO_WAIT&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
&amp;#160;
&lt;/p&gt;
&lt;p&gt;
I'd be interested to know other solutions people may have to this issue.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Note to readers:&lt;/strong&gt; Check that your hosting provider performs regular
backups and checks the health of your server regularly to avoid this happening to
you.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blogs.thesitedoctor.co.uk/test/aggbug.ashx?id=06a7ede9-ec1f-417c-b460-9487f269a078" /&gt;</description>
      <comments>http://blogs.thesitedoctor.co.uk/test/CommentView,guid,06a7ede9-ec1f-417c-b460-9487f269a078.aspx</comments>
      <category>Server Maintenance</category>
      <category>Server Management</category>
      <category>SQL</category>
      <category>SQL Server</category>
    </item>
    <item>
      <trackback:ping>http://blogs.thesitedoctor.co.uk/test/Trackback.aspx?guid=3c783a9f-6450-4b6b-a372-5bb8c9ca109f</trackback:ping>
      <pingback:server>http://blogs.thesitedoctor.co.uk/test/pingback.aspx</pingback:server>
      <pingback:target>http://blogs.thesitedoctor.co.uk/test/PermaLink,guid,3c783a9f-6450-4b6b-a372-5bb8c9ca109f.aspx</pingback:target>
      <dc:creator>Tim</dc:creator>
      <wfw:comment>http://blogs.thesitedoctor.co.uk/test/CommentView,guid,3c783a9f-6450-4b6b-a372-5bb8c9ca109f.aspx</wfw:comment>
      <wfw:commentRss>http://blogs.thesitedoctor.co.uk/test/SyndicationService.asmx/GetEntryCommentsRss?guid=3c783a9f-6450-4b6b-a372-5bb8c9ca109f</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" align="right" src="http://blogs.thesitedoctor.co.uk/tim/images/Download-any-document-types-values-as-cr_ECF7/image.png" width="320" height="260" />In
a follow up to my post yesterday -<a href="http://blogs.thesitedoctor.co.uk/tim/2010/11/08/Download+Umbraco+Content+Properties+Into+A+Crosstab+Table.aspx" target="_blank">How
to download Umbraco content properties into a crosstab table</a> this is the follow
up SQL Script that makes it even easier to download any Umbraco document type into
Excel.
</p>
        <p>
This SQL Script is fairly simple, basically what it does is it gets the properties
associated with the specified document type and then pivots the values so you end
up with a table of data that looks like this:
</p>
        <table border="0" cellspacing="0" cellpadding="2">
          <thead>
            <tr>
              <th valign="top" width="20">
Id</th>
              <th valign="top" width="20">
Property 1</th>
              <th valign="top" width="20">
Property 2</th>
              <th valign="top" width="20">
Property 3</th>
              <th valign="top" width="237">
Property n</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td valign="top" width="20">
123</td>
              <td valign="top" width="20">
String</td>
              <td valign="top" width="20">
Int</td>
              <td valign="top" width="20">
Date</td>
              <td valign="top" width="237">
xxx</td>
            </tr>
          </tbody>
        </table>
        <h2>How to use the script
</h2>
        <p>
All you need to do is set the parameter "@ContentTypeId" to the document type you
want (as in my <a href="http://blogs.thesitedoctor.co.uk/tim/2010/11/08/Download+Umbraco+Content+Properties+Into+A+Crosstab+Table.aspx" target="_blank">previous
post</a> you can get this by checking out the link on the document type).
</p>
        <p>
Once you set the id, just run the script and voila there's the data.
</p>
        <p>
If you run the code and get "Command(s) completed successfully" then you've not set
the id right so double check and try again.
</p>
        <h2>The Script
</h2>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:40c53f65-8da0-43c3-ba9d-5f15451a170e" class="wlWriterEditableSmartContent">
          <pre class="brush: sql;">DECLARE @cols NVARCHAR(max), @ContentTypeId int
SET @ContentTypeId = 1074

SELECT  @cols = STUFF(( 
	SELECT DISTINCT TOP 100 PERCENT
        '],[' 
        + CONVERT(varchar, Name + ' (' + CONVERT(varchar, id) + ')', 255)
    FROM
		dbo.cmsPropertyType
	WHERE
		contentTypeId = @ContentTypeId
    ORDER BY
        '],[' 
        + CONVERT(varchar, Name + ' (' + CONVERT(varchar, id) + ')', 255)
    FOR XML PATH('')
), 1, 2, '') + ']'
--SELECT  @cols

DECLARE @query NVARCHAR(max)
SET @query = N'SELECT Id, ' + @cols + '
FROM
  (
		SELECT
			CONVERT(varchar, t.Name + '' ('' + CONVERT(varchar, t.id) + '')'', 255) As [PropId],
			contentNodeId As [Id],
			ISNULL(dataNvarchar, ISNULL(CONVERT(varchar, dataDate), ISNULL(CONVERT(varchar, dataInt), dataNtext))) As [Value]
		FROM
			dbo.cmsPropertyType t LEFT JOIN dbo.cmsPropertyData d ON t.id = d.propertytypeid
		WHERE
			contentTypeId = ' + CONVERT(varchar, @ContentTypeId) + ' 
) p
PIVOT
(
	MAX(Value) 
	FOR PropId IN ( '+ @cols +' )
) AS pvt
ORDER BY Id ASC'

--PRINT(@query)
EXECUTE(@query)</pre>
        </div>
        <img width="0" height="0" src="http://blogs.thesitedoctor.co.uk/test/aggbug.ashx?id=3c783a9f-6450-4b6b-a372-5bb8c9ca109f" />
      </body>
      <title>Download any Umbraco document type’s values as crosstab/Excel table</title>
      <guid isPermaLink="false">http://blogs.thesitedoctor.co.uk/test/PermaLink,guid,3c783a9f-6450-4b6b-a372-5bb8c9ca109f.aspx</guid>
      <link>http://blogs.thesitedoctor.co.uk/test/2010/11/09/DownloadAnyUmbracoDocumentTypesValuesAsCrosstabExcelTable.aspx</link>
      <pubDate>Tue, 09 Nov 2010 21:16:24 GMT</pubDate>
      <description>&lt;p&gt;
&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" align="right" src="http://blogs.thesitedoctor.co.uk/tim/images/Download-any-document-types-values-as-cr_ECF7/image.png" width="320" height="260" /&gt;In
a follow up to my post yesterday -&lt;a href="http://blogs.thesitedoctor.co.uk/tim/2010/11/08/Download+Umbraco+Content+Properties+Into+A+Crosstab+Table.aspx" target="_blank"&gt;How
to download Umbraco content properties into a crosstab table&lt;/a&gt; this is the follow
up SQL Script that makes it even easier to download any Umbraco document type into
Excel.
&lt;/p&gt;
&lt;p&gt;
This SQL Script is fairly simple, basically what it does is it gets the properties
associated with the specified document type and then pivots the values so you end
up with a table of data that looks like this:
&lt;/p&gt;
&lt;table border="0" cellspacing="0" cellpadding="2"&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th valign="top" width="20"&gt;
Id&lt;/th&gt;
&lt;th valign="top" width="20"&gt;
Property 1&lt;/th&gt;
&lt;th valign="top" width="20"&gt;
Property 2&lt;/th&gt;
&lt;th valign="top" width="20"&gt;
Property 3&lt;/th&gt;
&lt;th valign="top" width="237"&gt;
Property n&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td valign="top" width="20"&gt;
123&lt;/td&gt;
&lt;td valign="top" width="20"&gt;
String&lt;/td&gt;
&lt;td valign="top" width="20"&gt;
Int&lt;/td&gt;
&lt;td valign="top" width="20"&gt;
Date&lt;/td&gt;
&lt;td valign="top" width="237"&gt;
xxx&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2&gt;How to use the script
&lt;/h2&gt;
&lt;p&gt;
All you need to do is set the parameter "@ContentTypeId" to the document type you
want (as in my &lt;a href="http://blogs.thesitedoctor.co.uk/tim/2010/11/08/Download+Umbraco+Content+Properties+Into+A+Crosstab+Table.aspx" target="_blank"&gt;previous
post&lt;/a&gt; you can get this by checking out the link on the document type).
&lt;/p&gt;
&lt;p&gt;
Once you set the id, just run the script and voila there's the data.
&lt;/p&gt;
&lt;p&gt;
If you run the code and get "Command(s) completed successfully" then you've not set
the id right so double check and try again.
&lt;/p&gt;
&lt;h2&gt;The Script
&lt;/h2&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:40c53f65-8da0-43c3-ba9d-5f15451a170e" class="wlWriterEditableSmartContent"&gt;&lt;pre class="brush: sql;"&gt;DECLARE @cols NVARCHAR(max), @ContentTypeId int
SET @ContentTypeId = 1074

SELECT  @cols = STUFF(( 
	SELECT DISTINCT TOP 100 PERCENT
        '],[' 
        + CONVERT(varchar, Name + ' (' + CONVERT(varchar, id) + ')', 255)
    FROM
		dbo.cmsPropertyType
	WHERE
		contentTypeId = @ContentTypeId
    ORDER BY
        '],[' 
        + CONVERT(varchar, Name + ' (' + CONVERT(varchar, id) + ')', 255)
    FOR XML PATH('')
), 1, 2, '') + ']'
--SELECT  @cols

DECLARE @query NVARCHAR(max)
SET @query = N'SELECT Id, ' + @cols + '
FROM
  (
		SELECT
			CONVERT(varchar, t.Name + '' ('' + CONVERT(varchar, t.id) + '')'', 255) As [PropId],
			contentNodeId As [Id],
			ISNULL(dataNvarchar, ISNULL(CONVERT(varchar, dataDate), ISNULL(CONVERT(varchar, dataInt), dataNtext))) As [Value]
		FROM
			dbo.cmsPropertyType t LEFT JOIN dbo.cmsPropertyData d ON t.id = d.propertytypeid
		WHERE
			contentTypeId = ' + CONVERT(varchar, @ContentTypeId) + ' 
) p
PIVOT
(
	MAX(Value) 
	FOR PropId IN ( '+ @cols +' )
) AS pvt
ORDER BY Id ASC'

--PRINT(@query)
EXECUTE(@query)&lt;/pre&gt;
&lt;/div&gt;
&lt;img width="0" height="0" src="http://blogs.thesitedoctor.co.uk/test/aggbug.ashx?id=3c783a9f-6450-4b6b-a372-5bb8c9ca109f" /&gt;</description>
      <comments>http://blogs.thesitedoctor.co.uk/test/CommentView,guid,3c783a9f-6450-4b6b-a372-5bb8c9ca109f.aspx</comments>
      <category>SQL</category>
      <category>SQL Server</category>
      <category>The Site Doctor</category>
      <category>Umbraco</category>
      <category>Web Development</category>
    </item>
    <item>
      <trackback:ping>http://blogs.thesitedoctor.co.uk/test/Trackback.aspx?guid=b9a65412-9eeb-411a-b5b3-174acfd3be95</trackback:ping>
      <pingback:server>http://blogs.thesitedoctor.co.uk/test/pingback.aspx</pingback:server>
      <pingback:target>http://blogs.thesitedoctor.co.uk/test/PermaLink,guid,b9a65412-9eeb-411a-b5b3-174acfd3be95.aspx</pingback:target>
      <dc:creator>Tim</dc:creator>
      <wfw:comment>http://blogs.thesitedoctor.co.uk/test/CommentView,guid,b9a65412-9eeb-411a-b5b3-174acfd3be95.aspx</wfw:comment>
      <wfw:commentRss>http://blogs.thesitedoctor.co.uk/test/SyndicationService.asmx/GetEntryCommentsRss?guid=b9a65412-9eeb-411a-b5b3-174acfd3be95</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Have you ever needed to get a download of your Umbraco content nodes in a cross-tab
query e.g. download contact form data from Doc2Form? Using Umbraco's Contour product
makes this a breeze but what about older systems? Thankfully, it's not actually that
difficult.
</p>
        <p>
We have a contact us form on one of our sites which uses an old version of Doc2Form
which emails the customer details of the enquiry. One benefit is it also saves it
to the recycle bin as a document with the name: "RE: SYSTEM DATA: umbraco master root".
With that in mind, we can use SQL Server's PIVOT functionality to pull the data out
in a nicely formatted manner.
</p>
        <p>
Firstly you'll need to know the id's of the document type's properties, there are
numerous ways to do this:
</p>
        <h4>1. Just look at the cmsPropertyData table for a couple of content nodes (I could
spot the ones I was after fairly easily)
</h4>
        <h4> 
</h4>
        <h4>2. Query the cmsPropertyType table:
</h4>
        <p>
Find the contentTypeId of the document type -you can do this by hovering your mouse
over the document type in the tree and checking out the status bar (you can see the
contentTypeId in brackets in the bottom left -mine here is 1074):
</p>
        <p>
          <img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.thesitedoctor.co.uk/tim/images/Download-Doc2Form-submissions-into-a-cro_E327/image.png" width="380" height="193" />
        </p>
        <p>
Once you have the contentTypeId of the document type, you can then get the ids of
all the properties you're after by replacing "xxx" with your property id in the following
script:
</p>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:71eda8ba-092a-44b9-b9fc-6a45ae1d9b07" class="wlWriterEditableSmartContent">
          <pre class="brush: sql;">SELECT * FROM dbo.cmsPropertyType WHERE contentTypeId = xxx</pre>
        </div>
        <h4>3. Get it from the source of the document type editor
</h4>
        <p>
An alternative way is to examine the HTML of the Document Type editor. If you view
the source on the "Generic Properties" tab and scroll to the section you're interested
in (there'll be a h2 with the same name) you will find a ul that has the class of
"genericPropertyList".
</p>
        <p>
Each li of that ul will have the relevant id as part of it's id e.g. for a section
called "Enquiry Form" the id will be: "EnquiryFormContents_49" where "49" is the id
we're interested in. You can see mine (49, 50, 51 and 52 below):
</p>
        <p>
          <img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.thesitedoctor.co.uk/tim/images/Download-Doc2Form-submissions-into-a-cro_E327/image_3.png" width="704" height="186" />
        </p>
        <p>
Once you have these ids to hand (mine were 49, 50, 51 and 52) you just need to update
the code below and run against your Umbraco database:
</p>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:2f63fc8a-d1ea-42b9-b6ef-f5a410c9b989" class="wlWriterEditableSmartContent">
          <pre class="brush: sql;">SELECT
	contentNodeId As [Id], 
	[49] As [Name], 
	[50] As [Telephone], 
	[51] As [Email Address], 
	[52] As [Notes]
FROM
(
	SELECT contentNodeId, propertytypeid, ISNULL(dataNvarchar, dataNtext) As [Value]
	FROM dbo.cmsPropertyData
) As src
PIVOT (
	MAX(Value) 
	FOR propertytypeid in ([49], [50], [51], [52])
) aS pvt
WHERE [50] IS NOT NULL OR [51] IS NOT NULL
ORDER BY contentNodeId</pre>
        </div>
        <p>
 
</p>
        <p>
That will then produce some lovely formatted data for you, my example above produced:
</p>
        <table border="0" cellspacing="0" cellpadding="2">
          <thead>
            <tr>
              <th valign="top" width="100">
Id</th>
              <th valign="top" width="100">
Name</th>
              <th valign="top" width="100">
Telephone</th>
              <th valign="top" width="100">
Email Address</th>
              <th valign="top" width="100">
Notes</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td valign="top" width="100">
1154</td>
              <td valign="top" width="100">
Example</td>
              <td valign="top" width="100">
01234567890</td>
              <td valign="top" width="100">
                <a href="mailto:test@test.com">test@test.com</a>
              </td>
              <td valign="top" width="100">
Please contact me as soon as possible about your great site, thanks.</td>
            </tr>
          </tbody>
        </table>
        <p>
 
</p>
        <p>
It's also possible to automate this entire script so you don't need to find out the
property ids, I'll post that separately.
</p>
        <img width="0" height="0" src="http://blogs.thesitedoctor.co.uk/test/aggbug.ashx?id=b9a65412-9eeb-411a-b5b3-174acfd3be95" />
      </body>
      <title>Download Umbraco content properties into a crosstab table</title>
      <guid isPermaLink="false">http://blogs.thesitedoctor.co.uk/test/PermaLink,guid,b9a65412-9eeb-411a-b5b3-174acfd3be95.aspx</guid>
      <link>http://blogs.thesitedoctor.co.uk/test/2010/11/08/DownloadUmbracoContentPropertiesIntoACrosstabTable.aspx</link>
      <pubDate>Mon, 08 Nov 2010 16:37:19 GMT</pubDate>
      <description>&lt;p&gt;
Have you ever needed to get a download of your Umbraco content nodes in a cross-tab
query e.g. download contact form data from Doc2Form? Using Umbraco's Contour product
makes this a breeze but what about older systems? Thankfully, it's not actually that
difficult.
&lt;/p&gt;
&lt;p&gt;
We have a contact us form on one of our sites which uses an old version of Doc2Form
which emails the customer details of the enquiry. One benefit is it also saves it
to the recycle bin as a document with the name: "RE: SYSTEM DATA: umbraco master root".
With that in mind, we can use SQL Server's PIVOT functionality to pull the data out
in a nicely formatted manner.
&lt;/p&gt;
&lt;p&gt;
Firstly you'll need to know the id's of the document type's properties, there are
numerous ways to do this:
&lt;/p&gt;
&lt;h4&gt;1. Just look at the cmsPropertyData table for a couple of content nodes (I could
spot the ones I was after fairly easily)
&lt;/h4&gt;
&lt;h4&gt;&amp;#160;
&lt;/h4&gt;
&lt;h4&gt;2. Query the cmsPropertyType table:
&lt;/h4&gt;
&lt;p&gt;
Find the contentTypeId of the document type -you can do this by hovering your mouse
over the document type in the tree and checking out the status bar (you can see the
contentTypeId in brackets in the bottom left -mine here is 1074):
&lt;/p&gt;
&lt;p&gt;
&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.thesitedoctor.co.uk/tim/images/Download-Doc2Form-submissions-into-a-cro_E327/image.png" width="380" height="193" /&gt;
&lt;/p&gt;
&lt;p&gt;
Once you have the contentTypeId of the document type, you can then get the ids of
all the properties you're after by replacing "xxx" with your property id in the following
script:
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:71eda8ba-092a-44b9-b9fc-6a45ae1d9b07" class="wlWriterEditableSmartContent"&gt;&lt;pre class="brush: sql;"&gt;SELECT * FROM dbo.cmsPropertyType WHERE contentTypeId = xxx&lt;/pre&gt;
&lt;/div&gt;
&lt;h4&gt;3. Get it from the source of the document type editor
&lt;/h4&gt;
&lt;p&gt;
An alternative way is to examine the HTML of the Document Type editor. If you view
the source on the "Generic Properties" tab and scroll to the section you're interested
in (there'll be a h2 with the same name) you will find a ul that has the class of
"genericPropertyList".
&lt;/p&gt;
&lt;p&gt;
Each li of that ul will have the relevant id as part of it's id e.g. for a section
called "Enquiry Form" the id will be: "EnquiryFormContents_49" where "49" is the id
we're interested in. You can see mine (49, 50, 51 and 52 below):
&lt;/p&gt;
&lt;p&gt;
&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.thesitedoctor.co.uk/tim/images/Download-Doc2Form-submissions-into-a-cro_E327/image_3.png" width="704" height="186" /&gt;
&lt;/p&gt;
&lt;p&gt;
Once you have these ids to hand (mine were 49, 50, 51 and 52) you just need to update
the code below and run against your Umbraco database:
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:2f63fc8a-d1ea-42b9-b6ef-f5a410c9b989" class="wlWriterEditableSmartContent"&gt;&lt;pre class="brush: sql;"&gt;SELECT
	contentNodeId As [Id], 
	[49] As [Name], 
	[50] As [Telephone], 
	[51] As [Email Address], 
	[52] As [Notes]
FROM
(
	SELECT contentNodeId, propertytypeid, ISNULL(dataNvarchar, dataNtext) As [Value]
	FROM dbo.cmsPropertyData
) As src
PIVOT (
	MAX(Value) 
	FOR propertytypeid in ([49], [50], [51], [52])
) aS pvt
WHERE [50] IS NOT NULL OR [51] IS NOT NULL
ORDER BY contentNodeId&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
&amp;#160;
&lt;/p&gt;
&lt;p&gt;
That will then produce some lovely formatted data for you, my example above produced:
&lt;/p&gt;
&lt;table border="0" cellspacing="0" cellpadding="2"&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th valign="top" width="100"&gt;
Id&lt;/th&gt;
&lt;th valign="top" width="100"&gt;
Name&lt;/th&gt;
&lt;th valign="top" width="100"&gt;
Telephone&lt;/th&gt;
&lt;th valign="top" width="100"&gt;
Email Address&lt;/th&gt;
&lt;th valign="top" width="100"&gt;
Notes&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td valign="top" width="100"&gt;
1154&lt;/td&gt;
&lt;td valign="top" width="100"&gt;
Example&lt;/td&gt;
&lt;td valign="top" width="100"&gt;
01234567890&lt;/td&gt;
&lt;td valign="top" width="100"&gt;
&lt;a href="mailto:test@test.com"&gt;test@test.com&lt;/a&gt;&lt;/td&gt;
&lt;td valign="top" width="100"&gt;
Please contact me as soon as possible about your great site, thanks.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;
&amp;#160;
&lt;/p&gt;
&lt;p&gt;
It's also possible to automate this entire script so you don't need to find out the
property ids, I'll post that separately.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blogs.thesitedoctor.co.uk/test/aggbug.ashx?id=b9a65412-9eeb-411a-b5b3-174acfd3be95" /&gt;</description>
      <comments>http://blogs.thesitedoctor.co.uk/test/CommentView,guid,b9a65412-9eeb-411a-b5b3-174acfd3be95.aspx</comments>
      <category>Development</category>
      <category>SQL</category>
      <category>SQL Server</category>
      <category>Umbraco</category>
    </item>
    <item>
      <trackback:ping>http://blogs.thesitedoctor.co.uk/test/Trackback.aspx?guid=f136b7cb-f755-4011-83f2-a1e2192fd666</trackback:ping>
      <pingback:server>http://blogs.thesitedoctor.co.uk/test/pingback.aspx</pingback:server>
      <pingback:target>http://blogs.thesitedoctor.co.uk/test/PermaLink,guid,f136b7cb-f755-4011-83f2-a1e2192fd666.aspx</pingback:target>
      <dc:creator>Tim</dc:creator>
      <wfw:comment>http://blogs.thesitedoctor.co.uk/test/CommentView,guid,f136b7cb-f755-4011-83f2-a1e2192fd666.aspx</wfw:comment>
      <wfw:commentRss>http://blogs.thesitedoctor.co.uk/test/SyndicationService.asmx/GetEntryCommentsRss?guid=f136b7cb-f755-4011-83f2-a1e2192fd666</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top: 0px; border-right: 0px; padding-top: 0px" title="header[1]" border="0" alt="header[1]" align="right" src="http://blogs.thesitedoctor.co.uk/tim/images/64eb161c0baa_93C0/header1.jpg" width="240" height="320" />Probably
one of the most common features of an ecommerce systems is to "retrieve my details"
when logging in -after all that's why you create an account with the seller isn't
it?
</p>
        <p>
Out of the box, <a title="e-commerce package for Umbraco" href="http://www.ucommerce.dk" target="_blank">uCommerce</a> has
XSLT to retrieve the customer's last x addresses but one thing it didn't do was automatically
re-assign the customer's details when logging in using the built in Umbraco membership
code so we need to work around it ourselves -don't worry, it's not too hard (all the
code is below for you).
</p>
        <h2>Background
</h2>
        <p>
All customer addresses are stored in the uCommerce_Address table automatically, there
should be one unique address per customer however if you're on an earlier release
you may find you have several copies of the same address for each customer -this is
a bug that's been sorted in v1.0.5.0 so upgrade if you can.
</p>
        <p>
Now you'd be forgiven for thinking that you can just select the address from the uCommerce_Address
table and then assign the id to the BillingAddressId property of your purchase order
however if you do that, you'll find you get the error:
</p>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:d9065df3-b3b8-496d-a9a1-63b491ac4cd1" class="wlWriterEditableSmartContent">
          <pre class="brush: text;">The UPDATE statement conflicted with the FOREIGN KEY constraint "FK_uCommerce_PurchaseOrder_uCommerce_OrderAddress". 
The conflict occurred in database "CommsReadyCMS", table "dbo.uCommerce_OrderAddress", column 'OrderAddressId'.
The statement has been terminated.</pre>
        </div>
        <p>
 
</p>
        <p>
You'll get this because there is also a second table involved -uCommerce_OrderAddress.
uCommerce_OrderAddress stores the actual address used throughout the order process
incase the customer changes an address in the future, the order will always have the
correct address.
</p>
        <h2>The Solution
</h2>
        <p>
Working around this isn't actually too difficult as mentioned before. The easiest
solution is to create a new User Control in Visual Studio (I'll call mine login.ascx)
and hook into the LoggedIn event. Once logged in, get the Umbraco member and from
that, get the customer's billing address.
</p>
        <p>
There's one caveat that I found with uCommerce and that's the way it gets the address.
At the moment, there is a function on customer "GetAddress", this is great however
if you check out the code it calls, it actually gets the customer's first address
from the database -rather than the last address used. I don't think this is a bug
as in most cases the first address you enter is your main address. I'll blog separately
about managing a default address within the members section.
</p>
        <p>
The code below however retrieves the most recently added address from the database
</p>
        <h3>Login.ascx
</h3>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:d68c8cf3-8452-49f9-b0bb-8289818fa29a" class="wlWriterEditableSmartContent">
          <pre class="brush: html;">&lt;asp:literal runat="server" ID="litLoggedIn" /&gt;
&lt;asp:literal runat="server" ID="litLoggedOut" /&gt;
&lt;asp:Login runat="server" id="lgnForm" CssClass="checkout-details" 
	DisplayRememberMe="false" TitleText="" OnLoggedIn="lgnForm_LoggedIn"
	UserNameLabelText="Email Address" /&gt;</pre>
        </div>
        <p>
 
</p>
        <h3>Login.ascx.cs
</h3>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:3dd0ffef-512f-4f41-908f-26b340668e45" class="wlWriterEditableSmartContent">
          <pre class="brush: c#;">protected void lgnForm_LoggedIn(object sender, EventArgs e)
{
    //If the user has a basket, wire up the shipping address with their last order details
    var basket = SiteContext.Current.OrderContext.GetBasket(true);
    if (basket != null)
    {
        //Get the customers current order
        var po = basket.PurchaseOrder;
        //Look for a shipping address
        var add = po.GetBillingAddress();
        //We only need to assign the address if there isn't already one assigned to this order
        if (add == null)
        {
            //Get the customer who's just logged in
            var mem = Membership.GetUser(lgnForm.UserName);
            //To be safe check that we have a member
            if (mem != null)
            {
                //Find the customer
                var customer = Customer.ForUmbracoMember(Convert.ToInt32(mem.ProviderUserKey));
                if (customer != null)
                {
                    //Get the customer's most recent address
                    var previousAddress = customer.Addresses.ToList().LastOrDefault(a =&gt; a.AddressName == "Billing");
                    //If you want to get the customer's first address just uncomment this line
                    //var previousAddress = customer.GetAddress("Billing");

                    //Populate the billing address with the address)
                    if (previousAddress != null)
                    {
                        OrderAddress address = new OrderAddress
                                {
                                    FirstName = previousAddress.FirstName,
                                    LastName = previousAddress.LastName,
                                    EmailAddress = previousAddress.EmailAddress,
                                    PhoneNumber = previousAddress.PhoneNumber,
                                    MobilePhoneNumber = previousAddress.MobilePhoneNumber,
                                    CompanyName = previousAddress.CompanyName,
                                    Line1 = previousAddress.Line1,
                                    Line2 = previousAddress.Line2,
                                    PostalCode = previousAddress.PostalCode,
                                    City = previousAddress.City,
                                    State = previousAddress.State,
                                    Attention = previousAddress.Attention,
                                    CountryId = previousAddress.CountryId,
                                    AddressName = "Billing",
                                    OrderId = new int?(po.OrderId)
                                };
                        //Store the address in the database
                        address.Save();
                        //Assign the address to the purchase order
                        po.BillingAddressId = new int?(address.OrderAddressId);
                        //Save the purchase order (shopping cart)
                        po.Save();
                    }
                }
            }
        }
    }
}
</pre>
        </div>
        <img width="0" height="0" src="http://blogs.thesitedoctor.co.uk/test/aggbug.ashx?id=f136b7cb-f755-4011-83f2-a1e2192fd666" />
      </body>
      <title>Retrieve the customer’s last address when logging into uCommerce</title>
      <guid isPermaLink="false">http://blogs.thesitedoctor.co.uk/test/PermaLink,guid,f136b7cb-f755-4011-83f2-a1e2192fd666.aspx</guid>
      <link>http://blogs.thesitedoctor.co.uk/test/2010/10/26/RetrieveTheCustomersLastAddressWhenLoggingIntoUCommerce.aspx</link>
      <pubDate>Tue, 26 Oct 2010 10:31:55 GMT</pubDate>
      <description>&lt;p&gt;
&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top: 0px; border-right: 0px; padding-top: 0px" title="header[1]" border="0" alt="header[1]" align="right" src="http://blogs.thesitedoctor.co.uk/tim/images/64eb161c0baa_93C0/header1.jpg" width="240" height="320" /&gt;Probably
one of the most common features of an ecommerce systems is to "retrieve my details"
when logging in -after all that's why you create an account with the seller isn't
it?
&lt;/p&gt;
&lt;p&gt;
Out of the box, &lt;a title="e-commerce package for Umbraco" href="http://www.ucommerce.dk" target="_blank"&gt;uCommerce&lt;/a&gt; has
XSLT to retrieve the customer's last x addresses but one thing it didn't do was automatically
re-assign the customer's details when logging in using the built in Umbraco membership
code so we need to work around it ourselves -don't worry, it's not too hard (all the
code is below for you).
&lt;/p&gt;
&lt;h2&gt;Background
&lt;/h2&gt;
&lt;p&gt;
All customer addresses are stored in the uCommerce_Address table automatically, there
should be one unique address per customer however if you're on an earlier release
you may find you have several copies of the same address for each customer -this is
a bug that's been sorted in v1.0.5.0 so upgrade if you can.
&lt;/p&gt;
&lt;p&gt;
Now you'd be forgiven for thinking that you can just select the address from the uCommerce_Address
table and then assign the id to the BillingAddressId property of your purchase order
however if you do that, you'll find you get the error:
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:d9065df3-b3b8-496d-a9a1-63b491ac4cd1" class="wlWriterEditableSmartContent"&gt;&lt;pre class="brush: text;"&gt;The UPDATE statement conflicted with the FOREIGN KEY constraint "FK_uCommerce_PurchaseOrder_uCommerce_OrderAddress". 
The conflict occurred in database "CommsReadyCMS", table "dbo.uCommerce_OrderAddress", column 'OrderAddressId'.
The statement has been terminated.&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
&amp;#160;
&lt;/p&gt;
&lt;p&gt;
You'll get this because there is also a second table involved -uCommerce_OrderAddress.
uCommerce_OrderAddress stores the actual address used throughout the order process
incase the customer changes an address in the future, the order will always have the
correct address.
&lt;/p&gt;
&lt;h2&gt;The Solution
&lt;/h2&gt;
&lt;p&gt;
Working around this isn't actually too difficult as mentioned before. The easiest
solution is to create a new User Control in Visual Studio (I'll call mine login.ascx)
and hook into the LoggedIn event. Once logged in, get the Umbraco member and from
that, get the customer's billing address.
&lt;/p&gt;
&lt;p&gt;
There's one caveat that I found with uCommerce and that's the way it gets the address.
At the moment, there is a function on customer "GetAddress", this is great however
if you check out the code it calls, it actually gets the customer's first address
from the database -rather than the last address used. I don't think this is a bug
as in most cases the first address you enter is your main address. I'll blog separately
about managing a default address within the members section.
&lt;/p&gt;
&lt;p&gt;
The code below however retrieves the most recently added address from the database
&lt;/p&gt;
&lt;h3&gt;Login.ascx
&lt;/h3&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:d68c8cf3-8452-49f9-b0bb-8289818fa29a" class="wlWriterEditableSmartContent"&gt;&lt;pre class="brush: html;"&gt;&amp;lt;asp:literal runat="server" ID="litLoggedIn" /&amp;gt;
&amp;lt;asp:literal runat="server" ID="litLoggedOut" /&amp;gt;
&amp;lt;asp:Login runat="server" id="lgnForm" CssClass="checkout-details" 
	DisplayRememberMe="false" TitleText="" OnLoggedIn="lgnForm_LoggedIn"
	UserNameLabelText="Email Address" /&amp;gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
&amp;#160;
&lt;/p&gt;
&lt;h3&gt;Login.ascx.cs
&lt;/h3&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:3dd0ffef-512f-4f41-908f-26b340668e45" class="wlWriterEditableSmartContent"&gt;&lt;pre class="brush: c#;"&gt;protected void lgnForm_LoggedIn(object sender, EventArgs e)
{
    //If the user has a basket, wire up the shipping address with their last order details
    var basket = SiteContext.Current.OrderContext.GetBasket(true);
    if (basket != null)
    {
        //Get the customers current order
        var po = basket.PurchaseOrder;
        //Look for a shipping address
        var add = po.GetBillingAddress();
        //We only need to assign the address if there isn't already one assigned to this order
        if (add == null)
        {
            //Get the customer who's just logged in
            var mem = Membership.GetUser(lgnForm.UserName);
            //To be safe check that we have a member
            if (mem != null)
            {
                //Find the customer
                var customer = Customer.ForUmbracoMember(Convert.ToInt32(mem.ProviderUserKey));
                if (customer != null)
                {
                    //Get the customer's most recent address
                    var previousAddress = customer.Addresses.ToList().LastOrDefault(a =&amp;gt; a.AddressName == "Billing");
                    //If you want to get the customer's first address just uncomment this line
                    //var previousAddress = customer.GetAddress("Billing");

                    //Populate the billing address with the address)
                    if (previousAddress != null)
                    {
                        OrderAddress address = new OrderAddress
                                {
                                    FirstName = previousAddress.FirstName,
                                    LastName = previousAddress.LastName,
                                    EmailAddress = previousAddress.EmailAddress,
                                    PhoneNumber = previousAddress.PhoneNumber,
                                    MobilePhoneNumber = previousAddress.MobilePhoneNumber,
                                    CompanyName = previousAddress.CompanyName,
                                    Line1 = previousAddress.Line1,
                                    Line2 = previousAddress.Line2,
                                    PostalCode = previousAddress.PostalCode,
                                    City = previousAddress.City,
                                    State = previousAddress.State,
                                    Attention = previousAddress.Attention,
                                    CountryId = previousAddress.CountryId,
                                    AddressName = "Billing",
                                    OrderId = new int?(po.OrderId)
                                };
                        //Store the address in the database
                        address.Save();
                        //Assign the address to the purchase order
                        po.BillingAddressId = new int?(address.OrderAddressId);
                        //Save the purchase order (shopping cart)
                        po.Save();
                    }
                }
            }
        }
    }
}
&lt;/pre&gt;
&lt;/div&gt;
&lt;img width="0" height="0" src="http://blogs.thesitedoctor.co.uk/test/aggbug.ashx?id=f136b7cb-f755-4011-83f2-a1e2192fd666" /&gt;</description>
      <comments>http://blogs.thesitedoctor.co.uk/test/CommentView,guid,f136b7cb-f755-4011-83f2-a1e2192fd666.aspx</comments>
      <category>ASP.Net</category>
      <category>C#</category>
      <category>eCommerce</category>
      <category>The Site Doctor</category>
      <category>uCommerce</category>
      <category>Umbraco</category>
      <category>Web Development</category>
    </item>
    <item>
      <trackback:ping>http://blogs.thesitedoctor.co.uk/test/Trackback.aspx?guid=24a92c7d-a542-453a-ba32-20d44e192d8a</trackback:ping>
      <pingback:server>http://blogs.thesitedoctor.co.uk/test/pingback.aspx</pingback:server>
      <pingback:target>http://blogs.thesitedoctor.co.uk/test/PermaLink,guid,24a92c7d-a542-453a-ba32-20d44e192d8a.aspx</pingback:target>
      <dc:creator>Tim</dc:creator>
      <wfw:comment>http://blogs.thesitedoctor.co.uk/test/CommentView,guid,24a92c7d-a542-453a-ba32-20d44e192d8a.aspx</wfw:comment>
      <wfw:commentRss>http://blogs.thesitedoctor.co.uk/test/SyndicationService.asmx/GetEntryCommentsRss?guid=24a92c7d-a542-453a-ba32-20d44e192d8a</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
After my last <a title="e-commerce package for Umbraco" href="http://www.ucommerce.dk" target="_blank">UCommerce</a> post
on <a href="http://blogs.thesitedoctor.co.uk/tim/2010/10/01/Deleting+Test+Orders+And+Baskets+From+UCommerce.aspx" target="_blank">how
to delete test orders and baskets from UCommerce</a>, Søren suggested I extended the
delete all baskets code to take into account when it was created. As my last code
was relating to deleting test orders/baskets (and so would want to get rid of them
all), I decided to post this one separately.
</p>
        <h2>Delete all baskets older than x days
</h2>
        <p>
To use this, all you need to do is change the @addedBefore parameter to whatever date/time
you want (or just adjust the –7 which represents seven days in the past.
</p>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:45241e23-0c18-443a-941a-ce974b893ca9" class="wlWriterEditableSmartContent">
          <pre class="brush: sql;">--Delete all carts purchaseorders and associated data within x days
DECLARE @addedBefore smalldatetime
--By default the script deletes everything older than 7 days
SET @addedBefore = DATEADD(dd, -7, GETDATE())

BEGIN TRAN

UPDATE uCommerce_PurchaseOrder SET BillingAddressId = NULL WHERE OrderNumber IS NULL AND CreatedDate &lt;= @addedBefore
DELETE a FROM uCommerce_Shipment a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.OrderNumber IS NULL AND b.CreatedDate &lt;= @addedBefore
DELETE a FROM uCommerce_OrderAddress a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.OrderNumber IS NULL AND b.CreatedDate &lt;= @addedBefore
DELETE a FROM uCommerce_OrderProperty a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.OrderNumber IS NULL AND b.CreatedDate &lt;= @addedBefore
DELETE a FROM uCommerce_OrderLine a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.OrderNumber IS NULL AND b.CreatedDate &lt;= @addedBefore
DELETE a FROM uCommerce_Payment a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.OrderNumber IS NULL AND b.CreatedDate &lt;= @addedBefore
DELETE a FROM uCommerce_OrderStatusAudit a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.OrderNumber IS NULL AND b.CreatedDate &lt;= @addedBefore
DELETE FROM uCommerce_PurchaseOrder WHERE OrderNumber IS NULL AND CreatedDate &lt;= @addedBefore

--Uncomment this
--COMMIT TRAN

--And comment out this
ROLLBACK TRAN</pre>
        </div>
        <img width="0" height="0" src="http://blogs.thesitedoctor.co.uk/test/aggbug.ashx?id=24a92c7d-a542-453a-ba32-20d44e192d8a" />
      </body>
      <title>Delete all UCommerce baskets older than x days</title>
      <guid isPermaLink="false">http://blogs.thesitedoctor.co.uk/test/PermaLink,guid,24a92c7d-a542-453a-ba32-20d44e192d8a.aspx</guid>
      <link>http://blogs.thesitedoctor.co.uk/test/2010/10/04/DeleteAllUCommerceBasketsOlderThanXDays.aspx</link>
      <pubDate>Mon, 04 Oct 2010 09:14:31 GMT</pubDate>
      <description>&lt;p&gt;
After my last &lt;a title="e-commerce package for Umbraco" href="http://www.ucommerce.dk" target="_blank"&gt;UCommerce&lt;/a&gt; post
on &lt;a href="http://blogs.thesitedoctor.co.uk/tim/2010/10/01/Deleting+Test+Orders+And+Baskets+From+UCommerce.aspx" target="_blank"&gt;how
to delete test orders and baskets from UCommerce&lt;/a&gt;, Søren suggested I extended the
delete all baskets code to take into account when it was created. As my last code
was relating to deleting test orders/baskets (and so would want to get rid of them
all), I decided to post this one separately.
&lt;/p&gt;
&lt;h2&gt;Delete all baskets older than x days
&lt;/h2&gt;
&lt;p&gt;
To use this, all you need to do is change the @addedBefore parameter to whatever date/time
you want (or just adjust the –7 which represents seven days in the past.
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:45241e23-0c18-443a-941a-ce974b893ca9" class="wlWriterEditableSmartContent"&gt;&lt;pre class="brush: sql;"&gt;--Delete all carts purchaseorders and associated data within x days
DECLARE @addedBefore smalldatetime
--By default the script deletes everything older than 7 days
SET @addedBefore = DATEADD(dd, -7, GETDATE())

BEGIN TRAN

UPDATE uCommerce_PurchaseOrder SET BillingAddressId = NULL WHERE OrderNumber IS NULL AND CreatedDate &amp;lt;= @addedBefore
DELETE a FROM uCommerce_Shipment a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.OrderNumber IS NULL AND b.CreatedDate &amp;lt;= @addedBefore
DELETE a FROM uCommerce_OrderAddress a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.OrderNumber IS NULL AND b.CreatedDate &amp;lt;= @addedBefore
DELETE a FROM uCommerce_OrderProperty a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.OrderNumber IS NULL AND b.CreatedDate &amp;lt;= @addedBefore
DELETE a FROM uCommerce_OrderLine a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.OrderNumber IS NULL AND b.CreatedDate &amp;lt;= @addedBefore
DELETE a FROM uCommerce_Payment a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.OrderNumber IS NULL AND b.CreatedDate &amp;lt;= @addedBefore
DELETE a FROM uCommerce_OrderStatusAudit a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.OrderNumber IS NULL AND b.CreatedDate &amp;lt;= @addedBefore
DELETE FROM uCommerce_PurchaseOrder WHERE OrderNumber IS NULL AND CreatedDate &amp;lt;= @addedBefore

--Uncomment this
--COMMIT TRAN

--And comment out this
ROLLBACK TRAN&lt;/pre&gt;
&lt;/div&gt;
&lt;img width="0" height="0" src="http://blogs.thesitedoctor.co.uk/test/aggbug.ashx?id=24a92c7d-a542-453a-ba32-20d44e192d8a" /&gt;</description>
      <comments>http://blogs.thesitedoctor.co.uk/test/CommentView,guid,24a92c7d-a542-453a-ba32-20d44e192d8a.aspx</comments>
      <category>Development</category>
      <category>eCommerce</category>
      <category>SQL</category>
      <category>SQL Server</category>
      <category>uCommerce</category>
      <category>Umbraco</category>
    </item>
    <item>
      <trackback:ping>http://blogs.thesitedoctor.co.uk/test/Trackback.aspx?guid=fcd3400c-32cd-4b96-819f-ce4adf0cab19</trackback:ping>
      <pingback:server>http://blogs.thesitedoctor.co.uk/test/pingback.aspx</pingback:server>
      <pingback:target>http://blogs.thesitedoctor.co.uk/test/PermaLink,guid,fcd3400c-32cd-4b96-819f-ce4adf0cab19.aspx</pingback:target>
      <dc:creator>Tim</dc:creator>
      <wfw:comment>http://blogs.thesitedoctor.co.uk/test/CommentView,guid,fcd3400c-32cd-4b96-819f-ce4adf0cab19.aspx</wfw:comment>
      <wfw:commentRss>http://blogs.thesitedoctor.co.uk/test/SyndicationService.asmx/GetEntryCommentsRss?guid=fcd3400c-32cd-4b96-819f-ce4adf0cab19</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Although Søren has posted a helpful post on how to <a href="http://www.publicvoid.dk/DeletingPurchaseOrdersAndBasketsFromTheDatabaseInUCommerce.aspx" target="_blank">delete
entire purchase orders from the database here</a>, we needed something a little less
“all or nothing” so put the below together.
</p>
        <h2>Delete a specific order id
</h2>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:c810ee8f-ccc4-4cc1-a251-bd161573c8f7" class="wlWriterEditableSmartContent">
          <pre class="brush: sql;">--Delete purchaseorders and associated data based on order id
DECLARE @OrderNumber nvarchar(50)
SET @OrderNumber = 'TEST-40'

BEGIN TRAN

UPDATE uCommerce_PurchaseOrder SET BillingAddressId = NULL WHERE OrderNumber = @OrderNumber
DELETE a FROM uCommerce_Shipment a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.OrderNumber = @OrderNumber
DELETE a FROM uCommerce_OrderAddress a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.OrderNumber = @OrderNumber
DELETE a FROM uCommerce_OrderProperty a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.OrderNumber = @OrderNumber
DELETE a FROM uCommerce_OrderLine a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.OrderNumber = @OrderNumber
DELETE a FROM uCommerce_Payment a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.OrderNumber = @OrderNumber
DELETE a FROM uCommerce_OrderStatusAudit a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.OrderNumber = @OrderNumber
DELETE FROM uCommerce_PurchaseOrder WHERE OrderNumber = @OrderNumber

--TODO: Expand this so it checks for other orders
--DELETE a FROM uCommerce_Address a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.OrderNumber = @OrderNumber
--DELETE a FROM uCommerce_Customer a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.OrderNumber = @OrderNumber

--Uncomment this
--COMMIT TRAN

--And comment out this
ROLLBACK TRAN</pre>
        </div>
        <br />
        <p>
 
</p>
        <p>
 
</p>
        <h2>Delete all baskets
</h2>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:9b400326-be37-4795-bd43-3a5fd26fa77d" class="wlWriterEditableSmartContent">
          <pre class="brush: sql;">--Delete all carts purchaseorders and associated data

BEGIN TRAN

UPDATE uCommerce_PurchaseOrder SET BillingAddressId = NULL WHERE OrderNumber IS NULL
DELETE a FROM uCommerce_Shipment a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.OrderNumber IS NULL
DELETE a FROM uCommerce_OrderAddress a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.OrderNumber IS NULL
DELETE a FROM uCommerce_OrderProperty a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.OrderNumber IS NULL
DELETE a FROM uCommerce_OrderLine a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.OrderNumber IS NULL
DELETE a FROM uCommerce_Payment a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.OrderNumber IS NULL
DELETE a FROM uCommerce_OrderStatusAudit a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.OrderNumber IS NULL
DELETE FROM uCommerce_PurchaseOrder WHERE OrderNumber IS NULL

--TODO: Expand this so it checks for other orders
--DELETE a FROM uCommerce_Address a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.NULL = @NULL
--DELETE a FROM uCommerce_Customer a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.NULL = @NULL


--Uncomment this
--COMMIT TRAN

--And comment out this
ROLLBACK TRAN</pre>
        </div>
        <br />
        <p>
 
</p>
        <p>
          <strong>Update:</strong> At the request of Søren, I’ve altered the delete all baskets
post so it allows you to delete all baskets older than a given date, see: <a href="http://blogs.thesitedoctor.co.uk/tim/2010/10/04/Delete+All+UCommerce+Baskets+Older+Than+X+Days.aspx" target="_blank">Delete
all UCommerce baskets older than x days</a></p>
        <img width="0" height="0" src="http://blogs.thesitedoctor.co.uk/test/aggbug.ashx?id=fcd3400c-32cd-4b96-819f-ce4adf0cab19" />
      </body>
      <title>Deleting test orders and baskets from uCommerce</title>
      <guid isPermaLink="false">http://blogs.thesitedoctor.co.uk/test/PermaLink,guid,fcd3400c-32cd-4b96-819f-ce4adf0cab19.aspx</guid>
      <link>http://blogs.thesitedoctor.co.uk/test/2010/10/01/DeletingTestOrdersAndBasketsFromUCommerce.aspx</link>
      <pubDate>Fri, 01 Oct 2010 11:53:43 GMT</pubDate>
      <description>&lt;p&gt;
Although Søren has posted a helpful post on how to &lt;a href="http://www.publicvoid.dk/DeletingPurchaseOrdersAndBasketsFromTheDatabaseInUCommerce.aspx" target="_blank"&gt;delete
entire purchase orders from the database here&lt;/a&gt;, we needed something a little less
“all or nothing” so put the below together.
&lt;/p&gt;
&lt;h2&gt;Delete a specific order id
&lt;/h2&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:c810ee8f-ccc4-4cc1-a251-bd161573c8f7" class="wlWriterEditableSmartContent"&gt;&lt;pre class="brush: sql;"&gt;--Delete purchaseorders and associated data based on order id
DECLARE @OrderNumber nvarchar(50)
SET @OrderNumber = 'TEST-40'

BEGIN TRAN

UPDATE uCommerce_PurchaseOrder SET BillingAddressId = NULL WHERE OrderNumber = @OrderNumber
DELETE a FROM uCommerce_Shipment a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.OrderNumber = @OrderNumber
DELETE a FROM uCommerce_OrderAddress a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.OrderNumber = @OrderNumber
DELETE a FROM uCommerce_OrderProperty a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.OrderNumber = @OrderNumber
DELETE a FROM uCommerce_OrderLine a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.OrderNumber = @OrderNumber
DELETE a FROM uCommerce_Payment a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.OrderNumber = @OrderNumber
DELETE a FROM uCommerce_OrderStatusAudit a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.OrderNumber = @OrderNumber
DELETE FROM uCommerce_PurchaseOrder WHERE OrderNumber = @OrderNumber

--TODO: Expand this so it checks for other orders
--DELETE a FROM uCommerce_Address a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.OrderNumber = @OrderNumber
--DELETE a FROM uCommerce_Customer a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.OrderNumber = @OrderNumber

--Uncomment this
--COMMIT TRAN

--And comment out this
ROLLBACK TRAN&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;p&gt;
&amp;#160;
&lt;/p&gt;
&lt;p&gt;
&amp;#160;
&lt;/p&gt;
&lt;h2&gt;Delete all baskets
&lt;/h2&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:9b400326-be37-4795-bd43-3a5fd26fa77d" class="wlWriterEditableSmartContent"&gt;&lt;pre class="brush: sql;"&gt;--Delete all carts purchaseorders and associated data

BEGIN TRAN

UPDATE uCommerce_PurchaseOrder SET BillingAddressId = NULL WHERE OrderNumber IS NULL
DELETE a FROM uCommerce_Shipment a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.OrderNumber IS NULL
DELETE a FROM uCommerce_OrderAddress a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.OrderNumber IS NULL
DELETE a FROM uCommerce_OrderProperty a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.OrderNumber IS NULL
DELETE a FROM uCommerce_OrderLine a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.OrderNumber IS NULL
DELETE a FROM uCommerce_Payment a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.OrderNumber IS NULL
DELETE a FROM uCommerce_OrderStatusAudit a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.OrderNumber IS NULL
DELETE FROM uCommerce_PurchaseOrder WHERE OrderNumber IS NULL

--TODO: Expand this so it checks for other orders
--DELETE a FROM uCommerce_Address a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.NULL = @NULL
--DELETE a FROM uCommerce_Customer a INNER JOIN uCommerce_PurchaseOrder b ON a.OrderId = b.OrderId WHERE b.NULL = @NULL


--Uncomment this
--COMMIT TRAN

--And comment out this
ROLLBACK TRAN&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;p&gt;
&amp;#160;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Update:&lt;/strong&gt; At the request of Søren, I’ve altered the delete all baskets
post so it allows you to delete all baskets older than a given date, see: &lt;a href="http://blogs.thesitedoctor.co.uk/tim/2010/10/04/Delete+All+UCommerce+Baskets+Older+Than+X+Days.aspx" target="_blank"&gt;Delete
all UCommerce baskets older than x days&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blogs.thesitedoctor.co.uk/test/aggbug.ashx?id=fcd3400c-32cd-4b96-819f-ce4adf0cab19" /&gt;</description>
      <comments>http://blogs.thesitedoctor.co.uk/test/CommentView,guid,fcd3400c-32cd-4b96-819f-ce4adf0cab19.aspx</comments>
      <category>Development</category>
      <category>eCommerce</category>
      <category>SQL</category>
      <category>SQL Server</category>
      <category>uCommerce</category>
      <category>Umbraco</category>
    </item>
    <item>
      <trackback:ping>http://blogs.thesitedoctor.co.uk/test/Trackback.aspx?guid=6037f5b2-a4f0-4877-ab07-b0d388b942b9</trackback:ping>
      <pingback:server>http://blogs.thesitedoctor.co.uk/test/pingback.aspx</pingback:server>
      <pingback:target>http://blogs.thesitedoctor.co.uk/test/PermaLink,guid,6037f5b2-a4f0-4877-ab07-b0d388b942b9.aspx</pingback:target>
      <dc:creator>Tim</dc:creator>
      <wfw:comment>http://blogs.thesitedoctor.co.uk/test/CommentView,guid,6037f5b2-a4f0-4877-ab07-b0d388b942b9.aspx</wfw:comment>
      <wfw:commentRss>http://blogs.thesitedoctor.co.uk/test/SyndicationService.asmx/GetEntryCommentsRss?guid=6037f5b2-a4f0-4877-ab07-b0d388b942b9</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" class="wlDisabledImage" title="frustration[1]" border="0" alt="frustration[1]" align="right" src="http://blogs.thesitedoctor.co.uk/tim/images/Whentocallitquitsonaproblem_E82B/frustration1.png" width="244" height="260" />We’ve
all done it, you’ve run into a problem while developing which you bash at for a few
hours and before you know it, you’ve lost the day, not got anywhere and feel completely
frustrated. What’s more, is it’s usually something so screamingly obvious and/or simple
that you just know you’ll find the answer on Google.
</p>
        <p>
Rather than pulling your hair out for hours on end, there’s a rather simple rule-of-thumb
that you should follow:
</p>
        <div class="sidebox smlFoot">
          <div class="boxhead">
            <blockquote class="boxbody">
              <p>
Spend no more than 15-30 minutes trying to fix the issue yourself (don’t forget to
check Google for the answer!). If you’ve not found the answer after 30 minutes, “ask
a friend” and walk away.
</p>
            </blockquote>
          </div>
          <div class="clearer">
            <div class="boxfoot">
              <div class="botAlign">
              </div>
            </div>
          </div>
        </div>
        <p>
If you’re able to bash at it for 30 minutes without feeling you’re getting any closer,
you’re probably looking at it from the wrong direction and having someone else’s perspective
on the problem will probably answer it within seconds. By walking away from the problem
you’re also taking away the pressure and you’ll often find the solution comes to you.
</p>
        <p>
Another advantage of putting a time limit on the issue is it avoids you losing the
day and should also mean you’ve explored Google and the lists so when you ask your
“friend”, it should stop you getting that annoying <a title="Let Me Google That For You" href="http://lmgtfy.com/" target="_blank">lmgtfy</a> response
when asking for help (it’s a similar concept to the “wait 1 minute before sending”
facility within Outlook).
</p>
        <p>
So the next time you realise something’s taking longer than you think it should, start
the timer!
</p>
        <img width="0" height="0" src="http://blogs.thesitedoctor.co.uk/test/aggbug.ashx?id=6037f5b2-a4f0-4877-ab07-b0d388b942b9" />
      </body>
      <title>Developer Pitfall: When to call it quits on a problem</title>
      <guid isPermaLink="false">http://blogs.thesitedoctor.co.uk/test/PermaLink,guid,6037f5b2-a4f0-4877-ab07-b0d388b942b9.aspx</guid>
      <link>http://blogs.thesitedoctor.co.uk/test/2010/08/18/DeveloperPitfallWhenToCallItQuitsOnAProblem.aspx</link>
      <pubDate>Wed, 18 Aug 2010 15:50:07 GMT</pubDate>
      <description>&lt;p&gt;
&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" class="wlDisabledImage" title="frustration[1]" border="0" alt="frustration[1]" align="right" src="http://blogs.thesitedoctor.co.uk/tim/images/Whentocallitquitsonaproblem_E82B/frustration1.png" width="244" height="260" /&gt;We’ve
all done it, you’ve run into a problem while developing which you bash at for a few
hours and before you know it, you’ve lost the day, not got anywhere and feel completely
frustrated. What’s more, is it’s usually something so screamingly obvious and/or simple
that you just know you’ll find the answer on Google.
&lt;/p&gt;
&lt;p&gt;
Rather than pulling your hair out for hours on end, there’s a rather simple rule-of-thumb
that you should follow:
&lt;/p&gt;
&lt;div class="sidebox smlFoot"&gt;
&lt;div class="boxhead"&gt;
&lt;blockquote class="boxbody"&gt; 
&lt;p&gt;
Spend no more than 15-30 minutes trying to fix the issue yourself (don’t forget to
check Google for the answer!). If you’ve not found the answer after 30 minutes, “ask
a friend” and walk away.
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;/div&gt;
&lt;div class="clearer"&gt;
&lt;div class="boxfoot"&gt;
&lt;div class="botAlign"&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
If you’re able to bash at it for 30 minutes without feeling you’re getting any closer,
you’re probably looking at it from the wrong direction and having someone else’s perspective
on the problem will probably answer it within seconds. By walking away from the problem
you’re also taking away the pressure and you’ll often find the solution comes to you.
&lt;/p&gt;
&lt;p&gt;
Another advantage of putting a time limit on the issue is it avoids you losing the
day and should also mean you’ve explored Google and the lists so when you ask your
“friend”, it should stop you getting that annoying &lt;a title="Let Me Google That For You" href="http://lmgtfy.com/" target="_blank"&gt;lmgtfy&lt;/a&gt; response
when asking for help (it’s a similar concept to the “wait 1 minute before sending”
facility within Outlook).
&lt;/p&gt;
&lt;p&gt;
So the next time you realise something’s taking longer than you think it should, start
the timer!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blogs.thesitedoctor.co.uk/test/aggbug.ashx?id=6037f5b2-a4f0-4877-ab07-b0d388b942b9" /&gt;</description>
      <comments>http://blogs.thesitedoctor.co.uk/test/CommentView,guid,6037f5b2-a4f0-4877-ab07-b0d388b942b9.aspx</comments>
      <category>Development</category>
      <category>The Site Doctor</category>
      <category>Web Development</category>
    </item>
    <item>
      <trackback:ping>http://blogs.thesitedoctor.co.uk/test/Trackback.aspx?guid=431f46cd-283c-4fc8-b38c-4bb5de06fdc8</trackback:ping>
      <pingback:server>http://blogs.thesitedoctor.co.uk/test/pingback.aspx</pingback:server>
      <pingback:target>http://blogs.thesitedoctor.co.uk/test/PermaLink,guid,431f46cd-283c-4fc8-b38c-4bb5de06fdc8.aspx</pingback:target>
      <dc:creator>Tim</dc:creator>
      <wfw:comment>http://blogs.thesitedoctor.co.uk/test/CommentView,guid,431f46cd-283c-4fc8-b38c-4bb5de06fdc8.aspx</wfw:comment>
      <wfw:commentRss>http://blogs.thesitedoctor.co.uk/test/SyndicationService.asmx/GetEntryCommentsRss?guid=431f46cd-283c-4fc8-b38c-4bb5de06fdc8</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <img style="border-bottom: 0px; border-left: 0px; margin: 0px 0px 10px 10px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="ucommerce-logo-symbol[1]" border="0" alt="ucommerce-logo-symbol[1]" align="right" src="http://blogs.thesitedoctor.co.uk/tim/images/GettingstartedwithuCommerce_C43D/ucommercelogosymbol1.png" width="260" height="260" />I
thought seeing as <a title="e-commerce package for Umbraco" href="http://www.ucommerce.dk" target="_blank">uCommerce</a> is
now an actual product I would start to overview an install/configuration of <a title="e-commerce package for Umbraco" href="http://www.ucommerce.dk" target="_blank">uCommerce</a> assuming
no prior knowledge of <a title="e-commerce package for Umbraco" href="http://www.ucommerce.dk" target="_blank">uCommerce</a>.
Firstly, let me start of by saying that once you've got your head around uCommerce
and some of it's complexities, you'll find it a fantastic product that makes creating
a new ecommerce website as easy as setting up a standard Umbraco website. It is still
missing a few features, but you can easily work around these with a bit of custom
XSLT/C#.
</p>
        <p>
Ok, back to setting up your first uCommerce website. I've grouped these into what
I feel are logical sections but if I've missed something, please let me know.
</p>
        <h2>1. Install the uCommerce Package
</h2>
        <p>
If you've not already done so, go to the <a href="http://ucommerce.dk/en/get-it-now/download.aspx">uCommerce
Download page</a> and download the uCommerce package (at time of writing, I'm using
1.0.4.2) and then download the uCommerce Store package (currently 1.0.1.2).
</p>
        <p>
Install the uCommerce package as you do any other package in Umbraco. Once installed
you'll be able to install the store package.
</p>
        <p>
Assuming all your permissions on your Umbraco install are correct, refresh your browser
and you should have a new section "Commerce". If they're not right, you'll
be told to add a few web.config settings.
</p>
        <h2>2. Wire up the catalog
</h2>
        <p>
This is the step that I didn’t “do” when we first got started and it turns out it’s
one of the most important steps as it joins the uCommerce catalog to the front end.
</p>
        <ol>
          <li>
Go to your Umbraco "Content" section 
</li>
          <li>
Right click on the page you would like to be the store's "home" page (in
the example store, this would be "Shop") 
</li>
          <li>
Click "Manage hostnames" (see figure below) 
<br /><img alt="Manage Hostnames Context Menu" src="http://blogs.thesitedoctor.co.uk/tim/images/1-ManageHostnames.png" width="235" height="304" /></li>
          <li>
Enter your hostname (the domain name the site runs on) in the "Domain" box
and then choose the default language for the website 
<br /><img alt="Manage Hostnames screen" src="http://blogs.thesitedoctor.co.uk/tim/images/1-ManageHostnames2.png" width="539" height="457" /></li>
          <li>
Click "Add new Domain" and then "Close this window" 
</li>
          <li>
Click the "Commerce" section button (in the bottom left) 
</li>
          <li>
Click the little arrow to the left of "Product Catalog" 
</li>
          <li>
Left click the relevant catalog (if you've installed the store package this will be
"uCommerce") 
</li>
          <li>
Select your new domain from the "Host name" drop down list 
<br /><img alt="Manage Hostnames screen" src="http://blogs.thesitedoctor.co.uk/tim/images/2-AssignHostnames.png" width="541" height="127" /></li>
          <li>
Click the save disk button in the top left 
<br /></li>
        </ol>
        <h2>3. Setup Your Product Definitions
</h2>
        <p>
A “Product Definition” is uCommerce’s concept of document types, it allows you to
add additional information to the product. If you’re using the uCommerce starter store,
you’ll get a couple of product definitions out of the box –software and support. At
the moment, you can't add additional properties through the uCommerce back end (i.e.
if you wanted to add additional information such as Meta Keywords/Descriptions etc
-I'll cover how we got around this in a later post) but there are a number of default
the category/product properties (I've put their XML reference in brackets where relevant):
</p>
        <h3>uCommerce Category Properties
</h3>
        <ul>
          <li>
Image (@image) 
</li>
          <li>
Display Name (@displayName) 
</li>
          <li>
Description (@description) 
</li>
        </ul>
        <p>
The default XML looks like this:
</p>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:a578f360-4bab-4a8d-878a-665fb6791381" class="wlWriterEditableSmartContent">
          <pre class="brush: xml;">&lt;category parentCategoryId="" parentCategoryName="" index="0" id="67" name="Software" displayName="Software" displayOnSite="True" description="" image="" /&gt;</pre>
        </div>
        <h3>uCommerce Product Properties
</h3>
        <ul>
          <li>
SKU (@sku) 
</li>
          <li>
Internal name 
</li>
          <li>
Display on web site (@<span class="brush: xml;">displayOnSite</span>) 
</li>
          <li>
Allow ordering (@<span class="brush: xml;">allowOrdering</span>) 
</li>
          <li>
Thumbnail (@<span class="brush: xml;">thumbnailImage</span>) 
</li>
          <li>
Primary image (@<span class="brush: xml;">primaryImage</span>) 
</li>
          <li>
Display name (@<span class="brush: xml;">displayName</span>) 
</li>
          <li>
Short description (@<span class="brush: xml;">shortDescription</span>) 
</li>
          <li>
Long description (@<span class="brush: xml;">longDescription</span>) 
</li>
        </ul>
        <p>
The default XML looks like this (the variants are not standard but are there because
they're setup as part of the store package):
</p>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:8384e736-156c-4085-9c18-c79db697c4be" class="wlWriterEditableSmartContent">
          <pre class="brush: xml;">&lt;product index="0" sku="100-000-001" displayName="uCommerce 1.0 RTM" shortDescription="uCommerce is a full featured e-commerce platform with content management features powered by Umbraco. Everything you need to build a killer e-commerce solution for your clients!" longDescription="uCommerce is fully integrated with the content management system Umbraco, which provides not only the frontend renderendering enabling you to create beautifully designed stores, but also the back office capabilities where you configure and cuztomize the store to your liking.&amp;#xD;&amp;#xA;&amp;#xD;&amp;#xA;uCommerce_ foundations provide the basis for an e-commerce solution. Each foundation addresses a specific need for providing a full e-commerce solution to your clients. foundations in the box include a Catalog Foundation, a Transactions Foundation, and an Analytics Foundation.&amp;#xD;&amp;#xA;&amp;#xD;&amp;#xA;Each of the foundations within uCommerce_ are fully configurable right in Umbraco. No need to switch between a multitude of tools to manage your stores. It's all available as you would expect in one convenient location." thumbnailImage="1097" primaryImage="1097" allowOrdering="True" isVariant="False" displayOnSite="True" hasVariants="True" price="3495.0000" currency="EUR"&gt;
  &lt;variants&gt;
    &lt;product index="0" sku="100-000-001" displayName="Developer Edition" shortDescription="" longDescription="" thumbnailImage="0" primaryImage="0" allowOrdering="False" isVariant="True" displayOnSite="False" hasVariants="False" variantSku="001" price="0.0000" currency="EUR" Downloadable="on" License="Dev" /&gt;
    &lt;product index="1" sku="100-000-001" displayName="30 Days Evaluation" shortDescription="" longDescription="" thumbnailImage="0" primaryImage="0" allowOrdering="False" isVariant="True" displayOnSite="False" hasVariants="False" variantSku="002" price="3495.0000" currency="EUR" Downloadable="on" License="Eval" /&gt;
    &lt;product index="2" sku="100-000-001" displayName="Go-Live" shortDescription="" longDescription="" thumbnailImage="0" primaryImage="0" allowOrdering="False" isVariant="True" displayOnSite="False" hasVariants="False" variantSku="003" price="3495.0000" currency="EUR" Downloadable="on" License="Live" /&gt;
  &lt;/variants&gt;
&lt;/product&gt;</pre>
        </div>
        <p>
Adding additional product properties is simple.
</p>
        <ol>
          <li>
Click the "Commerce" section button 
</li>
          <li>
Navigate to: Settings --&gt; Catalog --&gt; Product Definitions 
</li>
          <li>
Choose the product definition you would like to edit (or create a new one in the same
way that you would with Umbraco document types) 
</li>
          <li>
Right click the product definition you need to add extra properties to and click "Create" 
</li>
          <li>
Type in a name for your new property i.e. Size 
</li>
          <li>
Choose the Data Type for the property (if you need something that's not listed see
"Creating your own Data Type" below): 
<ul><li>
ShortText -A textbox 
</li><li>
LongText -A text area 
</li><li>
Number -Beleive it or not, a numeric value 
</li><li>
Boolean -A checkbox 
</li><li>
Image -A media selector 
</li></ul></li>
          <li>
Click the "Create" button 
</li>
          <li>
You can now choose a few additional options for the new property including how it
should be shown to the user and whether it's Multilingual. 
<ul><li>
Name -the text used as the label in the uCommerce product editor (it's also the name
of the attribute on the XML that will contain it's value) 
</li><li>
Data Type -the type of control to render in the uCommerce product editor 
</li><li>
Multilingual -whether the control should be shown on the "Common" tab of
the uCommerce product editor or the language specific tab 
</li><li>
Display On Web Site -A flag that's sent out in the XML so you can decide whether or
not to show it on the website 
</li><li>
Variant Property -Whether this should appear as a table column heading under the "Variants"
tab (I'll go into variants more in a later post) 
<br /><strong>Note:</strong> Do not set Multilingual and Variant property to both true as
at the moment, it won't be shown in the uCommerce product editor -you've been warned! 
</li><li>
Render in Editor -Whether the control should be shown in the uCommerce product editor
screen or hidden from the administrator (i.e. for data you want to use internally
only and should be editable) 
</li></ul></li>
          <li>
Finally you'll need to enter in a Display Name for the various languages. This is
what's shown to the user if you dynamically pull through the various properties on
the product details page. 
</li>
        </ol>
        <h2>4. Creating Your Own Data Type
</h2>
        <p>
Now, you may be thinking that using that set of data types is a little limiting for
something like "Size" or "Colour" and you might want to display
something a little more flexible to the user -such as a drop down list. This is easy
enough:
</p>
        <ol>
          <li>
Right click the "Data Types" node 
</li>
          <li>
Enter a name i.e. "Size" 
</li>
          <li>
Choose the definition for the Data Type (for size we will use "Enum") 
</li>
          <li>
Save and Refresh the "Data Types" node 
</li>
          <li>
Right click your new Data Type and click Create 
</li>
          <li>
Enter your Option's value i.e. "Small" 
</li>
          <li>
Repeat 5-6 until all your options are set i.e. add "Medium" and "Large" 
</li>
        </ol>
        <p>
          <strong>Note:</strong> At the moment, the enum values cannot be re-ordered through
the UI so make sure you add them in the order you want them in the editor!
</p>
        <h2>5. Load Your Catalog
</h2>
        <p>
Once you've finished creating your various product types, it's time to create your
catalog. Creating categories and products within uCommerce is as simple as creating
pages in Umbraco. Using the same right click menu concept you can create nested categories
as deep as your catalog requires. You can add products and categories at any level
by choosing either the "Category" or "Product" radio button and
choosing your product type.
</p>
        <h2>6. You're Done!
</h2>
        <p>
Assuming you've followed the steps above, you should now have a (fairly basic) store
setup. Go to your site's homepage and click the "uCommerce" menu item and
voila, your categories and products should be listed.
</p>
        <p>
Not getting the categories you were expecting? Perform the helpful xsl “copy-of” trick
within either the "RootCategories[XSLT].xslt" file or "Category[XSLT].xslt"
file:
</p>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:cb6e146f-4afc-4025-8b37-a6e647a6b248" class="wlWriterEditableSmartContent">
          <pre class="brush: xml;">&lt;pre&gt;&lt;xsl:copy-of select="$categories" /&gt;&lt;/pre&gt;</pre>
        </div>
        <p>
and then have a look at the output:
</p>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:b812a9c5-51a5-404b-8b41-aee3b4d05fa3" class="wlWriterEditableSmartContent">
          <pre class="brush: xml;">&lt;errors&gt;&lt;error&gt;No product catalog group found supporting the current URL.&lt;/error&gt;&lt;/errors&gt;</pre>
        </div>
        <p>
If you're getting the above error, currently (and this may be a misunderstanding/changed
later) you have to have the catalog and catalogue group names the same –in the example
site, they’re both “uCommerce”.
</p>
        <p>
As I think the concept store offered with Software/Support isn't particularly real-world,
I'm going to work on creating a basic store that you can use to better understand
uCommerce and it's intricacies.
</p>
        <p>
Check back soon as I'll be posting an overview of the checkout process, the various
XSLT files and integrating payment gateways into uCommerce (initially SagePay, PayPoint,
WorldPay and PayPal). 
</p>
        <img width="0" height="0" src="http://blogs.thesitedoctor.co.uk/test/aggbug.ashx?id=431f46cd-283c-4fc8-b38c-4bb5de06fdc8" />
      </body>
      <title>Getting started with uCommerce</title>
      <guid isPermaLink="false">http://blogs.thesitedoctor.co.uk/test/PermaLink,guid,431f46cd-283c-4fc8-b38c-4bb5de06fdc8.aspx</guid>
      <link>http://blogs.thesitedoctor.co.uk/test/2010/08/17/GettingStartedWithUCommerce.aspx</link>
      <pubDate>Tue, 17 Aug 2010 16:49:45 GMT</pubDate>
      <description>&lt;p&gt;
&lt;img style="border-bottom: 0px; border-left: 0px; margin: 0px 0px 10px 10px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="ucommerce-logo-symbol[1]" border="0" alt="ucommerce-logo-symbol[1]" align="right" src="http://blogs.thesitedoctor.co.uk/tim/images/GettingstartedwithuCommerce_C43D/ucommercelogosymbol1.png" width="260" height="260" /&gt;I
thought seeing as &lt;a title="e-commerce package for Umbraco" href="http://www.ucommerce.dk" target="_blank"&gt;uCommerce&lt;/a&gt; is
now an actual product I would start to overview an install/configuration of &lt;a title="e-commerce package for Umbraco" href="http://www.ucommerce.dk" target="_blank"&gt;uCommerce&lt;/a&gt; assuming
no prior knowledge of &lt;a title="e-commerce package for Umbraco" href="http://www.ucommerce.dk" target="_blank"&gt;uCommerce&lt;/a&gt;.
Firstly, let me start of by saying that once you've got your head around uCommerce
and some of it's complexities, you'll find it a fantastic product that makes creating
a new ecommerce website as easy as setting up a standard Umbraco website. It is still
missing a few features, but you can easily work around these with a bit of custom
XSLT/C#.
&lt;/p&gt;
&lt;p&gt;
Ok, back to setting up your first uCommerce website. I've grouped these into what
I feel are logical sections but if I've missed something, please let me know.
&lt;/p&gt;
&lt;h2&gt;1. Install the uCommerce Package
&lt;/h2&gt;
&lt;p&gt;
If you've not already done so, go to the &lt;a href="http://ucommerce.dk/en/get-it-now/download.aspx"&gt;uCommerce
Download page&lt;/a&gt; and download the uCommerce package (at time of writing, I'm using
1.0.4.2) and then download the uCommerce Store package (currently 1.0.1.2).
&lt;/p&gt;
&lt;p&gt;
Install the uCommerce package as you do any other package in Umbraco. Once installed
you'll be able to install the store package.
&lt;/p&gt;
&lt;p&gt;
Assuming all your permissions on your Umbraco install are correct, refresh your browser
and you should have a new section &amp;quot;Commerce&amp;quot;. If they're not right, you'll
be told to add a few web.config settings.
&lt;/p&gt;
&lt;h2&gt;2. Wire up the catalog
&lt;/h2&gt;
&lt;p&gt;
This is the step that I didn’t “do” when we first got started and it turns out it’s
one of the most important steps as it joins the uCommerce catalog to the front end.
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Go to your Umbraco &amp;quot;Content&amp;quot; section 
&lt;/li&gt;
&lt;li&gt;
Right click on the page you would like to be the store's &amp;quot;home&amp;quot; page (in
the example store, this would be &amp;quot;Shop&amp;quot;) 
&lt;/li&gt;
&lt;li&gt;
Click &amp;quot;Manage hostnames&amp;quot; (see figure below) 
&lt;br /&gt;
&lt;img alt="Manage Hostnames Context Menu" src="http://blogs.thesitedoctor.co.uk/tim/images/1-ManageHostnames.png" width="235" height="304" /&gt; 
&lt;/li&gt;
&lt;li&gt;
Enter your hostname (the domain name the site runs on) in the &amp;quot;Domain&amp;quot; box
and then choose the default language for the website 
&lt;br /&gt;
&lt;img alt="Manage Hostnames screen" src="http://blogs.thesitedoctor.co.uk/tim/images/1-ManageHostnames2.png" width="539" height="457" /&gt; 
&lt;/li&gt;
&lt;li&gt;
Click &amp;quot;Add new Domain&amp;quot; and then &amp;quot;Close this window&amp;quot; 
&lt;/li&gt;
&lt;li&gt;
Click the &amp;quot;Commerce&amp;quot; section button (in the bottom left) 
&lt;/li&gt;
&lt;li&gt;
Click the little arrow to the left of &amp;quot;Product Catalog&amp;quot; 
&lt;/li&gt;
&lt;li&gt;
Left click the relevant catalog (if you've installed the store package this will be
&amp;quot;uCommerce&amp;quot;) 
&lt;/li&gt;
&lt;li&gt;
Select your new domain from the &amp;quot;Host name&amp;quot; drop down list 
&lt;br /&gt;
&lt;img alt="Manage Hostnames screen" src="http://blogs.thesitedoctor.co.uk/tim/images/2-AssignHostnames.png" width="541" height="127" /&gt; 
&lt;/li&gt;
&lt;li&gt;
Click the save disk button in the top left 
&lt;br /&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;3. Setup Your Product Definitions
&lt;/h2&gt;
&lt;p&gt;
A “Product Definition” is uCommerce’s concept of document types, it allows you to
add additional information to the product. If you’re using the uCommerce starter store,
you’ll get a couple of product definitions out of the box –software and support. At
the moment, you can't add additional properties through the uCommerce back end (i.e.
if you wanted to add additional information such as Meta Keywords/Descriptions etc
-I'll cover how we got around this in a later post) but there are a number of default
the category/product properties (I've put their XML reference in brackets where relevant):
&lt;/p&gt;
&lt;h3&gt;uCommerce Category Properties
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
Image (@image) 
&lt;/li&gt;
&lt;li&gt;
Display Name (@displayName) 
&lt;/li&gt;
&lt;li&gt;
Description (@description) 
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
The default XML looks like this:
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:a578f360-4bab-4a8d-878a-665fb6791381" class="wlWriterEditableSmartContent"&gt;&lt;pre class="brush: xml;"&gt;&amp;lt;category parentCategoryId="" parentCategoryName="" index="0" id="67" name="Software" displayName="Software" displayOnSite="True" description="" image="" /&amp;gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;h3&gt;uCommerce Product Properties
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
SKU (@sku) 
&lt;/li&gt;
&lt;li&gt;
Internal name 
&lt;/li&gt;
&lt;li&gt;
Display on web site (@&lt;span class="brush: xml;"&gt;displayOnSite&lt;/span&gt;) 
&lt;/li&gt;
&lt;li&gt;
Allow ordering (@&lt;span class="brush: xml;"&gt;allowOrdering&lt;/span&gt;) 
&lt;/li&gt;
&lt;li&gt;
Thumbnail (@&lt;span class="brush: xml;"&gt;thumbnailImage&lt;/span&gt;) 
&lt;/li&gt;
&lt;li&gt;
Primary image (@&lt;span class="brush: xml;"&gt;primaryImage&lt;/span&gt;) 
&lt;/li&gt;
&lt;li&gt;
Display name (@&lt;span class="brush: xml;"&gt;displayName&lt;/span&gt;) 
&lt;/li&gt;
&lt;li&gt;
Short description (@&lt;span class="brush: xml;"&gt;shortDescription&lt;/span&gt;) 
&lt;/li&gt;
&lt;li&gt;
Long description (@&lt;span class="brush: xml;"&gt;longDescription&lt;/span&gt;) 
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
The default XML looks like this (the variants are not standard but are there because
they're setup as part of the store package):
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:8384e736-156c-4085-9c18-c79db697c4be" class="wlWriterEditableSmartContent"&gt;&lt;pre class="brush: xml;"&gt;&amp;lt;product index="0" sku="100-000-001" displayName="uCommerce 1.0 RTM" shortDescription="uCommerce is a full featured e-commerce platform with content management features powered by Umbraco. Everything you need to build a killer e-commerce solution for your clients!" longDescription="uCommerce is fully integrated with the content management system Umbraco, which provides not only the frontend renderendering enabling you to create beautifully designed stores, but also the back office capabilities where you configure and cuztomize the store to your liking.&amp;amp;#xD;&amp;amp;#xA;&amp;amp;#xD;&amp;amp;#xA;uCommerce_ foundations provide the basis for an e-commerce solution. Each foundation addresses a specific need for providing a full e-commerce solution to your clients. foundations in the box include a Catalog Foundation, a Transactions Foundation, and an Analytics Foundation.&amp;amp;#xD;&amp;amp;#xA;&amp;amp;#xD;&amp;amp;#xA;Each of the foundations within uCommerce_ are fully configurable right in Umbraco. No need to switch between a multitude of tools to manage your stores. It's all available as you would expect in one convenient location." thumbnailImage="1097" primaryImage="1097" allowOrdering="True" isVariant="False" displayOnSite="True" hasVariants="True" price="3495.0000" currency="EUR"&amp;gt;
  &amp;lt;variants&amp;gt;
    &amp;lt;product index="0" sku="100-000-001" displayName="Developer Edition" shortDescription="" longDescription="" thumbnailImage="0" primaryImage="0" allowOrdering="False" isVariant="True" displayOnSite="False" hasVariants="False" variantSku="001" price="0.0000" currency="EUR" Downloadable="on" License="Dev" /&amp;gt;
    &amp;lt;product index="1" sku="100-000-001" displayName="30 Days Evaluation" shortDescription="" longDescription="" thumbnailImage="0" primaryImage="0" allowOrdering="False" isVariant="True" displayOnSite="False" hasVariants="False" variantSku="002" price="3495.0000" currency="EUR" Downloadable="on" License="Eval" /&amp;gt;
    &amp;lt;product index="2" sku="100-000-001" displayName="Go-Live" shortDescription="" longDescription="" thumbnailImage="0" primaryImage="0" allowOrdering="False" isVariant="True" displayOnSite="False" hasVariants="False" variantSku="003" price="3495.0000" currency="EUR" Downloadable="on" License="Live" /&amp;gt;
  &amp;lt;/variants&amp;gt;
&amp;lt;/product&amp;gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
Adding additional product properties is simple.
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Click the &amp;quot;Commerce&amp;quot; section button 
&lt;/li&gt;
&lt;li&gt;
Navigate to: Settings --&amp;gt; Catalog --&amp;gt; Product Definitions 
&lt;/li&gt;
&lt;li&gt;
Choose the product definition you would like to edit (or create a new one in the same
way that you would with Umbraco document types) 
&lt;/li&gt;
&lt;li&gt;
Right click the product definition you need to add extra properties to and click &amp;quot;Create&amp;quot; 
&lt;/li&gt;
&lt;li&gt;
Type in a name for your new property i.e. Size 
&lt;/li&gt;
&lt;li&gt;
Choose the Data Type for the property (if you need something that's not listed see
&amp;quot;Creating your own Data Type&amp;quot; below): 
&lt;ul&gt;
&lt;li&gt;
ShortText -A textbox 
&lt;/li&gt;
&lt;li&gt;
LongText -A text area 
&lt;/li&gt;
&lt;li&gt;
Number -Beleive it or not, a numeric value 
&lt;/li&gt;
&lt;li&gt;
Boolean -A checkbox 
&lt;/li&gt;
&lt;li&gt;
Image -A media selector 
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
Click the &amp;quot;Create&amp;quot; button 
&lt;/li&gt;
&lt;li&gt;
You can now choose a few additional options for the new property including how it
should be shown to the user and whether it's Multilingual. 
&lt;ul&gt;
&lt;li&gt;
Name -the text used as the label in the uCommerce product editor (it's also the name
of the attribute on the XML that will contain it's value) 
&lt;/li&gt;
&lt;li&gt;
Data Type -the type of control to render in the uCommerce product editor 
&lt;/li&gt;
&lt;li&gt;
Multilingual -whether the control should be shown on the &amp;quot;Common&amp;quot; tab of
the uCommerce product editor or the language specific tab 
&lt;/li&gt;
&lt;li&gt;
Display On Web Site -A flag that's sent out in the XML so you can decide whether or
not to show it on the website 
&lt;/li&gt;
&lt;li&gt;
Variant Property -Whether this should appear as a table column heading under the &amp;quot;Variants&amp;quot;
tab (I'll go into variants more in a later post) 
&lt;br /&gt;
&lt;strong&gt;Note:&lt;/strong&gt; Do not set Multilingual and Variant property to both true as
at the moment, it won't be shown in the uCommerce product editor -you've been warned! 
&lt;/li&gt;
&lt;li&gt;
Render in Editor -Whether the control should be shown in the uCommerce product editor
screen or hidden from the administrator (i.e. for data you want to use internally
only and should be editable) 
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
Finally you'll need to enter in a Display Name for the various languages. This is
what's shown to the user if you dynamically pull through the various properties on
the product details page. 
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;4. Creating Your Own Data Type
&lt;/h2&gt;
&lt;p&gt;
Now, you may be thinking that using that set of data types is a little limiting for
something like &amp;quot;Size&amp;quot; or &amp;quot;Colour&amp;quot; and you might want to display
something a little more flexible to the user -such as a drop down list. This is easy
enough:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Right click the &amp;quot;Data Types&amp;quot; node 
&lt;/li&gt;
&lt;li&gt;
Enter a name i.e. &amp;quot;Size&amp;quot; 
&lt;/li&gt;
&lt;li&gt;
Choose the definition for the Data Type (for size we will use &amp;quot;Enum&amp;quot;) 
&lt;/li&gt;
&lt;li&gt;
Save and Refresh the &amp;quot;Data Types&amp;quot; node 
&lt;/li&gt;
&lt;li&gt;
Right click your new Data Type and click Create 
&lt;/li&gt;
&lt;li&gt;
Enter your Option's value i.e. &amp;quot;Small&amp;quot; 
&lt;/li&gt;
&lt;li&gt;
Repeat 5-6 until all your options are set i.e. add &amp;quot;Medium&amp;quot; and &amp;quot;Large&amp;quot; 
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
&lt;strong&gt;Note:&lt;/strong&gt; At the moment, the enum values cannot be re-ordered through
the UI so make sure you add them in the order you want them in the editor!
&lt;/p&gt;
&lt;h2&gt;5. Load Your Catalog
&lt;/h2&gt;
&lt;p&gt;
Once you've finished creating your various product types, it's time to create your
catalog. Creating categories and products within uCommerce is as simple as creating
pages in Umbraco. Using the same right click menu concept you can create nested categories
as deep as your catalog requires. You can add products and categories at any level
by choosing either the &amp;quot;Category&amp;quot; or &amp;quot;Product&amp;quot; radio button and
choosing your product type.
&lt;/p&gt;
&lt;h2&gt;6. You're Done!
&lt;/h2&gt;
&lt;p&gt;
Assuming you've followed the steps above, you should now have a (fairly basic) store
setup. Go to your site's homepage and click the &amp;quot;uCommerce&amp;quot; menu item and
voila, your categories and products should be listed.
&lt;/p&gt;
&lt;p&gt;
Not getting the categories you were expecting? Perform the helpful xsl “copy-of” trick
within either the &amp;quot;RootCategories[XSLT].xslt&amp;quot; file or &amp;quot;Category[XSLT].xslt&amp;quot;
file:
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:cb6e146f-4afc-4025-8b37-a6e647a6b248" class="wlWriterEditableSmartContent"&gt;&lt;pre class="brush: xml;"&gt;&amp;lt;pre&amp;gt;&amp;lt;xsl:copy-of select="$categories" /&amp;gt;&amp;lt;/pre&amp;gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
and then have a look at the output:
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:b812a9c5-51a5-404b-8b41-aee3b4d05fa3" class="wlWriterEditableSmartContent"&gt;&lt;pre class="brush: xml;"&gt;&amp;lt;errors&amp;gt;&amp;lt;error&amp;gt;No product catalog group found supporting the current URL.&amp;lt;/error&amp;gt;&amp;lt;/errors&amp;gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
If you're getting the above error, currently (and this may be a misunderstanding/changed
later) you have to have the catalog and catalogue group names the same –in the example
site, they’re both “uCommerce”.
&lt;/p&gt;
&lt;p&gt;
As I think the concept store offered with Software/Support isn't particularly real-world,
I'm going to work on creating a basic store that you can use to better understand
uCommerce and it's intricacies.
&lt;/p&gt;
&lt;p&gt;
Check back soon as I'll be posting an overview of the checkout process, the various
XSLT files and integrating payment gateways into uCommerce (initially SagePay, PayPoint,
WorldPay and PayPal). 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blogs.thesitedoctor.co.uk/test/aggbug.ashx?id=431f46cd-283c-4fc8-b38c-4bb5de06fdc8" /&gt;</description>
      <comments>http://blogs.thesitedoctor.co.uk/test/CommentView,guid,431f46cd-283c-4fc8-b38c-4bb5de06fdc8.aspx</comments>
      <category>ASP.Net</category>
      <category>eCommerce</category>
      <category>uCommerce</category>
      <category>Umbraco</category>
      <category>Web Development</category>
    </item>
    <item>
      <trackback:ping>http://blogs.thesitedoctor.co.uk/test/Trackback.aspx?guid=6a9ca083-94b9-4ba3-b7e6-d29948179db9</trackback:ping>
      <pingback:server>http://blogs.thesitedoctor.co.uk/test/pingback.aspx</pingback:server>
      <pingback:target>http://blogs.thesitedoctor.co.uk/test/PermaLink,guid,6a9ca083-94b9-4ba3-b7e6-d29948179db9.aspx</pingback:target>
      <dc:creator>Tim</dc:creator>
      <wfw:comment>http://blogs.thesitedoctor.co.uk/test/CommentView,guid,6a9ca083-94b9-4ba3-b7e6-d29948179db9.aspx</wfw:comment>
      <wfw:commentRss>http://blogs.thesitedoctor.co.uk/test/SyndicationService.asmx/GetEntryCommentsRss?guid=6a9ca083-94b9-4ba3-b7e6-d29948179db9</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Ever needed to take a large list and split it into smaller subsets of data for processing?
Well this is the Extension Method for you. Tonight we had to split a small dataset
(500 items) into even smaller sets of 10 so the provider’s web service wouldn’t timeout.
</p>
        <p>
Seeing as I was going to miss out on my evening, I thought I’d see if I could do it
a little differently using Linq and this is what I came up with:
</p>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:edfa829e-a3df-4997-be7e-4316894bab44" class="wlWriterEditableSmartContent">
          <pre class="brush: c#;">/// &lt;summary&gt;
/// Simple method to chunk a source IEnumerable into smaller (more manageable) lists
/// &lt;/summary&gt;
/// &lt;param name="source"&gt;The large IEnumerable to split&lt;/param&gt;
/// &lt;param name="chunkSize"&gt;The maximum number of items each subset should contain&lt;/param&gt;
/// &lt;returns&gt;An IEnumerable of the original source IEnumerable in bite size chunks&lt;/returns&gt;
public static IEnumerable&lt;IEnumerable&lt;TSource&gt;&gt; ChunkData&lt;TSource&gt;(this IEnumerable&lt;TSource&gt; source, int chunkSize)
{
    for (int i = 0; i &lt; source.Count(); i += chunkSize)
        yield return source.Skip(i).Take(chunkSize);
} 
</pre>
        </div>
        <p>
It should extend any IEnumerable and allow you to split it into smaller chunks which
you can then process to your heart’s content.
</p>
        <p>
Here’s a quick example of it in use:
</p>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:3f0bfd82-a5c2-45bf-9584-48811d7f8f46" class="wlWriterEditableSmartContent">
          <pre class="brush: c#;">var list = new List&lt;string&gt;() { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5", "Item 6", "Item 7", "Item 8", "Item 9", "Item 10" };
Console.WriteLine("Original list is {0} items", list.Count);
var chunked = list.ChunkData(3);
Console.WriteLine("Returned the data in {0} subsets", chunked.Count());
int i = 1;
foreach (var subset in chunked)
{
    Console.WriteLine("{0} items are in subset #{1}", subset.Count(), i++);
    int si = 1;
    foreach (var s in subset)
        Console.WriteLine("\t\tItem #{0}: {1}", si++, s);
}
</pre>
        </div>
        <p>
And this will output
</p>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:b91a7f83-6305-4649-af61-23796d4215fd" class="wlWriterEditableSmartContent">
          <pre class="brush: text;">Original list is 10 items
Returned the data in 4 subsets
3 items are in subset #1
		Item #1: Item 1
		Item #2: Item 2
		Item #3: Item 3
3 items are in subset #2
		Item #1: Item 4
		Item #2: Item 5
		Item #3: Item 6
3 items are in subset #3
		Item #1: Item 7
		Item #2: Item 8
		Item #3: Item 9
1 items are in subset #4
		Item #1: Item 10
</pre>
        </div>
        <p>
2 lines of code to do all that work -Neat
</p>
        <img width="0" height="0" src="http://blogs.thesitedoctor.co.uk/test/aggbug.ashx?id=6a9ca083-94b9-4ba3-b7e6-d29948179db9" />
      </body>
      <title>Using Linq and Extension Methods to chunk large data sets</title>
      <guid isPermaLink="false">http://blogs.thesitedoctor.co.uk/test/PermaLink,guid,6a9ca083-94b9-4ba3-b7e6-d29948179db9.aspx</guid>
      <link>http://blogs.thesitedoctor.co.uk/test/2010/08/12/UsingLinqAndExtensionMethodsToChunkLargeDataSets.aspx</link>
      <pubDate>Thu, 12 Aug 2010 08:32:44 GMT</pubDate>
      <description>&lt;p&gt;
Ever needed to take a large list and split it into smaller subsets of data for processing?
Well this is the Extension Method for you. Tonight we had to split a small dataset
(500 items) into even smaller sets of 10 so the provider’s web service wouldn’t timeout.
&lt;/p&gt;
&lt;p&gt;
Seeing as I was going to miss out on my evening, I thought I’d see if I could do it
a little differently using Linq and this is what I came up with:
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:edfa829e-a3df-4997-be7e-4316894bab44" class="wlWriterEditableSmartContent"&gt;&lt;pre class="brush: c#;"&gt;/// &amp;lt;summary&amp;gt;
/// Simple method to chunk a source IEnumerable into smaller (more manageable) lists
/// &amp;lt;/summary&amp;gt;
/// &amp;lt;param name="source"&amp;gt;The large IEnumerable to split&amp;lt;/param&amp;gt;
/// &amp;lt;param name="chunkSize"&amp;gt;The maximum number of items each subset should contain&amp;lt;/param&amp;gt;
/// &amp;lt;returns&amp;gt;An IEnumerable of the original source IEnumerable in bite size chunks&amp;lt;/returns&amp;gt;
public static IEnumerable&amp;lt;IEnumerable&amp;lt;TSource&amp;gt;&amp;gt; ChunkData&amp;lt;TSource&amp;gt;(this IEnumerable&amp;lt;TSource&amp;gt; source, int chunkSize)
{
    for (int i = 0; i &amp;lt; source.Count(); i += chunkSize)
        yield return source.Skip(i).Take(chunkSize);
} 
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
It should extend any IEnumerable and allow you to split it into smaller chunks which
you can then process to your heart’s content.
&lt;/p&gt;
&lt;p&gt;
Here’s a quick example of it in use:
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:3f0bfd82-a5c2-45bf-9584-48811d7f8f46" class="wlWriterEditableSmartContent"&gt;&lt;pre class="brush: c#;"&gt;var list = new List&amp;lt;string&amp;gt;() { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5", "Item 6", "Item 7", "Item 8", "Item 9", "Item 10" };
Console.WriteLine("Original list is {0} items", list.Count);
var chunked = list.ChunkData(3);
Console.WriteLine("Returned the data in {0} subsets", chunked.Count());
int i = 1;
foreach (var subset in chunked)
{
    Console.WriteLine("{0} items are in subset #{1}", subset.Count(), i++);
    int si = 1;
    foreach (var s in subset)
        Console.WriteLine("\t\tItem #{0}: {1}", si++, s);
}
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
And this will output
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:b91a7f83-6305-4649-af61-23796d4215fd" class="wlWriterEditableSmartContent"&gt;&lt;pre class="brush: text;"&gt;Original list is 10 items
Returned the data in 4 subsets
3 items are in subset #1
		Item #1: Item 1
		Item #2: Item 2
		Item #3: Item 3
3 items are in subset #2
		Item #1: Item 4
		Item #2: Item 5
		Item #3: Item 6
3 items are in subset #3
		Item #1: Item 7
		Item #2: Item 8
		Item #3: Item 9
1 items are in subset #4
		Item #1: Item 10
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
2 lines of code to do all that work -Neat
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blogs.thesitedoctor.co.uk/test/aggbug.ashx?id=6a9ca083-94b9-4ba3-b7e6-d29948179db9" /&gt;</description>
      <comments>http://blogs.thesitedoctor.co.uk/test/CommentView,guid,6a9ca083-94b9-4ba3-b7e6-d29948179db9.aspx</comments>
      <category>ASP.Net</category>
      <category>ASP.Net/Web Service</category>
      <category>C#</category>
      <category>The Site Doctor</category>
      <category>Web Development</category>
    </item>
  </channel>
</rss>