Current algorithm is not sufficient enough since it updates fields in DB on each request to the product (so there is actually at least 2 extra requests to DB: first – update table with calculated price, second – retrieve price to show to end user). This algorithm should be totally re-factored, price will be calculated on-fly as soon as frontend requests price for end user. The procedure will be implemented as a method of user session so each user will have his own price depending on user group and company.
Current algorithm is not sufficient enough since it updates fields in DB on each request to the product (so there is actually at least 2 extra requests to DB: first – update table with calculated price, second – retrieve price to show to end user). This algorithm should be totally re-factored, price will be calculated on-fly as soon as frontend requests price for end user. The procedure will be implemented as a method of user session so each user will have his own price depending on user group and company.