Kentico CMS 6.0 E-commerce Guide

Getting product URL

Getting product URL

Previous topic Next topic Mail us feedback on this topic!  

Getting product URL

Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic!  

In some cases, you may need to get the URL of the document to which some product is assigned. Knowing product URL can be useful when you work with specific web parts such as the Product datalist which is using the e-commerce product (SKU) properties to display products instead of the standard CMS documents.

 

For this, you need to insert the GetProductUrl method with the following syntax into your transformation:

 

<%# EcommerceFunctions.GetProductUrl(Eval("SKUID")) %>

 

As a result, you will get the product URL in the /CMSPages/GetProduct.aspx?productId=125 format.

 

 

Alternatively, you can provide the method with values of the SKUGUID and SKUName columns:

 

<%# EcommerceFunctions.GetProductUrl(Eval("SKUGUID"), Eval("SKUName")) %>"

 

This syntax returns the URL in the ~/getproduct/<skuguid>/<safe_skuname>.<extension> format.