Developer forum

Forum » Templates » Tag does not return Product ID

Tag does not return Product ID


Reply
I have a solution, where eCom Light is used to manage employees.

On the front page, i have a column that shows three employees:
http://brockstedt.net.dynamicweb.dk/en-US/Forside.aspx

Each empolyee has a link that should show the product/emplyee in this layout:
http://brockstedt.net.dynamicweb.dk/en-US/Medarbejdere/Juridiske-medarbejdere.aspx?ProductID=PROD1&PID=65

To get there, i have used this JavaScript:
<script type="text/javascript">
<!--@LoopStart(ProductGroups)-->

var id = "<!--@Server:Request.productid-->";
var pid = "<!--@Ecom:Group:Field.afsnit.Value-->";

<!--@LoopEnd(ProductGroups)-->

function navigate(url){
location = 'en-US/Medarbejdere/Juridiske-medarbejdere.aspx?' + 'ProductID=' + id + '&PID=' + pid;
}
</script>
but the script does not return the correct adress. The tag <!--@Server:Request.productid-->  is not rendered so the returned URL looks like this:
http://brockstedt.net.dynamicweb.dk/en-US/Medarbejdere/Juridiske-medarbejdere.aspx?ProductID=%3C!--@Server:Request.productid--%3E&PID=65

Any ideas as to what i am doing wrong?

I would also like to make this part dynamic:
en-US/Medarbejdere/Juridiske-medarbejdere.aspx?
What tag should i use?

/Iben Louise


Replies

 
Reply
Hi there,

You seem to be building up the URL dynamically in Forside.aspx, with this code:

var id = "<!--@Server:Request.productid-->";


However, it seems that on that page where you use this code, no product ID is present in the Query String, and thus the tag remains unchanged, resulting in an incorrect id and a broken link.

Imar
 
Reply
Okay... 

Is there an alternate way to resolve this?

/Iben Louise
 
Reply

I am not sure, as I am not sure what you're trying to accomplish.

If you want to use the same code for pages with and without a ProductID in the query string, you can use Dynamicweb's If Defined to have different code depending on the presence of that QueryString variable.

Hope this helps,

Imar

 
Reply
I am trying to get the links from the frontpage (the colomn called 'OM OS') to show the person/product on a page with an other layout than the front page.

For example: The link 'Aksel Holst Nielsen' should show this: http://brockstedt.net.dynamicweb.dk/en-US/Medarbejdere/Juridiske-medarbejdere.aspx?ProductID=PROD1&PID=65

/Iben Louise
 
Reply
And the employees are actually eCom products, right? Why not simply add a Product Catalog module, select a group and let the default eCom templates handles this for you?

Imar
 
Reply
Whenever i do this, the product is shown within the colomn in the frontpage layout when the link is clicked. Test here:
http://brockstedt.net.dynamicweb.dk/en-US/Forside.aspx
Click one of the links in the 'OM OS' colomn.
 
Reply
This post has been marked as an answer
What about linking to your own custom details page (with its own Catalog module) and link using Ecom:Product.ID?

Imar
Votes for this answer: 1

 

You must be logged in to post in the forum