Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Discount Coupon Codes


kgt

Recommended Posts

Hello everybody,

I tryed to install "vouchers-discount add" few times already and with different types("Discount code", "Discount coupon codes"). I tryed install manually and last time -auto with "Autoinstaller 2.14 for Diacount coupon codes 3.32" and always I get the same problems:

1. I can't modify catalog/checkout_payment.php , because I haven't got this line:

<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><?php echo tep_draw_textarea_field('comments', 'soft', '60', '5'); ?></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

 

2.After installation (manual or auto), when I browse my website I can see just line:

Parse error:syntax error,unexpected T_STRING in /home/user/public_html/includes/database_tables.php on line 64

 

Please help me to fix it.

My site is http://www.beflame.co.uk

Many thanks!

Link to comment
Share on other sites

  • 2 weeks later...
  • 4 weeks later...

I have probably missed something obvious but:

 

I have manually installed the contribution and when testing it I git this error and cant figure it out:

 

Parse error: syntax error, unexpected '<' in /home/XXX/XXX/checkout_payment.php on line 285

 

I would love to get this sorted any ideas, code below,

 


<h2><?php echo TABLE_HEADING_COMMENTS; ?></h2>

 <div class="contentText">
   <?php echo tep_draw_textarea_field('comments', 'soft', '60', '5', $comments); ?>
 </div>
<?php

/* kgt - discount coupons */
if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_STATUS == 'true' ) {
?>
<h2><?php echo TABLE_HEADING_COUPON; ?></h2>

 <div class="contentText">
 	 </div>

       <div class="contentText">
       <?php echo ENTRY_DISCOUNT_COUPON.' '.tep_draw_input_field('coupon', '', 'size="32"', $coupon); ?>
 	 </div>

<?php
}
/* end kgt - discount coupons */ 

   <div style="float: left; width: 60%; padding-top: 5px; padding-left: 15%;">
     <div id="coProgressBar" style="height: 5px;"></div>

 

Line 285 is

 

<div style="float: left; width: 60%; padding-top: 5px; padding-left: 15%;">

Complete Newbie On The Learn - Not A Programmer

But Learning As I Go

Link to comment
Share on other sites

I have probably missed something obvious but:

 

I have manually installed the contribution and when testing it I git this error and cant figure it out:

 

Parse error: syntax error, unexpected '<' in /home/XXX/XXX/checkout_payment.php on line 285

 

I would love to get this sorted any ideas, code below,

 


<h2><?php echo TABLE_HEADING_COMMENTS; ?></h2>

 <div class="contentText">
   <?php echo tep_draw_textarea_field('comments', 'soft', '60', '5', $comments); ?>
 </div>
<?php

/* kgt - discount coupons */
if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_STATUS == 'true' ) {
?>
<h2><?php echo TABLE_HEADING_COUPON; ?></h2>

 <div class="contentText">
 	 </div>

       <div class="contentText">
       <?php echo ENTRY_DISCOUNT_COUPON.' '.tep_draw_input_field('coupon', '', 'size="32"', $coupon); ?>
 	 </div>

<?php
}
/* end kgt - discount coupons */ 

   <div style="float: left; width: 60%; padding-top: 5px; padding-left: 15%;">
     <div id="coProgressBar" style="height: 5px;"></div>

 

Line 285 is

 

<div style="float: left; width: 60%; padding-top: 5px; padding-left: 15%;">

 

ANY 1?

Complete Newbie On The Learn - Not A Programmer

But Learning As I Go

Link to comment
Share on other sites

ANY 1?

Hi, I have a heavily modified code and it has been a long time since I changed it, but if you look at the error it seems to be saying there is an extra "<" somewhere and not another ending ">" somewhere to close it i think. Like I said it has been a long time and I am not very good at this coding stuff, but here is my code I found that I think is comparable to that part in yours and it is way different, but something in there may help you figure out your issue:

 

<?php

/* kgt - discount coupons */

if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_STATUS == 'true' ) {

?>

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td class="main"><b><?php echo TABLE_HEADING_COUPON; ?></b></td>

</tr>

</table></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 class="main"><?php echo ENTRY_DISCOUNT_COUPON.' '.tep_draw_input_field('coupon', '', 'size="32"'); ?></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<?php

}

/* end kgt - discount coupons */

?>

Edited by allaboutwicker
Link to comment
Share on other sites

Change this:

 

<?php 
       } 
