Fields

rewards_products_id: General unique record identifier.

scope: Can be '0' for Global (all products), '1' for 'Category' or '2' for 'Product'.

scope_id: If scope is set to Category or Product then this contains the categories_id or products_id of the record it relates to. It is set to 0 for Global.

point_ratio: The ratio of reward points to base price. If you had a product costing €15 and the ratio was set to 1 then you will recieve 15 reward points. If the ratio is set to 2 then you would get 30 reward points. If it was 0.5 then you would get 8 reward points (7.5 rounded up). The calculation is: reward_points=products_price * reward_point_ratio.

bonus_points: For future development.

Indexes:

PRIMARY KEY ( `rewards_products_id` ) : The primary index.

UNIQUE `unique_id` ( `scope` , `scope_id` ): Only one record of a specific scope/scope_id is allowed to exist.

The system works on a fallback basis. If a product has a corresponding reward point record (that is the scope is '2' and the scope_id==product_id) then that records ratio is used. Otherwise if the category has a corresponding record (scope='1' and scope_id=category_id) then that ratio gets used. Otherwise the Global (default) ratio is used.