First of all thanks Jim for this great contribution. It's exactly what i nedeed!
But i think i found a bug. I'm not sure about this as i don't see anyone complaining about it.
When you want to offer 2 free products for every product they buy, my shopping cart keeps adding only one free product when it should add 2!
I should mention i use version 1.4.2.
After looking into the code, i saw that the quantity of free products is set by the $free_quantity variable of the get1free function in the catalog/includes/classes/shopping_cart.php file.
And to determine the quantity of free products you use this:
$free_quantity = floor ($products_quantity / $get_1_free['products_qualify_quantity']);
This is ok as long as the number of free products you want to give is 1. If you want to give 2 free products or more for each product they buy, you're function would look like this:
$free_quantity = floor (1 / 1);
It adds only one free product when it should add 2. If the customer buys 2 products ($free_quantity = floor (2 / 1)) it will add 2 when it should add 4 and so on.
My solution (i don't know if it's the best) is to multiply the $free_quantity with the number of free products. Like this:
$free_quantity = floor ($products_quantity / $get_1_free['products_qualify_quantity'] * $get_1_free['products_free_quantity']);
And i think that this was your logic too, otherwise i don't see the reason of creating a 'products_free_quantity' field in the table as long as you don't use it anywhere.
I already made this change on the site i am planning to launch in a few days, so please tell me if i am wrong.
Thanks again for the contribution,
Vassy