/* end kgt - discount coupons */  

To this:

 

<?php 
       } 
/* end kgt - discount coupons */  
?>

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Change this:

 

<?php 
       } 
/* end kgt - discount coupons */  

To this:

 

<?php 
       } 
/* end kgt - discount coupons */  
?>

 

You would think, by now, that would be corrected in the download.

 

Anyway, my problem is that the confirmation page is being skipped. I have read that using PayPal skips it, but I need it since that is where the discount shows up, and skipping it results is the discount not being applied. I want the confirmation page anyway since it provides a summary of the order.

 

This is on my localhost, it works the way I want on my live store, but I don't recall doing anything to change it. Where would I find the code that does this?

Link to comment
Share on other sites

Has anyone managed to fix the discount doubling problem? I got everything else working, but the discount amount is still doubled on the order confirmation page.

Link to comment
Share on other sites

Has anyone managed to fix the discount doubling problem? I got everything else working, but the discount amount is still doubled on the order confirmation page.

 

OK. So that was just a stupid mistake: the "testing001" coupon is for 200% instead of the 100% I thought it was.

 

Now I can't get any new coupons to work. I get the invalid coupon message. I have checked the tables and they are there, but I noticed that on the test coupon the date is "null" but on the new ones it is "0000-00-00 00:00:00" Does this mean it is failing because it expects that date? I didn't touch the date field so why is there anything there at all?

 

Does anyone know how to prevent this?

Link to comment
Share on other sites

Has anyone ever found or produced a fix for the discount passing over using PayPal express? I have been searching for days! So... tired... vision.... blurring....... HELP!

I think the easiest solution is to use PayPal Website Payment Standard ( I think that is what it is called. The one that says "Standard"). I believe it is the same at PayPal's end as Express, but it allows the cart to go to the Order Confirmation where the coupon is applied. It also removes the duplicate checkout button, i.e. the "Checkout with PayPal" button.

Link to comment
Share on other sites

I think the easiest solution is to use PayPal Website Payment Standard ( I think that is what it is called. The one that says "Standard"). I believe it is the same at PayPal's end as Express, but it allows the cart to go to the Order Confirmation where the coupon is applied. It also removes the duplicate checkout button, i.e. the "Checkout with PayPal" button.

 

Hey! Thanks for the quick reply. You know, I had played with this feature and I am enrolled with Paypal Standard payments via my PayPal account, but, I notice that when the billing moves from my website to my PayPal standard page, the itemized products are removed and replaced with only the total cost of my (test) cart and the name of my website, instead of the name of any product.

 

Using PayPal standard, is there a charge for API credentials? I can't seem to figure how this is supposed to be configured from PayPal to my Website. (Public Certificates, etc.) I have spent the last few days trying to resolve this, even dangerously editing code in sensitive module files, all to no success. (I do know to backup! :) )

 

I'm a complete novice at this. I am far better a PHP "manipulator", but, cannot seem to pull raw code from my rear to make anything useful happen.

 

Thanks again for your reply. Any further thoughts are greatly appreciated...

Link to comment
Share on other sites

  • 2 weeks later...

Hi All

 

Can anyone help me to improve the following code I have added to checkout_confirmation?

 

It bypasses the checkout payment page if the order total is $0.00

 

The problem is - it only works with a redirect to checkout_success, which is at least something, but missing out checkout_process also means missing out on the order process (i.e. sending emails, updating the DB etc) - so not very helpful really!

 

if ($order->info['total'] <= 0) {
  $form_action_url = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL');


} else {

if (isset($$payment->form_action_url)) {
   $form_action_url = $$payment->form_action_url;
 } else {



   $form_action_url = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL');
 }

 }

 

I just want to skip the payment modules if the total is $0.00 but not having much luck.

 

Any one have this functionality working?

 

Thanks for suggestions...

Edited by ssnb
Link to comment
Share on other sites

Hey! Thanks for the quick reply. You know, I had played with this feature and I am enrolled with Paypal Standard payments via my PayPal account, but, I notice that when the billing moves from my website to my PayPal standard page, the itemized products are removed and replaced with only the total cost of my (test) cart and the name of my website, instead of the name of any product.

 

Using PayPal standard, is there a charge for API credentials? I can't seem to figure how this is supposed to be configured from PayPal to my Website. (Public Certificates, etc.) I have spent the last few days trying to resolve this, even dangerously editing code in sensitive module files, all to no success. (I do know to backup! :) )

 

