Developer forum

Forum » Development » eCom:Related.CustomersWhoSawThisAlsoSaw when using ViewModel catalog

eCom:Related.CustomersWhoSawThisAlsoSaw when using ViewModel catalog

Vincent Gercke Pedersen
Reply

Hello,

Is it possible to use access the eCom:Related.CustomersWhoSawThisAlsoSaw (accessible when using the normal Product Catalogue) loop when using Product catalog for ViewModel?


Replies

 
Martin Vang
Martin Vang
Reply

Hi Vincent,

That functionality is currently not available in the viewmodel and we have no clear alternative.

The code (Dynamicweb.Ecommerce.Specialized.RelatedProductListProviders.CustomersWhoSawThisAlsoSaw) that contains the business logic, is not something I think you should add to the template.

BR

Martin

 

 
Vincent Gercke Pedersen
Reply

Thank you for your response - we'll make a custom service to retrieve the products.

 
Nicolai Pedersen
Reply
This post has been marked as an answer

Hi Vincent

The loop you mention is based on a SQL - which is pretty slow. Also loading this list as part of the product rendering is not the best solution because of performance. Also it uses the "Statv2session" data to find the data - in later (9.7+) versions of Dynamicweb we have Dynamicweb Tracking - see https://doc.dynamicweb.com/documentation-9/platform/advanced-settings/web-and-http#8215

The new tracking is recording visitor data in a new way - data can be found in TrackingSession, TrackingView and TrackingEvent. TrackingSession tracks a visit - TrackingView all the pages, groups and products being visited in that visit and TrackingEvent tracks events like add to cart, submit form etc. 9.8 record more information than 9.7.

To solve this, my suggestion would be the following to get a performance that is good enough

  1. Add a new field to the index "CustomersWhoSawThisAlsoSaw" as a string[]
  2. Find the products seen with each product in the index - probably productids - and store them in the field
  3. Create a query that will look into this new field - CustomersWhoSawThisAlsoSaw contains 'prodXYZ', and ProductID <> 'prodXYZ'
  4. Create a page with the product catalog that uses this query and publish the products, maybe in json
  5. Load them on the product detail page after it loads and when the user scrolls to the area.

I know it is a lot of steps, but it would be the best performing way and would scale well.

BR Nicolai

Votes for this answer: 1
 
Vincent Gercke Pedersen
Reply

Thank you, Nicolai! We'll try your approach :-)

 

You must be logged in to post in the forum