Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Discount Coupon Codes


kgt

Recommended Posts

Hiya.

 

i have just installed the discount Coupon codes and it's working fine.... execpt 1 problem!!!

 

all my items are showing up as £0.00 after the discount is applied!!

 

This is what I am seeing in the Store side (if I place an order my self) - The item i am using as a test product is priced at £200.00

 

Any ideas what is up?

 

Discount Coupon 10% off applied: -£20.00

Sub-Total: £180.00

Flat Rate (Best Way): £5.00

Total: £0.00

Link to comment
Share on other sites

Are you using a template system? Sometimes this can make a difference in whether or not the error is displayed. Is the error message showing up in your URL field?

 

If it is in your URL field, and you are using a template system, try this:

 

OPEN checkout_payment.php

 

FIND around line 148:

 

<?php
 if (isset($HTTP_GET_VARS['payment_error']) && is_object(${$HTTP_GET_VARS['payment_error']}) && ($error = ${$HTTP_GET_VARS['payment_error']}->get_error())) {
?>
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
	  <tr>
		<td class="main"><b><?php echo tep_output_string_protected($error['title']); ?></b></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBoxNotice">
	  <tr class="infoBoxNoticeContents">
		<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr>
			<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			<td class="main" width="100%" valign="top"><?php echo tep_output_string_protected($error['error']); ?></td>
			<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
 }
?>

 

ADD this code before:

 

<?php
 if (isset($HTTP_GET_VARS['error_message']) && tep_not_null($HTTP_GET_VARS['error_message'])) {
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
 <tr class="headerError">
<td class="headerError"><?php echo htmlspecialchars(urldecode($HTTP_GET_VARS['error_message'])); ?></td>
 </tr>
</table>
<?php
 }
?>

 

I apologize if this has already been addressed. I skimmed through 100+ pages and may have missed something.

 

Initially, I thought the coupon was working OK since I did a test order. I have it set to take $10 off an order of $25 or more. However, I found out that it was giving the discount to anyone who used the coupon, no matter what their order total. I fixed that by changing the admin settings. I had it displaying the subtotal with discount applied. When I changed that, it no longer could be used for orders under $25. But if someone still puts in the coupon code when their order is below $25 it just takes them back to the same page where the coupon code is entered. There is no error message telling them they can't use the coupon.

 

I realize customers shouldn't be entering the coupon code if their order doesn't qualify, but I found out about the problem when a customer placed a $20 order and was given the $10 off. Is there a way to have an error show if they try to do this? Like...'Hey, you doofus...you can't use the coupon!' Just kidding on that one.

~Tracy
 

Link to comment
Share on other sites

Hi there,

 

Since a few days i'm getting the following error in my checkout_confirmation.php

 

Fatal error: Using $this when not in object context in /var/www/vhosts/beauty7.be/httpdocs/includes/classes/discount_coupon.php on line 165

 

I would really appreciate any help. The weird thing is that it just happened, I didn't change anything or didn't install anything else you know.

Link to comment
Share on other sites

This add-on is working great, except for one thing. It puts the Discount Code info on the same line as the Tax info in the email that is sent to customer after a successful order.

 

++++++++++++++++

 

Products

------------------------------------------------------

1 x Scout Mount () = $34.95

Model SM-E

------------------------------------------------------

Flat Rate (Best Way): $6.95

Discount Coupon MIL/LE01 applied: -$6.95 AZ TAX 8.3%: $2.90

Total: $37.85

 

++++++++++++++++

 

I've seen this issue brought up before, but have yet to see a definitive answer. Can someone please help with this?

 

Thanks!

Link to comment
Share on other sites

Oops! Just realized adding the fix messed up my table layout. My right column is now at the bottom of the page. In case this happens to anyone else, I had to add <tr><td> before the new code and </td></tr> after the code to put it in a row.

 

 

 

 

Are you using a template system? Sometimes this can make a difference in whether or not the error is displayed. Is the error message showing up in your URL field?

 

If it is in your URL field, and you are using a template system, try this:

 

OPEN checkout_payment.php

 

FIND around line 148:

 