I'm a complete novice at this. I am far better a PHP "manipulator", but, cannot seem to pull raw code from my rear to make anything useful happen.

 

Thanks again for your reply. Any further thoughts are greatly appreciated...

I'm no expert on any of this either, but I did happen to talk to PayPal about their modules. You don't need to do anything special for it to work. The API credentials are only needed for some of the other modules. Just the email address you use with the PayPal account is required for Express and Standard, the rest is "filled in" by PayPal when the order is sent to them for processing. The modules that require the APIs don't send the checkout to PayPal, they are handled by PayPal through your site, hence the need for special authentication. I don't think there is a charge for using the API modules, but you do have to contact PayPal to get the codes.

 

The reason no items are listed individually is that osC hands off the payment to PayPal by sending only the required information, i.e. total, tax, shipping, etc. It is handled securely through PayPal. With PayPal Standard you should see the checkout confirmation page with all of the items listed, which gives the customer a chance to make changes.

 

There is a thread about setting up PayPal Standard somewhere if you have questions about that. But basically, you just put in the email address linked to your PayPal account and it works. If you want to use the Sandbox to test, you have to open an account just for that in addition to your regular PayPal account.

 

All of this is just my understanding after a conversation with PayPal about getting APIs before deciding to use Standard.

Link to comment
Share on other sites

Hi All

 

Can anyone help me to improve the following code I have added to checkout_confirmation?

 

It bypasses the checkout payment page if the order total is $0.00

 

The problem is - it only works with a redirect to checkout_success, which is at least something, but missing out checkout_process also means missing out on the order process (i.e. sending emails, updating the DB etc) - so not very helpful really!

 

if ($order->info['total'] <= 0) {
  $form_action_url = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL');


} else {

if (isset($$payment->form_action_url)) {
   $form_action_url = $$payment->form_action_url;
 } else {



   $form_action_url = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL');
 }

 }

 

I just want to skip the payment modules if the total is $0.00 but not having much luck.

 

Any one have this functionality working?

 

Thanks for suggestions...

Have you looked at this contribution?

Link to comment
Share on other sites

Have you looked at this contribution?

 

 

Hi Chemist, thanks for your reply.

 

The contributions suggested is designed to bypass checkout / payment if the value of the item is zero.

unfortunately, it doesn't work with KGT discount coupons when they are 100% discount, because the discount coupon is processed AFTER the free module is looking at cart total.

 

I've been playing around with it for a while to see if I could modify it to get checkout_process.php to recognise a zero cart total and thereby ignore the payment modules (or choose the free one) but not having much luck.

 

In the contribution instructions, it says to bypass the payment page add some code to catalog/checkout_payment.php but that's the same page witht he discount coupons on - so the cart total has not yet been updated to zero...

 

When user has entered their discount coupon code and the hits confirm button, it takes them to the catalog/checkout_confirmation.php page and I am assuming it is here that the payment module check must be made, or on the the following page catalog/checkout_process.php

 

So I am playing around with this but so far, no luck.

 

I was hoping that someone had already worked out a way to make a 100% discount (i.e. zero total) skip the payment checking and directly proceed to checkout_success.php (via checkout_process)

Link to comment
Share on other sites

Updated:

 

I've made significant progress!

 

1) Moved discount coupon code on the checkout_shipping.php page as it makes more sense there (after choose shipping method and before notes)

2) Added free of charge payment method - as trying to bypass the payment page seems impossible

 

It works fine now EXCEPT:

I can't seem to display JUST the free of charge payment method when the order total is zero -

I've tried using the old trick of disabling payment methods if the order total is zero, but this seems to either end up in a browser loop error or tell me to select a payment method!

 

I've discovered that in the DB all the payment modules are listed as sort order 0 - I don't know if this is a bug or an error specific to me, but it seems when you disable 1 payment method, they all go !

 

Will keep trucking on and see how I get on.

 

If anyone wants the code info on what to do to achieve what I have doen, let me know.

Link to comment
Share on other sites

Right well, after a few more beers, I've managed to sort it...

 

I just added in checkout_payment.php - in the upper part of the code, right after the payment classes are declared, a default payment.

 

// load all enabled payment modules
 if ($order->info['total'] <= 0) {
	$payment = 'freeofcharge';
if (!tep_session_is_registered('payment')) tep_session_register('payment');
tep_redirect(tep_href_link(FILENAME_CHECKOUT_CONFIRMATION, '', 'SSL'));
}

 

