Understanding Product Popularity

Exporting data from v2 to v3 I wanted to riddle out what the cscart_product_popularity table was doing and discovered the following:

The “total” column is a sum of the activity in the rest of the table, but the values in the other columns are weighed differently to calculate the total.



The total adds up to the following weights

1 Viewed = 3

1 Added = 5

1 Deleted = -5

1 Bought = 10



So if you have a product that was the following data:

Viewed 1 (weight of 3)

Added 1 (weight of 5)

Deleted 0

Bought 1 (weight of 10)

The total popularity value is 18 (3+5+10)



Another example:

Viewed 20 (weight of 60)

Added 5 (weight of 25)

Deleted 3 (weight of -15)

Bought 2 (weight of 20)

The total popularity is 90 (60+25-15+20)



I don't think this is in the knowledge base, so if anyone else ever needs to know this, I'm posting it for posterity.

You can define the weights of these values yourself in the config.php file:

line 158

//Popularity rating

define('POPULARITY_VIEW', 3);

define('POPULARITY_ADD_TO_CART', 5);

define('POPULARITY_DELETE_FROM_CART', 5);

define('POPULARITY_BUY', 10);