The SQL-Server database could not be opened Dynamicweb

[code]
Please wait!
The SQL-Server database could not be opened (”) – the error is:
System.Data.SqlClient.SqlException (0x80131904): Login failed for user ”.
[/code]

Ever ran into this problem with Dynamicweb, and thought you had set up everything correctly?
Well, I had to set up IIS, SQL Server and a new local installation of Dynamicweb up on a new machine.

Installed IIS8 and SQL Server Express 2012.
I created a new website in IIS and pointed it to the application folder as well as a virtual directory for the files folder.
Edited files\GlobalSettings.aspx

[code]
<password>mypass</password>
<type>ms_sqlserver</type>
<username>myuser</username>
<database>mydatabase</database>
<sqlserver>.\sqlexpress</sqlserver>
<integratedsecurity>false</integratedsecurity>
[/code]

I downloaded and restored the DefaultEmptyData8SQL.zip database from developer.dynamicweb-cms.com
Mapped “myuser” to the database and gave it following database roles: db_datareader, db_datawriter, db_ddladmin and public.

Even though, I still got this error.
One thing I forgot, was to enable “SQL Server and Windows Authentication mode”, as this was a new installation of SQL Server.

Here’s how to do it, if you didn’t enable it in the installation process:

Go into SQL Server Management Studio – Win+R type ssms [Enter]
Right click your SQL instance – mine is called “.\sqlexpress (SQl Server version number – User\PC-Name)
Click on “Properties”, Go into “Security” chose “SQL Server and Windows Authentication mode” and then click [Ok]

SQL Server and Windows Authentication Mode

You’ll need to restart your SQL Server for the changes to take effect:

Win+R – cmd [Enter]
Stop and start SQL Server (Express)

[code]net stop mssq$sqlexpress[/code]

[code]net start mssql$sqlexpress[/code]

Taadaa! :)

Display stock state & price DynamicWeb

Following markup and template tags will display stock state and price for an item in DynamicWeb eCommerce 8

[html]<!–@If Defined(Ecom:Product:Stock.Text)–>
<div class="<!–@Ecom:Product:Stock.ID–>" id="productstock">
<h2><!–@Translate(stocheader, "Stock status")–></h2>
<span class="stocktext" style="display:block"><!–@Ecom:Product:Stock.Text–>: <img src="<!–@Ecom:Product:Stock.Image.Clean–/>" alt="" /></span>
<span class="stockdeliverytext">Delivery time: <!–@Ecom:Product:Stock.DeliveryText–> <!–@Ecom:Product:Stock.DeliveryUnit–></span>
<span style="display:block"><!–@Ecom:Product.Price–></span>
</div>
<!–@EndIf(Ecom:Product:Stock.Text)–>
[/html]