I had to combine several search results from the index, so I figured performance wise it should be best if I ran searches directly against the api. I built a webApi controller to for interaction between front-end and backend - results are returned as json and rendered by javascript.
However, I can't figure out how I should generate links for products/groups I retrieve from the index. If I look at product-list-json.html template which generates JSON for an Ecom module, it has something like this:
[<!--@LoopStart(Products)--><!--@If(Products.LoopCounter>1)-->,<!--@EndIf-->{ "id": "<!--@Ecom:Product.ID.JSEncoded()-->", "name": "<!--@Ecom:Product.Name.JSEncoded()-->", "number": "<!--@Ecom:Product.Number.JSEncoded()-->", "price": "<!--@Ecom:Product.Price.JSEncoded()-->", "link": "Default.aspx?ID=<!--@Ecom:Product.PrimaryOrCurrentPageID-->&GroupID=<!--@Ecom:Product.PrimaryOrFirstGroupID-->&ProductID=<!--@Ecom:Product.ID--><!--@If Defined(Ecom:Product.VariantID)-->&VariantID=<!--@Ecom:Product.VariantID--><!--@EndIf-->", "variantid": "<!--@Ecom:Product.VariantID.JSEncoded()-->", "description": "<!--@Ecom:Product.ShortDescription.JSEncoded()-->", "image": "<!--@Ecom:Product.ImageSmall.Default.Clean.JSEncoded()-->", "synonym": "<!--@Ecom:Product:Field.Synonym.JSEncoded()-->" }<!--@LoopEnd(Products)--> ]
What I am trying to mimic is ""Default.aspx?ID=<!--@Ecom:Product.PrimaryOrCurrentPageID-->&GroupID=<!--@Ecom:Product.PrimaryOrFirstGroupID-->&ProductID=<!--@Ecom:Product.ID--><!--@If Defined(Ecom:Product.VariantID)-->", but response from the index doesn't contain PrimaryOrCurrentPageID. But even if I load product from Ecommerce by Id, it doesnt have that page id either. Where can I get it from?