i want to be able to add a discount code based on what the admin inputs

example

12345 = -10%

3456 = -25.00

then have the user input this code on the either checkout page or shopping cart to deduct this off the total of the cart / checkout page

<?php echo $XCart_sumTotal; ?> is the total before the shipping and <?php echo $XC_GranTotal; ?> is after

what is the best way to do this?

thanks