I currently am running a promotional code to get a discount to be given in my oscommerce shopping cart. I have working code when the text is manually entered on the shopping_cart.p hp page.
this calls the discount module and applies the discount when you manually enter the text "CLUB". The code for the discount follows...
I am attempting to accomplish the same call with a checkbox or radio button. I have made numerous feeble attempts to no avail (more than I like to admit). One of my attempts is here
This seems to be close, if I enter "CLUB" in the text box and click the check box it will apply the discount. You're welcome to test this yourself at
http://www.konacoffee. com/catalog/1lb-extra-fancy-medium-roast.html
click add to cart and you'll see the text box for the promotional code, enter "CLUB" caps no quotes and you'll see the discount applied.
Any help and feedback is greatly appreciated.
Aloha from Kona,
Robin
Code:
<?php echo '<td class="main">' . tep_draw_separator('pixel_trans.gif', '20', '1') . tep_draw_input_field('promo_code', '', 'size="10"') . tep_draw_separator('pixel_trans.gif', '5', '1') . 'Promotion Code (optional). Update cart to see discount.</td>'; ?>
Code:
if (!tep_session_is_registered('promo_code')) { tep_session_register('promo_code'); $promo_code = ''; } include_once(DIR_WS_FUNCTIONS.'easy_discount.php'); $easy_discount->reset(); if($promo_code == 'CLUB') { $easy_discount->add('CCD','Coffee Club Discount',$cart->show_total()*0.1); }
Code:
<input type=checkbox name="promo_code" value="CLUB" onClick="submit();">
http://www.konacoffee. com/catalog/1lb-extra-fancy-medium-roast.html
click add to cart and you'll see the text box for the promotional code, enter "CLUB" caps no quotes and you'll see the discount applied.
Any help and feedback is greatly appreciated.
Aloha from Kona,
Robin
Comment