boxtel Posted May 8, 2006 Share Posted May 8, 2006 Correction necessary to enable the coupon box on SSL pages to not go NONSSL in module easy_coupons_box.php change this: <?php echo tep_draw_form('coupon', tep_href_link(basename($PHP_SELF), '', 'NONSSL')); ?> into this: <?php echo tep_draw_form('coupon', tep_href_link(basename($PHP_SELF), '', $request_type)); ?> Quote Treasurer MFC Link to comment Share on other sites More sharing options...
boxtel Posted May 8, 2006 Author Share Posted May 8, 2006 To give out a coupon at account creations for a first timer for instance. you add: if (EASY_COUPONS) { $new_couponcode = gen_coupon_code(); $coupondisc = 0.1; // 10% coupon for account creation tep_db_query("insert into " . TABLE_COUPONS . " (orders_id_issued, orders_id_used, code, discount, used) values (0, NULL, '".$new_couponcode."', ".$coupondisc.", 0) "); } just before: // build the message content so you can still add the generated coupon code to the welcome email if you like. Be careful though as people might generate fake accounts just to get a new coupon every time. Quote Treasurer MFC Link to comment Share on other sites More sharing options...
spax Posted May 11, 2006 Share Posted May 11, 2006 Hi Amanda, I am having a problem, configuration_cache.php doesn't exist. It isn't in any of the directories nor do you mention it in the instructions. Am I missing something, other than configuration_cache.php? :huh: Quote Link to comment Share on other sites More sharing options...
boxtel Posted May 11, 2006 Author Share Posted May 11, 2006 Hi Amanda, I am having a problem, configuration_cache.php doesn't exist. It isn't in any of the directories nor do you mention it in the instructions. Am I missing something, other than configuration_cache.php? :huh: configuration_cache.php is to update the configuration cache if config data is changed. if you do not have that contribution (which you should as it is a must) then replace these: require ('includes/configuration_cache.php'); with include ('includes/configuration_cache.php'); or remove them altogether. Quote Treasurer MFC Link to comment Share on other sites More sharing options...
spax Posted May 11, 2006 Share Posted May 11, 2006 Thanks for the answer. When you say I should have that contribution, do you mean the Easy Discount contribution or is there another that includes configuration_cache.php? I had installed Easy Discount prior to installing Easy Coupons but can't find configuration_cache.php and I have searched for a contribution called configuration cache. Can you set me straight please? Thank you. Quote Link to comment Share on other sites More sharing options...
spax Posted May 11, 2006 Share Posted May 11, 2006 Ok, no worries! Would you believe I couldn't find it before my last post, I tried again and found it straight away. :-" For anyone else looking, http://www.oscommerce.com/community/contri...iguration_cache Quote Link to comment Share on other sites More sharing options...
Guest Posted May 12, 2006 Share Posted May 12, 2006 Call me crazy, but this mod just isn't working for me. After doing some debugging, I've noticed that when I enter a coupon code, it is registered in the session with the correct discount amount, but it just doesn't display it anywhere on the checkout pages, nor does it pass the discount to my payment processor. A little help? Seems like some code is missing somewhere.. Quote Link to comment Share on other sites More sharing options...
Guest Posted May 12, 2006 Share Posted May 12, 2006 Problem solved, nevermind. Quote Link to comment Share on other sites More sharing options...
Guest Posted May 12, 2006 Share Posted May 12, 2006 The best way to use this mod (I found) is to leave it on 'automatic' but still issue manual coupon codes for whomever needs one. If you're running a large promotion, you probably want to give out a single code that can be used an unlimited number of times. This functionality is added by modifying the code below: In checkout_process.php, change: // set the current coupon code to used if (tep_session_is_registered('couponcode')) tep_db_query("update ".TABLE_COUPONS." set used = 1, orders_id_used = ".$insert_id." where code = '".$couponcode."'"); to: // set the current coupon code to used if (tep_session_is_registered('couponcode')) tep_db_query("update ".TABLE_COUPONS." set used = 1, orders_id_used = ".$insert_id." where code = '".$couponcode."' and orders_id_issued > 0"); Another issue I noticed is that coupon codes generated automatically are not emailed to the customer. If you run a store where you don't include the osCommerce packing slip with a shipment (or if you've got a drop shipper or you're selling electronic goods), just modify the code as below to enable email functionality: In checkout_process.php, find the section of code (around line 270) that begins with: // set the current coupon code to used and ends with: tep_db_query("insert into ".TABLE_COUPONS." (orders_id_issued, orders_id_used, code, discount, used) values (".$insert_id.", NULL,'".$new_couponcode."',".$coupondisc.", 0)"); } Insert the following code just before the closing brace bracket '}': $email_order .= "<b>Earn a " . $b . "% discount the next time you shop!</b> Use this coupon code when you check out: " . $new_couponcode; $email_order .= "\n"; Now, move this entire block of code (including the newly added code and closing bracket) so that it is just above the line that begins with: tep_mail($order->customer['firstname'] ... Voila! You're all set. Make sure you have HTML emails turned on or the bold <b> statements in the email text may not work properly. Feel free to PM me if you're having trouble. Quote Link to comment Share on other sites More sharing options...
spax Posted May 21, 2006 Share Posted May 21, 2006 Hi Amanda, It appears only me and Adam are using this mod so far. Or maybe no one else is having problems. Anyway, a couple of questions. I have re-installed this mod after starting again with a site. Like before, I have a call for a file I don't have - Meta.php this time. Is this for another mod, a meta tag one maybe? I've commented it out right now but confirmation would be good. Also, I don't really want a 4x4 digit code. Can I reduce this to a 4 digit code? I want to print the code on some flyers so a 4 digit one would be better. Obviously, I need to be able to set the code to whatever I put on the flyer. Can that be done from admin? BTW, the buttonsmall_close.gif is missing from the package. Not a problem as I have made one but just to let you know. Cheers! Quote Link to comment Share on other sites More sharing options...
spax Posted May 21, 2006 Share Posted May 21, 2006 BTW, the buttonsmall_close.gif is missing from the package. Not a problem as I have made one but just to let you know. The path to it is wrong also! :-" Quote Link to comment Share on other sites More sharing options...
echolalia Posted July 26, 2006 Share Posted July 26, 2006 Hello, This is a fantastic mod, thank you! I'm having a problem getting it to work. I've followed the instructions and the admin side works fine, i can generate some codes without a problem. however when i try to test it out, I am unable to write anything in the code section. I've installed Easy Discount and still having trouble. Also, I don't really want a 4x4 digit code. Can I reduce this to a 4 digit code? I want to print the code on some flyers so a 4 digit one would be better. Obviously, I need to be able to set the code to whatever I put on the flyer. Can that be done from admin? Has anyone figure out how to have a shorter discount code? Cheers! Quote Link to comment Share on other sites More sharing options...
jonbucs Posted July 27, 2006 Share Posted July 27, 2006 I installed the contribution and the admin side appears to work but when I enter a code in the shopping cart nothing happens. No errors - nothing. Any ideas? I am also interested in creating shorter coupon codes. Any takers? Thanks, Jonathan Quote Link to comment Share on other sites More sharing options...
boxtel Posted August 3, 2006 Author Share Posted August 3, 2006 I installed the contribution and the admin side appears to work but when I enter a code in the shopping cart nothing happens. No errors - nothing. Any ideas? I am also interested in creating shorter coupon codes. Any takers? Thanks, Jonathan make sure you DO NOT put the coupon box INSIDE the form for update basket. I will release a single field version later this week with which you can set any length code and a maximum character field length for the automated ones. I already run it myself (4x4 is actually only appropriate for off the road) but have to re-integrate the message stack stuff and make sure there are no loose ends in it. Quote Treasurer MFC Link to comment Share on other sites More sharing options...
echolalia Posted August 16, 2006 Share Posted August 16, 2006 I've just installed a fresh copy of os-com, and then the easy discount / coupon mods. they all installed fine, no errors etc... both are activated in the admin side - however when i enter a code it doesnt do anything. Like jonbucs mention, when i enter the discount code i've generated in the admin side and then try to enter it in the shopping card nothing happenes. no errors, no messages - the total price still remain the same. i have tried a serious of different codes and all do the same thing. The Easy Coupon V3 - the settings are set to: Active: on Automatic: on Coupon Length: 5 Modules > Order Total Easy Discount - Set to true - set order #1 This might give a clue to why it might not be working: Even with easy discount installed - and the following code set to application_top.php, i cant seem to trigger the easy discount - with 2 or more items in the shopping cart - i still cant get a discount. Thank you! // easy discount rule if ($cart->count_contents() > 1) { $easy_discount->set('CQTY','Cart Quantity Discount',100); } else { $easy_discount->clear('CQTY'); } // get the cart totals once so we do not need to recalculate the cart multiple times if ($cart->count_contents() > 0) { $cart_weight = $cart->show_weight(); $cart_total = $cart->show_total(); } else { $cart_total = 0; $cart_weight = 0; } include (DIR_WS_MODULES.'easy_coupons_code.php'); ?> Quote Link to comment Share on other sites More sharing options...
Alvinluo Posted August 18, 2006 Share Posted August 18, 2006 Hey I have successfully installed for the easy coupons. I tried to order an item and it doesnt minus the price even though I have typed in the Coupon code. This is my site. Click here I have inserted a coupon code called "ALVIN" and can you guys please try to type in this and see whether the price being reduced. Here is my configuration ID Issued by order coupon code Discount end date used used on order 5 manually ALVIN 20% Y Can anyone teach me how to change the issued by order from "MANUALLY to AUTOMATICALLY" ? Thanks in advance. Regards, Alvin Quote Link to comment Share on other sites More sharing options...
boxtel Posted August 18, 2006 Author Share Posted August 18, 2006 Hey I have successfully installed for the easy coupons. I tried to order an item and it doesnt minus the price even though I have typed in the Coupon code. This is my site. Click here I have inserted a coupon code called "ALVIN" and can you guys please try to type in this and see whether the price being reduced. Here is my configuration ID Issued by order coupon code Discount end date used used on order 5 manually ALVIN 20% Y Can anyone teach me how to change the issued by order from "MANUALLY to AUTOMATICALLY" ? Thanks in advance. Regards, Alvin first in includes/modules/easy_coupons_box.php change this : echo tep_hide_session_id() . '<div class="hideMe" id="cp"><img src="images/button_please_wait.gif"></div><div class="showMe" id="cs">'.tep_image_submit('button_cash_in.gif', 'Cash in Coupon', ' onClick="visOn(\'cp\');visOff(\'cs\');" ').'</div>'; to this: echo tep_hide_session_id() .tep_image_submit('button_cash_in.gif', 'Cash in Coupon'); or it looks silly. second, your ALVIN coupon is set to used which means it has been "used" and can no longer be used until you set it to not used. You cannot set manually generated coupons to automatic, automatic coupons are generated during checkout and they result in an order number "issued by order" (the order which triggered the generation) to which they are attached, if you add coupon codes manually they are added manually. Quote Treasurer MFC Link to comment Share on other sites More sharing options...
Alvinluo Posted August 18, 2006 Share Posted August 18, 2006 Thx Amanda for fast reply. I have changed the thing you told me and this is how my easy_coupons_box.php looks like: <td width="100%" align="center"> <?php echo tep_draw_form('coupon', tep_href_link(basename($PHP_SELF), '', $request_type)); ?> <table class="bordergray" width="100%"> <tr> <td valign="middle" align="right" width="50%"> <?php echo EC_COUPONCODE; ?> <?php if ($ec_auto) { ?> <script> document.write(' <a href="java script:session_win2();">'); </script> <noscript> <?php echo ' <a href="info_coupon.php" target="_blank">';?> </noscript> <?php echo tep_image_button('button_about.gif','?',' style="vertical-align: middle" ') . '</a> '; ?> <?php } ?> </td> <td align="center" valign="middle" nowrap> <?php if ($ec_active) { echo tep_draw_password_field('coupon_code1', '', ' size="'.$ec_clth.'" maxlength="'.$ec_clth.'" class="inputbox" '); } else { echo tep_draw_password_field('coupon_code1', '', ' size="'.$ec_clth.'" maxlength="'.$ec_clth.'" disabled class="inputbox" '); } ?> </td> <td align="left" width="50%"> <?php if ($ec_active) { echo tep_hide_session_id() .tep_image_submit('button_cash_in.gif', 'Cash in Coupon'); } else { echo '<img src="includes/languages/'.$language.'/images/buttons/button_cash_in_gray.gif" style="vertical-align:bottom;" alt="Unavailable" title="Unavailable">'; } ?> </td> </tr> </table> </form> </td> I tried create a new coupon and it is not being used. Then I tried to order in an item and insert the coupon code however it did not deduct the money. Any idea for this? You can try it HERE automatic coupons are generated during checkout and they result in an order number "issued by order" (the order which triggered the generation) to which they are attached,if you add coupon codes manually they are added manually. What you mean by automatic coupons are generated during checkout ? means when customer buy a product and check out a generated coupon will came out and they will use this for the next purchase? If like that how are we going to set the discount price for them? Sorry for asking all this newbie question. I am new here and not good in programming. :( Thanks in advance. Best Regards, Alvin Quote Link to comment Share on other sites More sharing options...
boxtel Posted August 18, 2006 Author Share Posted August 18, 2006 Thx Amanda for fast reply. I have changed the thing you told me and this is how my easy_coupons_box.php looks like: <td width="100%" align="center"> <?php echo tep_draw_form('coupon', tep_href_link(basename($PHP_SELF), '', $request_type)); ?> <table class="bordergray" width="100%"> <tr> <td valign="middle" align="right" width="50%"> <?php echo EC_COUPONCODE; ?> <?php if ($ec_auto) { ?> <script> document.write(' <a href="java script:session_win2();">'); </script> <noscript> <?php echo ' <a href="info_coupon.php" target="_blank">';?> </noscript> <?php echo tep_image_button('button_about.gif','?',' style="vertical-align: middle" ') . '</a> '; ?> <?php } ?> </td> <td align="center" valign="middle" nowrap> <?php if ($ec_active) { echo tep_draw_password_field('coupon_code1', '', ' size="'.$ec_clth.'" maxlength="'.$ec_clth.'" class="inputbox" '); } else { echo tep_draw_password_field('coupon_code1', '', ' size="'.$ec_clth.'" maxlength="'.$ec_clth.'" disabled class="inputbox" '); } ?> </td> <td align="left" width="50%"> <?php if ($ec_active) { echo tep_hide_session_id() .tep_image_submit('button_cash_in.gif', 'Cash in Coupon'); } else { echo '<img src="includes/languages/'.$language.'/images/buttons/button_cash_in_gray.gif" style="vertical-align:bottom;" alt="Unavailable" title="Unavailable">'; } ?> </td> </tr> </table> </form> </td> I tried create a new coupon and it is not being used. Then I tried to order in an item and insert the coupon code however it did not deduct the money. Any idea for this? You can try it HERE What you mean by automatic coupons are generated during checkout ? means when customer buy a product and check out a generated coupon will came out and they will use this for the next purchase? If like that how are we going to set the discount price for them? Sorry for asking all this newbie question. I am new here and not good in programming. :( Thanks in advance. Best Regards, Alvin What you mean by automatic coupons are generated during checkout ? means when customer buy a product and check out a generated coupon will came out and they will use this for the next purchase? yes, when in automatic mode, everytime someone checks out a new coupon is created with a value depending on the order amount and your discounting table settings in admin. That coupon is connected to the order and it is printed on the invoices, packing slips and/or confirmation email of that order. You can ofcourse always adjust a coupon value in admin, percentage or money wise, just as you set these when adding coupons manually. When a coupon is used, the used flag is set and the used coupon is connected to the order on which it was used so you can see where it went. Manually added coupons are only connected to the order on which they were used as they were not issued by any order. I tried create a new coupon and it is not being used. Then I tried to order in an item and insert the coupon code however it did not deduct the money. Any idea for this? you have easy discount installed and working ? what are the coupon settings ? Quote Treasurer MFC Link to comment Share on other sites More sharing options...
boxtel Posted August 18, 2006 Author Share Posted August 18, 2006 yes, when in automatic mode, everytime someone checks out a new coupon is created with a value depending on the order amount and your discounting table settings in admin. That coupon is connected to the order and it is printed on the invoices, packing slips and/or confirmation email of that order. You can ofcourse always adjust a coupon value in admin, percentage or money wise, just as you set these when adding coupons manually. When a coupon is used, the used flag is set and the used coupon is connected to the order on which it was used so you can see where it went. Manually added coupons are only connected to the order on which they were used as they were not issued by any order. you have easy discount installed and working ? what are the coupon settings ? and place the coupon box outside of your update cart form or the cash in button will initiate an update cart action and not a coupon action. now you have: <form update cart> <form coupon> </form> </form> make it: <form update cart> </form> <form coupon> </form> Quote Treasurer MFC Link to comment Share on other sites More sharing options...
Alvinluo Posted August 18, 2006 Share Posted August 18, 2006 Hey Amanda, easy coupons requires easy discount to work ? I have tried to install easy discount..but i didnt insert any formula there..is this consider done? or wat else should i need to do ? Well, I have tried to insert the coupon code and it still did not deduct the price. However, in my admin setting tools, there is a new coupon generated .. and i tried to use that coupon to buy thing and it still did not show up the discounted price. I went to check the admin tools again and it has generated another coupon. What's wrong with this? The coupon should we type for each process? what i mean is in the checkout payment,checkout shipping and checkout confirmation. Thanks in advance. Best Regards, Alvin Quote Link to comment Share on other sites More sharing options...
Alvinluo Posted August 18, 2006 Share Posted August 18, 2006 Here is my code for shopping_cart.php. Can you help me check see whether my coupon box placed correctly. Really thank you. <?php /* $Id: shopping_cart.php,v 1.73 2003/06/09 23:03:56 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ require("includes/application_top.php"); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_SHOPPING_CART); $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_SHOPPING_CART)); include_once (DIR_WS_FUNCTIONS.'easy_discount.php'); ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <title><?php echo TITLE; ?></title> <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"> <link rel="stylesheet" type="text/css" href="stylesheet.css"> <script language="javascript"><!-- function session_win2() { window.open("<?php echo tep_href_link(FILENAME_INFO_COUPON); ?>","info_coupon"," height=360,width=700,toolbar=no,statusbar=no,scrollbars=yes").focus(); } function autotab(original,destination){if (original.getAttribute&&original.value.length==original.getAttribute("maxlength"))destination.focus()} //--></script> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <table border="0" width=437 cellspacing="0" cellpadding="0"> <tr> <!-- body_text //--> <td width="100%" valign="top"><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_SHOPPING_CART, 'action=update_product')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> </tr> </table></td> </tr> <tr> <td class=ch7><?php echo tep_draw_separator('pixel_trans.gif', '437', '3'); ?></td> </tr> <?php if ($cart->count_contents() > 0) { ?> <tr> <td class=ch7 align=right> <?php $info_box_contents = array(); $info_box_contents[0][] = array('align' => 'center', 'params' => 'class="productListing-heading"', 'text' => TABLE_HEADING_REMOVE); $info_box_contents[0][] = array('params' => 'class="productListing-heading"', 'text' => TABLE_HEADING_PRODUCTS); $info_box_contents[0][] = array('align' => 'center', 'params' => 'class="productListing-heading"', 'text' => TABLE_HEADING_QUANTITY); $info_box_contents[0][] = array('align' => 'right', 'params' => 'class="productListing-heading"', 'text' => TABLE_HEADING_TOTAL); $any_out_of_stock = 0; $products = $cart->get_products(); for ($i=0, $n=sizeof($products); $i<$n; $i++) { // Push all attributes information in an array if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) { while (list($option, $value) = each($products[$i]['attributes'])) { echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value); $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $products[$i]['id'] . "' and pa.options_id = '" . $option . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $value . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'"); $attributes_values = tep_db_fetch_array($attributes); $products[$i][$option]['products_options_name'] = $attributes_values['products_options_name']; $products[$i][$option]['options_values_id'] = $value; $products[$i][$option]['products_options_values_name'] = $attributes_values['products_options_values_name']; $products[$i][$option]['options_values_price'] = $attributes_values['options_values_price']; $products[$i][$option]['price_prefix'] = $attributes_values['price_prefix']; } } } for ($i=0, $n=sizeof($products); $i<$n; $i++) { if (($i/2) == floor($i/2)) { $info_box_contents[] = array('params' => 'class="productListing-even"'); } else { $info_box_contents[] = array('params' => 'class="productListing-odd"'); } $cur_row = sizeof($info_box_contents) - 1; $info_box_contents[$cur_row][] = array('align' => 'center', 'params' => 'class="productListing-data" valign="top"', 'text' => tep_draw_checkbox_field('cart_delete[]', $products[$i]['id'])); $products_name = '<table border="0" cellspacing="0" cellpadding="0" width=230>' . ' <tr>' . ' <td class="ZZZproductListing-data" style="padding-left:15px;padding-right:12px" align="left" ><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">' . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td>' . ' <td class="ZZZproductListing-data" valign="top"><a style="color:#484E53; font-size:11px" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '"><b>' . $products[$i]['name'] . '</b></a><div style="color:#484E53; font-size:11px">'.preg_replace('/\s\S*$/i', '', substr($products[$i]['description'], 0, 50)).'</div>'; if (STOCK_CHECK == 'true') { $stock_check = tep_check_stock($products[$i]['id'], $products[$i]['quantity']); if (tep_not_null($stock_check)) { $any_out_of_stock = 1; $products_name .= $stock_check; } } if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) { reset($products[$i]['attributes']); while (list($option, $value) = each($products[$i]['attributes'])) { $products_name .= '<br><small><i> - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'] . '</i></small>'; } } $products_name .= ' </td>' . ' </tr>' . '</table>'; $info_box_contents[$cur_row][] = array('params' => 'class="productListing-data"', 'text' => $products_name); $info_box_contents[$cur_row][] = array('align' => 'center', 'params' => 'class="productListing-data" valign="top"', 'text' => tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="2"') . tep_draw_hidden_field('products_id[]', $products[$i]['id'])); $info_box_contents[$cur_row][] = array('align' => 'right', 'params' => 'class="productListing-data" valign="top"', 'text' => '<b>' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . '</b>'); } new productListingBox($info_box_contents); ?> </td> </tr> <tr> <td class=ch7 style="background: #E2F3C7;" ><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td class=ch7 align="right" style="color:#484E53; background: #E2F3C7; font-size:11px; padding-right:5px" class="main"><b><?php echo SUB_TITLE_SUB_TOTAL; ?> <?php echo $currencies->format($cart->show_total()); ?></b></td> </tr> <?php if ($easy_discount->count() > 0) { echo easy_discount_display(); echo '<tr><td align="right">'.SUB_TITLE_TOTAL.'</td><td align="right">'.$currencies->format(($cart->show_total() - $easy_discount->total())).'</td></tr>'; } ?> <?php if ($any_out_of_stock == 1) { if (STOCK_ALLOW_CHECKOUT == 'true') { ?> <tr> <td class=ch7 style="background: #E2F3C7;" class="stockWarning" align="center"><br><?php echo OUT_OF_STOCK_CAN_CHECKOUT; ?></td> </tr> <?php } else { ?> <tr> <td class=ch7 style="background: #E2F3C7;" class="stockWarning" align="center"><br><?php echo OUT_OF_STOCK_CANT_CHECKOUT; ?></td> </tr> <?php } } ?> <tr> <td class=ch7 style="background: #E2F3C7;" ><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td class=ch7 style="background: #E2F3C7;" ><table border="0" width=437 cellspacing="0" cellpadding="0" class="infoBox"> <tr class="infoBoxContents"> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td align=right style="text-align:right; padding-top:5px; background: #E2F3C7;; padding-right:5px; padding-bottom:5px;"> <?php echo tep_image_submit('button_update_cart.gif', IMAGE_BUTTON_UPDATE_CART); ?> <?php $back = sizeof($navigation->path)-2; if (isset($navigation->path[$back])) { ?> <?php echo '<a href="' . tep_href_link($navigation->path[$back]['page'], tep_array_to_string($navigation->path[$back]['get'], array('action')), $navigation->path[$back]['mode']) . '">' . tep_image_button('button_continue_shopping.gif', IMAGE_BUTTON_CONTINUE_SHOPPING) . '</a>'; ?> <?php } ?> <?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_image_button('button_checkout.gif', IMAGE_BUTTON_CHECKOUT) . '</a>'; ?> </td> </tr> </table></td> </tr> </table></td> </tr> <tr><td><img src=images/m30.gif width=438 height=7></td></tr> <?php } else { ?> <tr> <td align="center" class="main"><?php new infoBox(array(array('text' => TEXT_CART_EMPTY))); ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox"> <tr class="infoBoxContents"> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td align="right" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> </table></td> </tr> </table></td> </tr> <?php } ?> [color=#FF0000]<?php include (DIR_WS_MODULES.'easy_coupons_box.php'); ?>[/color] </table></form></td> <!-- body_text_eof //--> </tr> </table> <!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> I found out another problem. When the coupon code is generated, it doesnt send to the email that i login to buy. I am so sorry to trouble you so much. But I really need help. Really appreciate your help. Thank you ! Regards, Alvin Quote Link to comment Share on other sites More sharing options...
boxtel Posted August 18, 2006 Author Share Posted August 18, 2006 Here is my code for shopping_cart.php. Can you help me check see whether my coupon box placed correctly.Really thank you. <?php /* $Id: shopping_cart.php,v 1.73 2003/06/09 23:03:56 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ require("includes/application_top.php"); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_SHOPPING_CART); $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_SHOPPING_CART)); include_once (DIR_WS_FUNCTIONS.'easy_discount.php'); ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <title><?php echo TITLE; ?></title> <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"> <link rel="stylesheet" type="text/css" href="stylesheet.css"> <script language="javascript"><!-- function session_win2() { window.open("<?php echo tep_href_link(FILENAME_INFO_COUPON); ?>","info_coupon"," height=360,width=700,toolbar=no,statusbar=no,scrollbars=yes").focus(); } function autotab(original,destination){if (original.getAttribute&&original.value.length==original.getAttribute("maxlength"))destination.focus()} //--></script> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <table border="0" width=437 cellspacing="0" cellpadding="0"> <tr> <!-- body_text //--> <td width="100%" valign="top"><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_SHOPPING_CART, 'action=update_product')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> </tr> </table></td> </tr> <tr> <td class=ch7><?php echo tep_draw_separator('pixel_trans.gif', '437', '3'); ?></td> </tr> <?php if ($cart->count_contents() > 0) { ?> <tr> <td class=ch7 align=right> <?php $info_box_contents = array(); $info_box_contents[0][] = array('align' => 'center', 'params' => 'class="productListing-heading"', 'text' => TABLE_HEADING_REMOVE); $info_box_contents[0][] = array('params' => 'class="productListing-heading"', 'text' => TABLE_HEADING_PRODUCTS); $info_box_contents[0][] = array('align' => 'center', 'params' => 'class="productListing-heading"', 'text' => TABLE_HEADING_QUANTITY); $info_box_contents[0][] = array('align' => 'right', 'params' => 'class="productListing-heading"', 'text' => TABLE_HEADING_TOTAL); $any_out_of_stock = 0; $products = $cart->get_products(); for ($i=0, $n=sizeof($products); $i<$n; $i++) { // Push all attributes information in an array if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) { while (list($option, $value) = each($products[$i]['attributes'])) { echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value); $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $products[$i]['id'] . "' and pa.options_id = '" . $option . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $value . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'"); $attributes_values = tep_db_fetch_array($attributes); $products[$i][$option]['products_options_name'] = $attributes_values['products_options_name']; $products[$i][$option]['options_values_id'] = $value; $products[$i][$option]['products_options_values_name'] = $attributes_values['products_options_values_name']; $products[$i][$option]['options_values_price'] = $attributes_values['options_values_price']; $products[$i][$option]['price_prefix'] = $attributes_values['price_prefix']; } } } for ($i=0, $n=sizeof($products); $i<$n; $i++) { if (($i/2) == floor($i/2)) { $info_box_contents[] = array('params' => 'class="productListing-even"'); } else { $info_box_contents[] = array('params' => 'class="productListing-odd"'); } $cur_row = sizeof($info_box_contents) - 1; $info_box_contents[$cur_row][] = array('align' => 'center', 'params' => 'class="productListing-data" valign="top"', 'text' => tep_draw_checkbox_field('cart_delete[]', $products[$i]['id'])); $products_name = '<table border="0" cellspacing="0" cellpadding="0" width=230>' . ' <tr>' . ' <td class="ZZZproductListing-data" style="padding-left:15px;padding-right:12px" align="left" ><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">' . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td>' . ' <td class="ZZZproductListing-data" valign="top"><a style="color:#484E53; font-size:11px" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '"><b>' . $products[$i]['name'] . '</b></a><div style="color:#484E53; font-size:11px">'.preg_replace('/\s\S*$/i', '', substr($products[$i]['description'], 0, 50)).'</div>'; if (STOCK_CHECK == 'true') { $stock_check = tep_check_stock($products[$i]['id'], $products[$i]['quantity']); if (tep_not_null($stock_check)) { $any_out_of_stock = 1; $products_name .= $stock_check; } } if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) { reset($products[$i]['attributes']); while (list($option, $value) = each($products[$i]['attributes'])) { $products_name .= '<br><small><i> - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'] . '</i></small>'; } } $products_name .= ' </td>' . ' </tr>' . '</table>'; $info_box_contents[$cur_row][] = array('params' => 'class="productListing-data"', 'text' => $products_name); $info_box_contents[$cur_row][] = array('align' => 'center', 'params' => 'class="productListing-data" valign="top"', 'text' => tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="2"') . tep_draw_hidden_field('products_id[]', $products[$i]['id'])); $info_box_contents[$cur_row][] = array('align' => 'right', 'params' => 'class="productListing-data" valign="top"', 'text' => '<b>' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . '</b>'); } new productListingBox($info_box_contents); ?> </td> </tr> <tr> <td class=ch7 style="background: #E2F3C7;" ><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td class=ch7 align="right" style="color:#484E53; background: #E2F3C7; font-size:11px; padding-right:5px" class="main"><b><?php echo SUB_TITLE_SUB_TOTAL; ?> <?php echo $currencies->format($cart->show_total()); ?></b></td> </tr> <?php if ($easy_discount->count() > 0) { echo easy_discount_display(); echo '<tr><td align="right">'.SUB_TITLE_TOTAL.'</td><td align="right">'.$currencies->format(($cart->show_total() - $easy_discount->total())).'</td></tr>'; } ?> <?php if ($any_out_of_stock == 1) { if (STOCK_ALLOW_CHECKOUT == 'true') { ?> <tr> <td class=ch7 style="background: #E2F3C7;" class="stockWarning" align="center"><br><?php echo OUT_OF_STOCK_CAN_CHECKOUT; ?></td> </tr> <?php } else { ?> <tr> <td class=ch7 style="background: #E2F3C7;" class="stockWarning" align="center"><br><?php echo OUT_OF_STOCK_CANT_CHECKOUT; ?></td> </tr> <?php } } ?> <tr> <td class=ch7 style="background: #E2F3C7;" ><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td class=ch7 style="background: #E2F3C7;" ><table border="0" width=437 cellspacing="0" cellpadding="0" class="infoBox"> <tr class="infoBoxContents"> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td align=right style="text-align:right; padding-top:5px; background: #E2F3C7;; padding-right:5px; padding-bottom:5px;"> <?php echo tep_image_submit('button_update_cart.gif', IMAGE_BUTTON_UPDATE_CART); ?> <?php $back = sizeof($navigation->path)-2; if (isset($navigation->path[$back])) { ?> <?php echo '<a href="' . tep_href_link($navigation->path[$back]['page'], tep_array_to_string($navigation->path[$back]['get'], array('action')), $navigation->path[$back]['mode']) . '">' . tep_image_button('button_continue_shopping.gif', IMAGE_BUTTON_CONTINUE_SHOPPING) . '</a>'; ?> <?php } ?> <?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_image_button('button_checkout.gif', IMAGE_BUTTON_CHECKOUT) . '</a>'; ?> </td> </tr> </table></td> </tr> </table></td> </tr> <tr><td><img src=images/m30.gif width=438 height=7></td></tr> <?php } else { ?> <tr> <td align="center" class="main"><?php new infoBox(array(array('text' => TEXT_CART_EMPTY))); ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox"> <tr class="infoBoxContents"> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td align="right" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> </table></td> </tr> </table></td> </tr> <?php } ?> [color=#FF0000]<?php include (DIR_WS_MODULES.'easy_coupons_box.php'); ?>[/color] </table></form></td> <!-- body_text_eof //--> </tr> </table> <!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> I found out another problem. When the coupon code is generated, it doesnt send to the email that i login to buy. I am so sorry to trouble you so much. But I really need help. Really appreciate your help. Thank you ! Regards, Alvin in: <?php } ?> <?php include (DIR_WS_MODULES.'easy_coupons_box.php'); ?> </table></form></td> you move the </form> tag above : <?php } ?> like : </form> <?php } ?> <?php include (DIR_WS_MODULES.'easy_coupons_box.php'); ?> </table></td> <?php } ?> Quote Treasurer MFC Link to comment Share on other sites More sharing options...
Alvinluo Posted August 18, 2006 Share Posted August 18, 2006 Hey Amanda, I have followed your instruction and it's still failed. here is the end of my shopping_cart.php. <tr class="infoBoxContents"> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td align="right" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> </table></td> </tr> </table></td> </tr> <?php } ?> </form> <?php include (DIR_WS_MODULES.'easy_coupons_box.php'); ?> </table></td> <!-- body_text_eof //--> </tr> </table> <!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> Do you have any file for this? Do you mind to send to me ? May be I can use yours and compare.. I tried this whole day and it doesnt work. =( Really thank you because you have contributed so much. Regards, Alvin Quote Link to comment Share on other sites More sharing options...
boxtel Posted August 18, 2006 Author Share Posted August 18, 2006 Hey Amanda, easy coupons requires easy discount to work ? I have tried to install easy discount..but i didnt insert any formula there..is this consider done? or wat else should i need to do ? Well, I have tried to insert the coupon code and it still did not deduct the price. However, in my admin setting tools, there is a new coupon generated .. and i tried to use that coupon to buy thing and it still did not show up the discounted price. I went to check the admin tools again and it has generated another coupon. What's wrong with this? The coupon should we type for each process? what i mean is in the checkout payment,checkout shipping and checkout confirmation. Thanks in advance. Best Regards, Alvin easy coupons requires easy discount to work ? yes I have tried to install easy discount. did you and does it work ? The coupon should we type for each process? what i mean is in the checkout payment,checkout shipping and checkout confirmation. no, only 1 time, wherever you put the box. I have the box in the shopping cart but I also show the box in checkout confirmation if they did not give a coupon code in the shopping cart (last chance). Quote Treasurer MFC Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.