May 22, 2010

ASPDotNetStorefront MLv9 EntityID and LastViewed cookies for XML Packages

Filed under: Web Content Pages — Webopius @ 5:19 pm

Sorry for the long title and this article’s a bit specific to those of you migrating from ASPDotNetStorefront ML7 or ML8 to ASPDotNetStorefront MLv9.

In order to migrate your site to MLv9, you will need to go through an exercise where you update your existing skins to the new Master template format. This can take some time as you will need to change the menus, search and tokens amongst other things.

What is currently less well documented is that if you are using embedded XML Packages within your templates, the way the page name is passed to the XMLPackage has changed and the entity ID and ‘lastviewedentityinstanceid’ cookies do not appear to be sent to the package at all.

XML Package parameters in ASPDotNetStorefront MLv7 and MLv8

In previous versions of ASPDNSF, you could use an XMLPackage from within your skin templates by embedding some code like this:


(!XmlPackage Name="header.xml.config"!)

Within MLv9, this has changed slightly to the following format:


<asp:Literal runat="server" Text="<%$ Tokens: XmlPackage, header.xml.config%>" />

In previous releases, you could find out the following from within your XML Package:

The pagename

<xsl:value-of select="/root/System/PageName"/>

Returning, for example, ‘showproduct.aspx’ which you could use to determine if the current page being viewed was a category page, product page etc.

The current category entity ID

<xsl:value-of select="/root/QueryString/categoryid"/>

Which would allow you to act differently depending on the entity being viewed. For example, to generate a different header depending on which category was being viewed.

The last viewed entity ID

<xsl:value-of select="/root/Cookies/lastviewedentityinstanceid"/>

ASPDotNetStorefront MLv9 custom XSLT Extension library

In MLv9, the page name returned is now the full page name, e.g. ‘c-2344-televisions.aspx’ and the query string parameters and cookies are no longer generated.

The solution…

Webopius have written a custom XML library that can be installed within any ASPDotNetStorefront installation and provides the following functions that can be used within any XML Package:

getEntityID

<xsl:value-of select="Webopius:getEntityID(/root/System/PageName)"/>

Returns the entity ID when passed the current page name. For example passing ‘c-4542-accessories.aspx’ will return ‘4542’.

This function will also write a cookie based on the entity type. In the above example, it would write a cookie called ‘lastviewedcategoryid’ which you can use in subsequent pages. Products, Manufacturers, Genres, Distributors, Vectors and Sections are also all supported.

getEntityName

<xsl:value-of select="Webopius:getEntityName(/root/System/PageName)"/>

This will return the current entity name based on the page being viewed, such as ‘category’,’product’,’manufacturer’ etc.

Using both of these functions, can assist in the migration of any of your MLv7 or MLv9 XMLPackages into the ASPDotNetStorefront MLv9 environment.

ASPDotNetStorefront Migration services from MLv7.x and MLv8.x to MLv9.x

If you have an existing ASPDotNetStorefront MLv7.x and MLv8.x store and would like to upgrade to MLv9.x, then please get in touch and we’d love to help.

Webopius can:

– Install your v7.x/v8.x site onto a staging server ready for upgrading
– Upgrade your database to ASPDotNetStorefront MLv9.x
– Handle any collation issues when migrating the database
– Import the updated MLv9.x string resource libraries for all your supported locales
– Update all your existing skin templates to the new MLv9.x format
– Update all your existing custom code to work within MLv9.x. If you have the source code to the changes this is a straightforward exercise. If not, we can usually re-write the code for you.
– Develop new custom components and XML packages as required to enhance your site within MLv9.x

Webopius have many year’s experience working with all ASPDotNetStorefront versions including MLv7.x, MLv8.x, MLv9.x, ML/DNN and the Interprise Suite versions. Contact us to find out more about the ASPDotNetStorefront services we can provide.

  • Tags