Took me all day to figure this out, but now I'm happy :-)

 

Let me know if you want the instructions...

Link to comment
Share on other sites

One final thing to work on - how to display a success message once the coupon has been added.... that would be sweet!

 

If anyone already has a method, please share, otherwise I'll look into it.

Link to comment
Share on other sites

One final thing to work on - how to display a success message once the coupon has been added.... that would be sweet!

 

If anyone already has a method, please share, otherwise I'll look into it.

If you get this working well enough you should submit it as a contribution.

 

Is the 'freeofcharge' a payment module you made? I have paid virtually no attention to the payment modules since I use PayPal, but I would think a change to payment_process could redirect to the success page after the 0 total checkout. Essentially you are processing an order that happens to have a total of $0, so if you can make it work the same as any other payment module it should send emails as it would otherwise. Of course, it would have to load the 0 total module only when the total is 0, and not show as an option on the payment page if the total is not 0. Or at least have a provision to handle the inevitable customer choosing that option to avoid paying.

 

I can't see myself ever using this on my current store, but it could be useful for others.

Link to comment
Share on other sites

There seems to be a session issue when using this with version 2.2

 

Coupons are not showing first time. If you refresh checkout_confirmation.php then the discount shows.

 

This is because the coupon code in classes->orders.php does not see the session the first time (I don't know why).

 

My solution was to pre-register the session on the checkout_payment.php page.

 

You only need this if you have the issue above!

 

in checkout_payment.php find:

 


<?php
/* kgt - discount coupons */
if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_STATUS == 'true' ) {
?>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
         <tr>
           <td class="main"><b><?php echo TABLE_HEADING_COUPON; ?></b></td>
         </tr>
       </table></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 class="main"><?php echo ENTRY_DISCOUNT_COUPON.' '.tep_draw_input_field('coupon', '', 'size="32"'); ?></td>
             </tr>
           </table></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
<?php
}
/* end kgt - discount coupons */
?>

 

change to:

 

 

<?php
/* kgt - discount coupons */
if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_STATUS == 'true' ) {
?>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
         <tr>
           <td class="main"><b><?php echo TABLE_HEADING_COUPON; ?></b></td>
         </tr>
       </table></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 class="main"><?php echo ENTRY_DISCOUNT_COUPON.' '.tep_draw_input_field('coupon', '', 'size="32"'); ?></td>
             </tr>
           </table></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
<?php
if (!tep_session_is_registered('coupon')) tep_session_register('coupon'); //fix - session not registering
}
/* end kgt - discount coupons */
?>

 

Regards,

Simon

Link to comment
Share on other sites

Hi can any one help me with this problem??

 

I have added discount coupon module in oscommerce 2.3.1.

and its working well..

 

BUT when i choose cash on delivery method for payment and confirm order i get this..

 

 

1054 - Unknown column 'delivery_date' in 'field list'

 

insert into orders (customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, delivery_date, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, date_purchased, orders_status, currency, currency_value) values ('1', 'fff', '', 'ffffffff', '', 'ffffffff', '1111111', 'ffffffff', 'India', '123456788', '[email protected]', '1', 'fff', '', 'ffffffff', '', 'ffffffff', '1111111', 'ffffffff', 'India', '1', '', 'francis babu', '', 'ffffffff', '', 'ffffffff', '1111111', 'ffffffff', 'India', '1', 'Cash on Delivery', '', '', '', '', now(), '1', 'USD', '1.00000000')

 

[TEP STOP]

Link to comment
Share on other sites

Hello.

 

First, thanks for this contribution, is wonderful...

 

I have used it in the past, now I need it for the version 2.3, but the total amount, after applied the coupon, is $0

 

Anyone can help me?

 

Thanks.

Link to comment
Share on other sites

HII ALL

 

Im looking to add large number of discount codes such a 5000. Should be able to use only once per order.

I managed to fill up discount_coupons table using CSV using LOAD DATA function. As i need to apply these codes only for 1 product i have to exclude all other products from list.

 

Once you excluded product from list "discount_coupons_to_products" table automatically fills with excluded product IDs along with Discount Coupon Code. My problem is how its possible to do this for large number coupon codes such a 5000. I have around 530 Products on my website. I have to exclude 529 products for each discount code of 5000. If anyone has idea how to do this please help me to fix my problem.

 

Thank you

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...