Marketing promotions



Our company use complex promotions.
For instance:

if you buy 3 products of X and 2 products of Y then one of Y is free.
If you buy 2 products of (X or y) then one of them has 30% of discount
(if the client buy both allways the discount over the best advantage
for the client).

Well, the are defined a sort of rules.
One product only can be used for one promotion.
Allways the best promotions for the client.
etc.

I think about using Prolog in order to use his backtracking, but I'm
not shure if I am in the wright way.
Does anyone implemented some similar with Prolog or other language ?
Any idea ?
In common language can be coded but the maintenance could be hard, for
this reason , i hope the easy way to introduct new rules.

(Sorry for my English)

Thanks a lot.
Best Regards from Catalonia.

.