Page 1 of 1

Jump to product page

Posted: Mon Apr 06, 2009 8:35 am
by cgreathouse
Hello

I'm trying to figure out how to jump to a product page when an SKU is passed in. Something like this...

http://www.myshop.com/Default.aspx?SKU=ASDF-ASDF

Any pointers on how to go directly to the product with the matching SKU?

Thanks!

Re: Jump to product page

Posted: Mon Apr 06, 2009 9:02 am
by mazhar
Create some custom control that reads sku from query string and then loads products with matching sku on run time. For example you could use some custom query

Code: Select all

string sku = Request.QueryString["Sku"];
ProductCollection products = ProductDataSource.LoadForCriteria(" Sku LIKE '"+sku+"'");
...
...
Also read following article it may help you.
viewtopic.php?f=45&t=6971

Re: Jump to product page

Posted: Mon Apr 06, 2009 9:24 am
by cgreathouse
Getting closer.

So that will help me get the product that matches that SKU. But how do I jump to that product page?

If I have a product called something like "Super Mobile Phone", the URL for the product page looks something like ".../Super-Mobile-Phone-P60.aspx". Is there a way to know what the URL for a product?

Thanks!

Re: Jump to product page

Posted: Mon Apr 06, 2009 9:50 am
by mazhar
You can use Product.NavigateUrl property to get the product details page url for a product.