To provide recommendation/suggestion for the user

To provide recommendation/suggestion for the user

  

Hi,

I would like to esquires how can i do a recommend product if the user select a product? My table data is a following.

For example, the user click on television and television product category is belong to electronics. So in the recommend section, i need to display iphone 7 and tablets to the users.

I am abit lost on how to start on this and appreciate if anyone can advice please? Thanks


ProductCatID

ProductCatName

Electronics

2

Phones

3

Furniture

4

Camera



ID

ProductCatID

ProductName

1

1 & 2

Iphone7

2

3

Sofa

3

1

Television

4

1

tablets


Hi,

You just need to have an aggregate that return all the products with a specific category. For example on the product detail page you can have a list of products with the same category.

Best regards,

Marcelo

Hi Jace,

Your datamodel should be something like this:

Then, you can use an aggregate like this to get the products and their categories:

If you filter it by the Product.Id you will get a list of categories for that product.

Cheers,

José

José Costa wrote:

Hi Jace,

Your datamodel should be something like this:

Then, you can use an aggregate like this to get the products and their categories:

If you filter it by the Product.Id you will get a list of categories for that product.

Cheers,

José

Hi Jose,

I have a product category ID shown as 1 & 2. This is the tricky part that make me stucked. :( 

I have thought of the solution you provided, but the 1 & 2 make me stucked how to design.

ID

ProductCatID

ProductName

1

1 & 2

Iphone7

2

3

Sofa

3

1

Television

4

1

tablets


Hi Jace,

Not knowing the rest of your datamodel I would say to follow my suggestion. It will save you a lot of trouble in the long run.

Cheers,

José

Hi,

José describethe best option but if it is not possible you can use a query:

SELECT ProductId, Name, value  

FROM Product     

 CROSS APPLY STRING_SPLIT(Tags, '&')

where value = <category of your product>

Regards,

Marcelo 

José Costa wrote:

Hi Jace,

Not knowing the rest of your datamodel I would say to follow my suggestion. It will save you a lot of trouble in the long run.

Cheers,

José

Hi Jose,

Meaning i have to do some changes to the data? To become the following:


ID

ProductCatID

ProductName

1

1 

Iphone7

2
2
Iphone 7

3

3

Sofa

4

1

Television

5

1

tablets



Hi,

You should have something like this:


CatId

ProductCatName

Electronics

2

Phones

3

Furniture

4

Camera


ID

ProductId

CatId

1

1

1

2

1

2

3

2

3

4

3

1

541


ID

ProductName

1

Iphone7

2

Sofa

3

Television

4

tablets


Regards,
Marcelo

Marcelo Ferreira wrote:

Hi,

You should have something like this:


CatId

ProductCatName

Electronics

2

Phones

3

Furniture

4

Camera


ID

ProductId

CatId

1

1

1

2

1

2

3

2

3

4

3

1

541


ID

ProductName

1

Iphone7

2

Sofa

3

Television

4

tablets


Regards,
Marcelo

Hi Marcelo,

Thanks thanks.. I will give it a try...

Thanks Jose too..

Let me try out.. :)