A working script that will apply (In this Case) a 10% Discount on all cart items after the user/customer clicks the 'Checkout' button.
Find this Line in the simpleCart.js (Version = '2.2.2')
form.appendChild( me.createHiddenElement( "amount_" + counter, item.price ) );
And Modify it to This
form.appendChild( me.createHiddenElement( "amount_" + counter, this.currencyStringForPaypalCheckout( (item.price)* discount ) ) );
I should also mention that for the Discount Code Entry Page; I used ''Web Page Password Protect'' from www.zubrag.com
A few notes:
Pay close attention to the ''cart.php'' and the ''cart_discount.php'' files; in particular the cart.php file's include statement:
<?php include("/home/uswsc3/public_html/discount_example/cart_discount.php"); ?>
To find your relevant path (like the one above) use the following syntax:
Will continue to redirect to ''cart_discount.php'' page until the correct ''Discount Code'' is entered.
Once the correct ''Discount Code'' is entered however, the redirect no longer exist and the ''cart.php'' page is loaded. This is where the 10% Discount cookie is set.
The code uses two (cookies) to operate.
''discount'' cookie sets the 10% (.9) Discount.
''verify'' verifies the discount was set to .9
All cookies (including the simpleCart cookies) have been set to 1 day (24 Hours).
(Your E-Mail Address Will NOT Be Shared or Published)