<?php
 if (isset($HTTP_GET_VARS['payment_error']) && is_object(${$HTTP_GET_VARS['payment_error']}) && ($error = ${$HTTP_GET_VARS['payment_error']}->get_error())) {
?>
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
	  <tr>
		<td class="main"><b><?php echo tep_output_string_protected($error['title']); ?></b></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBoxNotice">
	  <tr class="infoBoxNoticeContents">
		<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr>
			<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			<td class="main" width="100%" valign="top"><?php echo tep_output_string_protected($error['error']); ?></td>
			<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
 }
?>

 

ADD this code before:

 

<?php
 if (isset($HTTP_GET_VARS['error_message']) && tep_not_null($HTTP_GET_VARS['error_message'])) {
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
 <tr class="headerError">
<td class="headerError"><?php echo htmlspecialchars(urldecode($HTTP_GET_VARS['error_message'])); ?></td>
 </tr>
</table>
<?php
 }
?>

Link to comment
Share on other sites

Help me please,

 

Since a few days i'm getting the following error in my checkout_confirmation.php

 

Fatal error: Using $this when not in object context in /var/www/vhosts/beauty7.be/httpdocs/includes/classes/discount_coupon.php on line 165

 

I would really appreciate any help. The weird thing is that it just happened, I didn't change anything or didn't install anything else you know.

Link to comment
Share on other sites

I've got a problem.

I can't see the discount at all on checkout_confirmation.php and I get no error message.

There is no discount made on the totals.

 

I've edited the file just the way that is explained.

 

Got any good tip for me?

 

Best Regards,

H

Link to comment
Share on other sites

Hello to all

 

Installed it 8 hours ago, but till now i have this funny problem: admin section works fine, checkout_payement.php show the the input where to enter the code. Wrong codes are rejected and wrong codes are bringing me forward to checkout_confirmation.php. but now my problem: i didn't see any discount. so i spent some hours reading posts here and couldn't findy any answers.

I've analyzed some files with winmerge and found some logig differences. BUT! here i go in checkout_confirmation.php i found this line:

if(!isset($HTTP_GET_VARS['isingetmod'])) {tep_redirect(tep_href_link(FILENAME_CHECKOUT_CONFIRMATION, 'isingetmod=1', 'SSL'));}

before

 

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_CONFIRMATION);

 

around 107. Well i deleted it and ..... now i get the discount displayet. Do you maybe have a logical explanation, why this line was the reason of my problem?

 

greetings

 

:)

Link to comment
Share on other sites

Hello to all

 

Installed it 8 hours ago, but till now i have this funny problem: admin section works fine, checkout_payement.php show the the input where to enter the code. Wrong codes are rejected and wrong codes are bringing me forward to checkout_confirmation.php. but now my problem: i didn't see any discount. so i spent some hours reading posts here and couldn't findy any answers.

I've analyzed some files with winmerge and found some logig differences. BUT! here i go in checkout_confirmation.php i found this line:

if(!isset($HTTP_GET_VARS['isingetmod'])) {tep_redirect(tep_href_link(FILENAME_CHECKOUT_CONFIRMATION, 'isingetmod=1', 'SSL'));}

before

 

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_CONFIRMATION);

 

around 107. Well i deleted it and ..... now i get the discount displayet. Do you maybe have a logical explanation, why this line was the reason of my problem?

 

greetings

 

:)

 

Hello,

 

I just find out i was a part of a payment modul that line.

 

 

Now a new bug / question: on the checkout_confirmation.php page, if i change language the discount disappears. Any help?

 

 

thanks a lot

Link to comment
Share on other sites

Hey guys,

 

I've only just installed this module after lots of trouble trying to find admin/includes/function/coupon.php befgore realising you have to install version 3 before 3.3...

 

Anyway problem now is that I can enter duplicate voucher codes despite setting max use to 1 over and over again... So a customer can reuse a voucher unlimited times. Any ideas how to sort this?

 

Cheers

Matt

www.stokedbanana.com

Link to comment
Share on other sites

After this call from "classes\order.php" "$this->info['total']" is not updated:

     //end kgt - discount coupon
           //kgt - discount coupon
     if( is_object( $this->coupon ) ) {
       $this->info['total'] = $this->coupon->finalize_discount( $this->info );
     }
     //end kgt - discount coupon


