OK, so it was brought to my attention that my system only is available at the same time as purchasing a product. There is a good reason for this => it’s an order_total module so it needs to have an order made to process it – and standard osCommerce does not allow an order to be made without products…
So, with a bit of lateral thinking I came up with a solution – use a faux (false) product. Easy in theory and fairly easy in practice…
1. Need to recode the shopping_cart box to always show the cart subtotal. Needed to do this to show the inputted charity amount even if no products are in the cart.
2. Need to recode the shopping cart page to show the update cart, checkout, buttons at all times. Needed in order to be able to input the charity amount and begin the checkout procedure.
3. Need to recode the checkout_shipping page to add 1 extra line of code to add a false (cost zero) product if the cart has a total of exactly zero items in it, and the cart total does not = zero. In other words, a charity donation. If there is already a real product in the cart along with a donation, then this is un-needed of course.
4. Add an extra contribution to skip the checkout_shipping calculations if the cart only has the faux product and donation in it.
5. A couple of small changes in application_top.php in order to deal with the adding and removal of the charity amount, and consequently the adding and removal of the faux product.
Here is a video showing the system in action. Obviously it still needs cleaning up a lot (sponsor needed for this if anyone is interested), and is on my test shop hence the messy layout. But it should give a general idea of where the contribution is at right now.