Guest Posted December 2, 2010 Share Posted December 2, 2010 Hello! I have recently installed One Page Checkout and already had the Discount Coupon Codes contribution installed. They seem to work together no problem when a customer is logged in. But I want to be able to offer discount coupons / vouchers to new customers that don't want to create an account. Is there some code that I can add or take out that will make this possible? At the moment when you enter the Coupon / Voucher code before logging in I get the following error message; "There was an error redeeming coupon, please inform punkrockcds.com about this error." As always any help with this would be much appreciated. Cheers, Mark. Quote Link to comment Share on other sites More sharing options...
steve_s Posted December 2, 2010 Share Posted December 2, 2010 Hello! I have recently installed One Page Checkout and already had the Discount Coupon Codes contribution installed. They seem to work together no problem when a customer is logged in. But I want to be able to offer discount coupons / vouchers to new customers that don't want to create an account. Is there some code that I can add or take out that will make this possible? At the moment when you enter the Coupon / Voucher code before logging in I get the following error message; "There was an error redeeming coupon, please inform punkrockcds.com about this error." As always any help with this would be much appreciated. Cheers, Mark. Hi Do you get the same same error when one page checkout is switched of? if not do a search for the code in includes/classes/onepage_checkout.php that the contribution says to add and see if any code similliar Steve Quote Link to comment Share on other sites More sharing options...
Guest Posted December 2, 2010 Share Posted December 2, 2010 Hello Steve, Thanks very much for trying to help! When One Page Checkout is switched off the customer has to sign in or create an account so the discount code (which is later in the checkout process) works fine. The problem is that One Page Checkout has a Purchase Without Account facility built in which is great on its own but it won't allow the discount code unless the customer either signs in first or is already logged in! I want to be able to offer discount coupons / vouchers to "potential" customers eg. Facebook fans etc. rather than limiting vouchers to current customers. Any ideas? Cheers, Mark. Quote Link to comment Share on other sites More sharing options...
steve_s Posted December 5, 2010 Share Posted December 5, 2010 Hello Steve, Thanks very much for trying to help! When One Page Checkout is switched off the customer has to sign in or create an account so the discount code (which is later in the checkout process) works fine. The problem is that One Page Checkout has a Purchase Without Account facility built in which is great on its own but it won't allow the discount code unless the customer either signs in first or is already logged in! I want to be able to offer discount coupons / vouchers to "potential" customers eg. Facebook fans etc. rather than limiting vouchers to current customers. Any ideas? Cheers, Mark. Hi Mark i would ask that question in that contributions support forums, it probably has some code to test if customer is loged in then it will apply the discount should be a simple fix of removing that if statement Steve Quote Link to comment Share on other sites More sharing options...
marcianokent Posted December 5, 2010 Share Posted December 5, 2010 Thanks for great contrib :thumbsup: need help to install this contrib for osc 2.3.1 Quote Link to comment Share on other sites More sharing options...
Guest Posted December 6, 2010 Share Posted December 6, 2010 Hi Mark i would ask that question in that contributions support forums, it probably has some code to test if customer is loged in then it will apply the discount should be a simple fix of removing that if statement Steve Hello Steve, Again thanks for the reply. I was originally going to post this in the Discount Coupon Codes Support forum but it doesn't look like there's any support for this contribution anymore. (at least no one there seems to be getting any replies!!) Like you say there must be some code in a file somewhere that checks if a customer is logged in before applying the discount and if not throwing out the error message. I've searched checkout.php and includes/classes/onepage_checkout.php but can't seem to find it! Have you any idea which file this statement might be in? Cheers, Mark. Quote Link to comment Share on other sites More sharing options...
m3ndi3 Posted December 6, 2010 Share Posted December 6, 2010 Hi Steve, I have OPC all installed and working great! Paypal express is the only payment module I have at the moment, but it seems that when I pay with paypal express, after I confirm and then it redirects me to checkout.php?action=process_confirm, checkout_process.php ends up being a blank page. It's weird but the payment goes through, also when I hit the back button from the blank page, my contents from my purchase are still in my shopping cart... Any help would be appreciated! here are the errors I get from the "blank page" (checkout_process.php) Notice: Undefined index: shipping_tax_total in /includes/classes/order.php on line 235 Notice: Undefined variable: tax_address in /includes/classes/discount_coupon.php on line 304 Notice: Undefined variable: tax_address in /includes/classes/discount_coupon.php on line 304 Notice: Undefined index: categories in /includes/classes/discount_coupon.php on line 201 Notice: Undefined index: products in /includes/classes/discount_coupon.php on line 231 Notice: Undefined index: manufacturers in /includes/classes/discount_coupon.php on line 253 Notice: Undefined index: error in /includes/classes/discount_coupon.php on line 461 Notice: Undefined index: error in /includes/classes/discount_coupon.php on line 461 Warning: Cannot modify header information - headers already sent by (output started at /includes/classes/order.php:235) in /includes/functions/general.php on line 33 Quote Link to comment Share on other sites More sharing options...
fernyburn Posted December 7, 2010 Share Posted December 7, 2010 Hi Is there any way to add a box that shows the billing and shipping address, before checkout is confirmed. (like the one that shows when an account is made) We have had a few orders where the customer has pressed the continue button to go to payment, and the delivery address has been wrong, or the information has been lost. Thanks Ron Quote Link to comment Share on other sites More sharing options...
fernyburn Posted December 7, 2010 Share Posted December 7, 2010 (edited) another question... can someone tell me how to prevent the order button being clicked multiple times. I understand that there is javascript to prevent this - but can't figure out how to implement it on checkout.php here is some javascript code to stop people from hitting submit twice, while it only works if javascript is enabled, a text announcement in large bold letters: Please click submit only once will also help for those who do not have javascript enabled. For the header tag area <script> /* systemsmanager begin - no double submit */ var form = ""; var submitted = false; var error = false; var error_message = ""; var formerrormsg="You\'ve attempted to submit the form multiple times.\n Please reload page if you need to resubmit form." function checksubmit(submitbtn){ submitbtn.form.submit() checksubmit=blocksubmit return false } function blocksubmit(){ if (typeof formerrormsg!="undefined") alert(formerrormsg) return false } /* systemsmanager end - no double submit */ </script> Then the confirm order button: /* systemsmanager begin - no double submit */ echo tep_image_submit('button_confirm_order.gif', IMAGE_BUTTON_CONFIRM_ORDER, 'onClick="return checksubmit(this)"') . '</form>' . "\n"; /* systemsmanager end - no double submit */ cheers and HTH Peter M can anyone help ? Edited December 7, 2010 by fernyburn Quote Link to comment Share on other sites More sharing options...
steve_s Posted December 7, 2010 Share Posted December 7, 2010 Hello Steve, Again thanks for the reply. I was originally going to post this in the Discount Coupon Codes Support forum but it doesn't look like there's any support for this contribution anymore. (at least no one there seems to be getting any replies!!) Like you say there must be some code in a file somewhere that checks if a customer is logged in before applying the discount and if not throwing out the error message. I've searched checkout.php and includes/classes/onepage_checkout.php but can't seem to find it! Have you any idea which file this statement might be in? Cheers, Mark. Hi Mark, i cant see any code in the opc that will stop it is there no tep_session registered or customer_id in that contriubtion ? Steve Quote Link to comment Share on other sites More sharing options...
steve_s Posted December 7, 2010 Share Posted December 7, 2010 Thanks for great contrib :thumbsup: need help to install this contrib for osc 2.3.1 a few posts up at the top sportstolen Posted 27 November 2010 - 12:06 PM I tried to install this on a fresh V2.3.1 and it runs smoothly. you will have to remove the require of column_left and header and footer, and add require template_top and bottom instead. Just in case anybody wonder. Steve Quote Link to comment Share on other sites More sharing options...
steve_s Posted December 7, 2010 Share Posted December 7, 2010 Hi Steve, I have OPC all installed and working great! Paypal express is the only payment module I have at the moment, but it seems that when I pay with paypal express, after I confirm and then it redirects me to checkout.php?action=process_confirm, checkout_process.php ends up being a blank page. It's weird but the payment goes through, also when I hit the back button from the blank page, my contents from my purchase are still in my shopping cart... Any help would be appreciated! here are the errors I get from the "blank page" (checkout_process.php) Notice: Undefined index: shipping_tax_total in /includes/classes/order.php on line 235 Notice: Undefined variable: tax_address in /includes/classes/discount_coupon.php on line 304 Notice: Undefined variable: tax_address in /includes/classes/discount_coupon.php on line 304 Notice: Undefined index: categories in /includes/classes/discount_coupon.php on line 201 Notice: Undefined index: products in /includes/classes/discount_coupon.php on line 231 Notice: Undefined index: manufacturers in /includes/classes/discount_coupon.php on line 253 Notice: Undefined index: error in /includes/classes/discount_coupon.php on line 461 Notice: Undefined index: error in /includes/classes/discount_coupon.php on line 461 Warning: Cannot modify header information - headers already sent by (output started at /includes/classes/order.php:235) in /includes/functions/general.php on line 33 hi send it to go to checkout_process.php that should fix it Steve Quote Link to comment Share on other sites More sharing options...
steve_s Posted December 7, 2010 Share Posted December 7, 2010 Hi Is there any way to add a box that shows the billing and shipping address, before checkout is confirmed. (like the one that shows when an account is made) We have had a few orders where the customer has pressed the continue button to go to payment, and the delivery address has been wrong, or the information has been lost. Thanks Ron Hi Ron, admin>configuration>one page checkout set Auto-show billing/shipping modules to true see if that works Steve Quote Link to comment Share on other sites More sharing options...
steve_s Posted December 7, 2010 Share Posted December 7, 2010 another question... can someone tell me how to prevent the order button being clicked multiple times. I understand that there is javascript to prevent this - but can't figure out how to implement it on checkout.php can anyone help ? hi as this post says cannuck1964, on 10 September 2007 - 01:06 PM, said: here is some javascript code to stop people from hitting submit twice, while it only works if javascript is enabled, a text announcement in large bold letters: Please click submit only once will also help for those who do not have javascript enabled. For the header tag area (place anywhere before the </head> in checkout.php <script> /* systemsmanager begin - no double submit */ var form = ""; var submitted = false; var error = false; var error_message = ""; var formerrormsg="You\'ve attempted to submit the form multiple times.\n Please reload page if you need to resubmit form." function checksubmit(submitbtn){ submitbtn.form.submit() checksubmit=blocksubmit return false } function blocksubmit(){ if (typeof formerrormsg!="undefined") alert(formerrormsg) return false } /* systemsmanager end - no double submit */ </script> Then the confirm order button: change the confim button code in checkout.php to below /* systemsmanager begin - no double submit */ echo tep_image_submit('button_confirm_order.gif', IMAGE_BUTTON_CONFIRM_ORDER, 'onClick="return checksubmit(this)"') . '</form>' . "\n"; /* systemsmanager end - no double submit */ cheers and HTH Peter M Steve Quote Link to comment Share on other sites More sharing options...
Guest Posted December 7, 2010 Share Posted December 7, 2010 Hi Mark, i cant see any code in the opc that will stop it is there no tep_session registered or customer_id in that contriubtion ? Steve Hello Steve, Yeah I've been looking for those kind of statements in checkout.php, includes/classes/onepage_checkout.php and includes/classes/discount_coupon.php. There are various tep_session registered and customer_id in all those files and also code relating to KGT. I've tried commenting them out but this hasn't worked. Have you any idea how would I alter tep_session registered or customer_id to make this work? Or is it just a case of commenting them out? eg. here is some code from onepage_checkout.php which I thought might be the piece of code to change... //BOF KGT if(MODULE_ORDER_TOTAL_DISCOUNT_COUPON_STATUS=='true') { //kgt - discount coupons if (tep_not_null($onepage['info']['coupon'])) { //this needs to be set before the order object is created, but we must process it after $order->info['coupon'] = $onepage['info']['coupon']; if (!tep_session_is_registered('coupon')) tep_session_register('coupon'); //$order->info['applied_discount'] = $onepage['info']['applied_discount']; //$order->info['subtotal'] = $onepage['info']['subtotal']; } //end kgt - discount coupons } //EOF KGT Cheers, Mark. Quote Link to comment Share on other sites More sharing options...
steve_s Posted December 8, 2010 Share Posted December 8, 2010 (edited) Hello Steve, Yeah I've been looking for those kind of statements in checkout.php, includes/classes/onepage_checkout.php and includes/classes/discount_coupon.php. There are various tep_session registered and customer_id in all those files and also code relating to KGT. I've tried commenting them out but this hasn't worked. Have you any idea how would I alter tep_session registered or customer_id to make this work? Or is it just a case of commenting them out? eg. here is some code from onepage_checkout.php which I thought might be the piece of code to change... //BOF KGT if(MODULE_ORDER_TOTAL_DISCOUNT_COUPON_STATUS=='true') { //kgt - discount coupons if (tep_not_null($onepage['info']['coupon'])) { //this needs to be set before the order object is created, but we must process it after $order->info['coupon'] = $onepage['info']['coupon']; if (!tep_session_is_registered('coupon')) tep_session_register('coupon'); //$order->info['applied_discount'] = $onepage['info']['applied_discount']; //$order->info['subtotal'] = $onepage['info']['subtotal']; } //end kgt - discount coupons } //EOF KGT Cheers, Mark. Hi Mark try includes/classes/order.php this is only saying if the coupon hasnt been entered before, register it if (!tep_session_is_registered('coupon')) tep_session_register('coupon'); Steve Edited December 8, 2010 by steve_s Quote Link to comment Share on other sites More sharing options...
Guest Posted December 8, 2010 Share Posted December 8, 2010 Hi Mark try includes/classes/order.php this is only saying if the coupon hasnt been entered before, register it if (!tep_session_is_registered('coupon')) tep_session_register('coupon'); Steve Hello Steve, Yes think this is it... //kgt - discount coupons global $coupon; if( tep_session_is_registered( 'coupon' ) && tep_not_null( $coupon ) ) { require_once( DIR_WS_CLASSES.'discount_coupon.php' ); $this->coupon = new discount_coupon( $coupon, $this->delivery ); $this->coupon->total_valid_products( $products ); $valid_products_count = 0; } //end kgt - discount coupons I tried commenting out this line; if( tep_session_is_registered( 'coupon' ) && tep_not_null( $coupon ) ) { but then got a parse error. Can you give me a clue what I need to change here? Thanks again, Mark. Quote Link to comment Share on other sites More sharing options...
minipassat Posted December 9, 2010 Share Posted December 9, 2010 Hello, Does anyone know how to add javascript validation for the coupon code if the coupon code is correct? same like a small green check mark next to the coupon code text field? Currently the coupon code is working, but looks like it might not clear to customers if the coupon code they entered is valid or not if they didn't pay attention to the calculation. Therefore is it possible to add the green checkmark icon like the one for the name and address fields? Thank you very much!! Quote Link to comment Share on other sites More sharing options...
fernyburn Posted December 9, 2010 Share Posted December 9, 2010 Many thanks got the code working eventually ( i think) - the code on checkout.php is different so its ... For the header tag area (place anywhere before the </head> in checkout.php <script>/* systemsmanager begin - no double submit */ var form = ""; var submitted = false; var error = false; var error_message = ""; var formerrormsg="You\'ve attempted to submit the form multiple times.\n Please reload page if you need to resubmit form." function checksubmit(submitbtn){ submitbtn.form.submit() checksubmit=blocksubmit return false } function blocksubmit(){ if (typeof formerrormsg!="undefined") alert(formerrormsg) return false } /* systemsmanager end - no double submit */ </script> Then the confirm order button: should be <td class="main" align="right"><?php if(ONEPAGE_CHECKOUT_LOADER_POPUP == 'False'){ ?><div id="ajaxMessages" style="display:none;"></div><?php } ?><div id="checkoutButtonContainer"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE, 'onClick="return checksubmit(this)"' .'id="checkoutButton" formUrl="' . tep_href_link(FILENAME_CHECKOUT_PROCESS, '', $request_type) . '"'); ?><input type="hidden" name="formUrl" id="formUrl" value=""></div><div id="paymentHiddenFields" style="display:none;"></div></td> Quote Link to comment Share on other sites More sharing options...
fernyburn Posted December 9, 2010 Share Posted December 9, 2010 Hi Ron, admin>configuration>one page checkout set Auto-show billing/shipping modules to true see if that works Steve Already tried that - don't know what it does, as it doesn't show anything different any other suggestions ..... all that is needed is a box at the very bottom of the page showing the shipping, and billing addresses so that any errors can be fixed before the final 'GO' Ron Quote Link to comment Share on other sites More sharing options...
Guest Posted December 9, 2010 Share Posted December 9, 2010 Hello Steve, Yes think this is it... //kgt - discount coupons global $coupon; if( tep_session_is_registered( 'coupon' ) && tep_not_null( $coupon ) ) { require_once( DIR_WS_CLASSES.'discount_coupon.php' ); $this->coupon = new discount_coupon( $coupon, $this->delivery ); $this->coupon->total_valid_products( $products ); $valid_products_count = 0; } //end kgt - discount coupons I tried commenting out this line; if( tep_session_is_registered( 'coupon' ) && tep_not_null( $coupon ) ) { but then got a parse error. Can you give me a clue what I need to change here? Thanks again, Mark. Hello Steve, Sorry, reading your last post again I realise that isn't it. Could it be this though?... //BOF KGT }else { if(MODULE_ORDER_TOTAL_DISCOUNT_COUPON_STATUS=='true') { global $customer_id, $order; $check_code_query = tep_db_query( $sql = "SELECT dc.* FROM " . TABLE_DISCOUNT_COUPONS . " dc WHERE coupons_id = '".tep_db_input( $code )."' AND ( coupons_date_start <= CURDATE() OR coupons_date_start IS NULL ) AND ( coupons_date_end >= CURDATE() OR coupons_date_end IS NULL )" ); if( tep_db_num_rows( $check_code_query ) != 1 ) { //if no rows are returned, then they haven't entered a valid code $message = ENTRY_DISCOUNT_COUPON_ERROR ; //display the error message return '{ success: false }'; } else { if(tep_session_is_registered('customer_id') && (int)$customer_id>0) { //customer_exclusions $check_user_query = tep_db_query( $sql = 'SELECT dc2u.customers_id FROM '.TABLE_DISCOUNT_COUPONS_TO_CUSTOMERS.' dc2u WHERE customers_id='.(int)$customer_id.' AND coupons_id="'.tep_db_input( $code ).'"' ); if( tep_db_num_rows( $check_user_query ) > 0 ) { $message = ENTRY_DISCOUNT_COUPON_ERROR ; //display the error message //use this to debug exclusions: //$this->message( 'Customer exclusion check failed' ); return '{ success: false }'; } } //shipping zone exclusions $delivery = $order->delivery; $check_user_query = tep_db_query($sql = 'SELECT dc2z.geo_zone_id FROM '.TABLE_DISCOUNT_COUPONS_TO_ZONES.' dc2z LEFT JOIN '.TABLE_ZONES_TO_GEO_ZONES.' z2g USING( geo_zone_id ) WHERE ( z2g.zone_id='.(int)$delivery['zone_id'].' or z2g.zone_id = 0 or z2g.zone_id IS NULL ) AND ( z2g.zone_country_id='.(int)$delivery['country_id'].' or z2g.zone_country_id = 0 ) AND dc2z.coupons_id="'.tep_db_input( $code ).'"' ); if (tep_db_num_rows( $check_user_query ) > 0 ) { $message = ENTRY_DISCOUNT_COUPON_ERROR ; //display the error message //use this to debug exclusions: //$this->message( 'Shipping Zones exclusion check failed' ); return '{ success: false }'; } //end shipping zone exclusions $row = tep_db_fetch_array( $check_code_query ); //since there is one record, we have a valid code $order->coupon = $row; return '{ success: true }'; } } } //EOF KGT Cheers, Mark. Quote Link to comment Share on other sites More sharing options...
farbor Posted December 9, 2010 Share Posted December 9, 2010 Hi Steve, First of all let me thank you for the quick reply. I really appreciated. I have now completely sorted the coupon issue. Reading through the entire thread, I have notice that someone managed to implement craftyclicks with OPC in order to lookup post code. Unfortunately he has never shared the details. Can you point me out where should I look to add that functionality in OPC? Again thanks in advance Kind Regards JK Hi try includes/classes/onepage_checkout.php //BOF KGT if(MODULE_ORDER_TOTAL_DISCOUNT_COUPON_STATUS=='true') { //kgt - discount coupons if (tep_not_null($onepage['info']['coupon'])) { //this needs to be set before the order object is created, but we must process it after $order->info['coupon'] = $onepage['info']['coupon']; if (!tep_session_is_registered('coupon')) tep_session_register('coupon'); //$order->info['applied_discount'] = $onepage['info']['applied_discount']; //$order->info['subtotal'] = $onepage['info']['subtotal']; } //end kgt - discount coupons } //EOF KGT Steve Quote Link to comment Share on other sites More sharing options...
m3ndi3 Posted December 10, 2010 Share Posted December 10, 2010 hi send it to go to checkout_process.php that should fix it Steve I'm sorry... where do I change it to send to checkout_process.php? would it be under the "checkout.php"-"onePage.pageLinks = { checkout: '<?php echo fixSeoLink(tep_href_link(FILENAME_CHECKOUT, session_name() . '=' . session_id() . '&rType=ajax', $request_type));?>'," ? Or do I change something in the includes/modules/payment/paypal_express.php? or ext/modules/payment/paypal/express.php? Thanks so much! Quote Link to comment Share on other sites More sharing options...
steve_s Posted December 11, 2010 Share Posted December 11, 2010 (edited) I'm sorry... where do I change it to send to checkout_process.php? would it be under the "checkout.php"-"onePage.pageLinks = { checkout: '<?php echo fixSeoLink(tep_href_link(FILENAME_CHECKOUT, session_name() . '=' . session_id() . '&rType=ajax', $request_type));?>'," ? Or do I change something in the includes/modules/payment/paypal_express.php? or ext/modules/payment/paypal/express.php? Thanks so much! Hi i dont use paypal express is there no setting in admin>modules>payment>paypal express to set return link ?, see if its hard coded in either includes/modules/payment/paypal_express.php? or ext/modules/payment/paypal/express.php? or should return link be ext/modules/payment/paypal/express.php play around a bit Steve Edited December 11, 2010 by steve_s Quote Link to comment Share on other sites More sharing options...
allaboutwicker Posted December 11, 2010 Share Posted December 11, 2010 Hi i dont use paypal express is there no setting in admin>modules>payment>paypal express to set return link ?, see if its hard coded in either includes/modules/payment/paypal_express.php? or ext/modules/payment/paypal/express.php? or should return link be ext/modules/payment/paypal/express.php play around a bit Steve Hi, I do not use the Paypal Express checkout, but a different Paypal. However, it may work in a similar manner. It has been quite a while, but I remember that I had to go into my actual Paypal account and there is somewhere in there, preferences perhaps, where you assign what webpage the cutstomer is to be sent to after Paypal processing. I am just working on implementing this OPC so still have mine set to checkout_success.php, but it may need to be changed to something else for this contribution. Hope that helps, Leslie Quote 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.