The above code calls this code in "classes\discount_coupon.php":

       if( $this->coupon['coupons_discount_type'] == 'shipping' ) { //discount shipping if the coupon type is shipping
         $this->applied_discount['shipping'] = $info['shipping_cost'] * $this->coupon['coupons_discount_amount'];
//         $this->applied_discount['shipping'] = $this->applied_discount['shipping'];
         $info['total'] -= $this->applied_discount['shipping'];
         ...	  

 

I've updated our install from v2.1 to the latest version, and while testing the shipping discount feature I encountered a problem. When the "finalize_discount" method is called "$this->info['total']" is not updated.

 

When I turn on debugging, and modify it so that I can see the result of this statement in "classes\discount_coupon.php":

 

$info['total'] -= $this->applied_discount['shipping'];

 

"$info['total']" it is not updated ("$this->applied_discount['shipping']" is computed correctly).

 

The results on "checkout_confirmation.php" are:

 

Coupon xyz for 50% off shipping applied: -$5.50

Sub-Total: $89.90

DHL or USPS Priority Mail (Ground Shipping): $11.00

CO TAX 4.1%: $3.69

Total: $104.59

 

You can see that the -$5.50 discount has not been applied to "Total:"

 

All of the computations are being done correctly, but, for some strange reason, the "$info['total']" variable just won't update.

Link to comment
Share on other sites

Hiya. I have just installed Discount Coupon codes, but when i add a product to my cart, then checkout, i get the following error!

 

Any ideas how to fix it?

 

Thanks,

 

Andy

 

1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'or z2g.zone_id = 0 or z2g.zone_id IS NULL )

 

SELECT dc2z.geo_zone_id FROM discount_coupons_to_zones dc2z LEFT JOIN zones_to_geo_zones z2g USING( geo_zone_id ) WHERE ( z2g.zone_id= or z2g.zone_id = 0 or z2g.zone_id IS NULL ) AND ( z2g.zone_country_id= or z2g.zone_country_id = 0 ) AND dc2z.coupons_id="10% Off"

 

[TEP STOP]

Link to comment
Share on other sites

I've got a problem.

I can't see the discount at all on checkout_confirmation.php and I get no error message.

There is no discount made on the totals.

 

I've edited the file just the way that is explained.

 

Got any good tip for me?

 

Best Regards,

H

 

I was having the same problem then I found this solution. It worked for me :-)

 

Try adding this code:

 

if (!tep_session_is_registered('coupon')) tep_session_register('coupon');
 if (tep_not_null($HTTP_POST_VARS['coupon'])) {
$coupon = tep_db_prepare_input($HTTP_POST_VARS['coupon']);
 }

 

 

BEFORE these lines:

require(DIR_WS_CLASSES . 'order.php');
 $order = new order;

Link to comment
Share on other sites

Hi, I need some help too.

 

1) Apparently, when customers purchase and wish to select preferred payment method (checkout_shipping.php), the page still remain the same.

 

2)I have downloaded coupon code. But how do I configure to able only certain amt of purchase then it can be used? I was told "A very simple way to do this would be to only show the input box if the cart_total is greater than 150". But I am clueless on how to access which path to search to amend the cart total.

 

I need it for eg: $150 above your entitled to 40% discount

and $400 above entitled to 50% discount.

 

Please help. Thank you very much for your time.

Link to comment
Share on other sites

Hi

 

I've installed and all is OK testing locally but just wondered if it possible to combine a discount off products AND a discount off shipping. In effect 1 discount code gives say, 25% discount off both the product AND overseas shipping.

 

I can only find a way of doing it with 2 discount codes. Obviously, I can decrease my shipping module prices by 25% then increase them a few days later but just wondering if it can be done.

 

Cheers

 

Ian

Link to comment
Share on other sites

Hi

 

I've installed and all is OK testing locally but just wondered if it possible to combine a discount off products AND a discount off shipping. In effect 1 discount code gives say, 25% discount off both the product AND overseas shipping.

 

I can only find a way of doing it with 2 discount codes. Obviously, I can decrease my shipping module prices by 25% then increase them a few days later but just wondering if it can be done.

 

Cheers

 

Ian

 

Can no one help me??? If I read it correctly, the "retain shipping price" fix would do what I want but I can't get it to work. At least I'm trying to fix on my own while I wait for a reply here. Maybe its a bug like the sub-total bug.

 

Any help would be appreciated

 

Cheers

 

Ian

Link to comment
Share on other sites

Hello,

 

Discount Coupons works great. Is there a way to make it so it will work as a shipping discount if customer orders a certain amount. Example, if I have it set so when a customer orders $150.00 or more, they get a 20% discount on shipping?

 

