My goal is to create an e-commerce website where customers can see related products on any product page (similar to amazon.com).
I have no idea how to get started with such a daunting task. From my research, my guess is to do the following:
Create a
Category
kind:class Category(ndb.Model): name = ndb.StringProperty()
Whenever a product is created, associate it with a Category via an ancestral relationship:
parent_category = ndb.Key("Category", "Books") new_product = Product( title="Coding Horrors Book", parent=parent_category).put()
Now, on each product page, I can create a query to return a list of books as related products.
I have some concerns with this approach:
Firstly, this doesn't feel like a solid approach.
How do I specify the hierarchical relationship between product categories? For example, if we have two product categories, "AngularJS", "VueJS", how do we specify that these two categories are somehow related?