Thanks JR

Link to comment
Share on other sites

This add-on is working great, except for one thing. It puts the Discount Code info on the same line as the Tax info in the email that is sent to customer after a successful order.

 

++++++++++++++++

 

Products

------------------------------------------------------

1 x Scout Mount () = $34.95

Model SM-E

------------------------------------------------------

Flat Rate (Best Way): $6.95

Discount Coupon MIL/LE01 applied: -$6.95 AZ TAX 8.3%: $2.90

Total: $37.85

 

++++++++++++++++

 

I've seen this issue brought up before, but have yet to see a definitive answer. Can someone please help with this?

 

Thanks!

 

Can anyone be of assistance with this?

Link to comment
Share on other sites

I did a new installation Manually using Ver 3.3

the Tables did not get created automatically so i used the SQL Code provided

 

I set up the Coupon Discount under module->order total and created a new coupon under catalog->discount coupons

 

yet i still get the error

 

1146 - Table 'db231706294.TABLE_DISCOUNT_COUPONS' doesn't exist

 

SELECT dc.* FROM TABLE_DISCOUNT_COUPONS dc WHERE coupons_id = 'C29UZZ' AND ( coupons_date_start <= CURDATE() OR coupons_date_start IS NULL ) AND ( coupons_date_end >= CURDATE() OR coupons_date_end IS NULL )

 

[TEP STOP]

 

 

HELP!!!!!

Link to comment
Share on other sites

I did a new installation Manually using Ver 3.3

the Tables did not get created automatically so i used the SQL Code provided

 

I set up the Coupon Discount under module->order total and created a new coupon under catalog->discount coupons

 

yet i still get the error

 

1146 - Table 'db231706294.TABLE_DISCOUNT_COUPONS' doesn't exist

 

SELECT dc.* FROM TABLE_DISCOUNT_COUPONS dc WHERE coupons_id = 'C29UZZ' AND ( coupons_date_start <= CURDATE() OR coupons_date_start IS NULL ) AND ( coupons_date_end >= CURDATE() OR coupons_date_end IS NULL )

 

[TEP STOP]

 

 

HELP!!!!!

 

 

 

 

Never Mind - I missed uploading \catalog\includes\database_tables.php file - my bad!!

Link to comment
Share on other sites

Intalled Contribution maually, v 3.3...now my admin is not displaying correctly with the following error at top.

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /home/xxxxxxxxx/public_html/catalog/admin/includes/boxes/catalog.php on line 31

 

here is the code from catalog.php

 

<!-- catalog //-->
         <tr>
           <td>
<?php
 $heading = array();
 $contents = array();

 $heading[] = array('text'  => BOX_HEADING_CATALOG,
                    'link'  => tep_href_link(FILENAME_CATEGORIES, 'selected_box=catalog'));

 if ($selected_box == 'catalog') {
   $contents[] = array('text'  => '<a href="' . tep_href_link(FILENAME_CATEGORIES, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_CATEGORIES_PRODUCTS . '</a><br>' .
                                  '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_CATEGORIES_PRODUCTS_ATTRIBUTES . '</a><br>' .
                                  '<a href="' . tep_href_link(FILENAME_MANUFACTURERS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_MANUFACTURERS . '</a><br>' .
                                  '<a href="' . tep_href_link(FILENAME_REVIEWS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_REVIEWS . '</a><br>' .
                                  '<a href="' . tep_href_link(FILENAME_SPECIALS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_SPECIALS . '</a><br>' .
                                  //kgt - discount coupons
                                  '<a href="' . tep_href_link(FILENAME_PRODUCTS_EXPECTED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_PRODUCTS_EXPECTED . '</a><br>'
                                  '<a href="' . tep_href_link(FILENAME_DISCOUNT_COUPONS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_DISCOUNT_COUPONS . '</a>' );
                                  /***************
                                  '<a href="' . tep_href_link(FILENAME_PRODUCTS_EXPECTED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_PRODUCTS_EXPECTED . '</a>' );
                                  ***************/
                                  //end kgt - discount coupons   }

 $box = new box;
 echo $box->menuBox($heading, $contents);
?>
           </td>
         </tr>
<!-- catalog_eof //-->

 

Please help. Any help is greatly appreciated!! 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...