Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Discount Coupon Codes


kgt

Recommended Posts

I would love to help you, but I don't know how to fix this and I've not had any errors that I'm aware of with this. You could PM me with your email address and what files you would like to compare, then I can email you my version of those files and you can see if there is a difference :huh:

 

hi

 

I have just applied the discount coupon add-on to another of my websites and have found that the max_use field wasn't working

 

In my example I have the following:

 

discountss.gif

 

I have changed the min order but regardless of the values it always reads:

 

discss2.gif

 

I have read max-value and min-order being an issue together from older posts/versions but how can I resolve this issue? I downloaded the latest english version from 21 march 09. Please help.

~Tracy
 

Link to comment
Share on other sites

Has no one else here got this problem where the debug mode is enabled even if it is set to OFF in the admin panel??

 

Im having major problems with it throwing page layouts out and I havent yet managed to shut it down!

Even though Ive deleted a lot of the debug code from the mod while testing out a fix... :(

 

Please help!!!!

 

Where is this value set?? I cant find it

Link to comment
Share on other sites

Hmmm- I've not had this particular issue, but I have had cases where an uninstall and reinstall of a contribution has caused duplicate rows in the configuration database tables.

 

You might take a look at your database (phpMyAdmin makes it pretty easy) and look at the configuration table, searching for this configuration_key: MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DEBUG (tip: you can sort by configuration_key column by clicking the words if you are in phpMyAdmin, then you can just scroll down to the M's and find the row you need - makes it easier to see if there are duplicate rows as well). Double check that the configuration_value for this row says "false" (no quotes though).

 

If you have duplicate entries for the MODULE_ORDER_TOTAL_DISCOUNT_COUPON****** configuration_keys, I would delete one and keep one and then retry using your Admin panel to change the settings. If that doesn't work - unfortunately, you have to go through a complete uninstall and verify that everything was deleted that should have been in the database.

 

If you do only have one entry for the MODULE_ORDER_TOTAL_DISCOUNT_COUPON**** configuration_keys, then the problem is going to be in the PHP that communicates with the database, in this case I believe it is the admin/modules.php file that you would need to check.

 

Hope that helps.

 

Has no one else here got this problem where the debug mode is enabled even if it is set to OFF in the admin panel??

 

Im having major problems with it throwing page layouts out and I havent yet managed to shut it down!

Even though Ive deleted a lot of the debug code from the mod while testing out a fix... :(

 

Please help!!!!

 

Where is this value set?? I cant find it

~Tracy
 

Link to comment
Share on other sites

I have found a nice bug in ot_discount_coupon_codes_3_33 (21 Mar 2009).

 

This is what's happening. In the table discount_coupons_to_customers, all customers are stored that are NOT allowed to use the coupon. So to determine who are allowed, a complete list of customers is retrieved from the database (table customers), and subtracted with the customers who aren’t allowed to use the coupon. Remaining, customers who are allowed. But if the total customer list is growing, the list of people who are not allowed should also grow. This is not happening, so all new customers are added to the allowed list.

 

I guess this is not a problem, because new customers don’t know the coupon code, and if the coupon is max used, it will be disabled. But, here is the catch: if a coupon can be used more then once, a “smart” customer can create a new account and use the coupon again.

 

The watertight solution: If a new account is created, add it’s customers_id to every coupon_id in the table discount_coupons_to_customers. I have tried it and it looks like this covers it all.

Link to comment
Share on other sites

Has no one else here got this problem where the debug mode is enabled even if it is set to OFF in the admin panel??

 

Im having major problems with it throwing page layouts out and I havent yet managed to shut it down!

Even though Ive deleted a lot of the debug code from the mod while testing out a fix... :(

 

Please help!!!!

 

Where is this value set?? I cant find it

 

Thanks for the input Tracy :)

 

I have checked and their is only one key for the debug setting in the DB :(

and it is set to false!!!

 

I have had a look in the admin/modules.php file but cant find anything related to the discount coupons mod or the debug code :(

 

Has anyone else got an idea for a fix?

 

One user posted that they had closed an 'unclosed' <td> above the debug code and this had fixed the problem, however I cant find the culprit for this open tag anywhere.. I have highlighted it in the quote below.

 

I have checked the source in the files for the actual page (in this case admin/orders.php) and it seems to be correct??!!!

 

Any ideas?!

 

<td class="dataTableContent" valign="top">gaming pc</td>

<td class="dataTableContent" align="right" valign="top">15%</td>

<td class="dataTableContent" align="right" valign="top"><b>£4995</b></td>

<td class="dataTableContent" align="right" valign="top"><b>£5744</b></td>

<td class="dataTableContent" align="right" valign="top"><b>£4995</b></td>

<td class="dataTableContent" align="right" valign="top"><b>£5744</b></td>

</tr>

<tr>

 

<tr>

<td align="right" class="smallText">Discount Coupon b applied:</td>

<td align="right" class="smallText">-£1499

 

<!-- Discount Coupons DEBUG

order Object

(

[info] => Array

(

[order_status] => 1

[currency] => GBP

[currency_value] => 1.00000000

[payment_method] => Cash on Delivery

[cc_type</td>

</tr>

<tr>

<td align="right" class="smallText">Sub-Total:</td>

<td align="right" class="smallText">£3497</td>

</tr>

<tr>

<td align="right" class="smallText">Flat Rate (Best Way):</td>

<td align="right" class="smallText">£5</td>

</tr>

<tr>

<td align="right" class="smallText">VAT:</td>

<td align="right" class="smallText">£524</td>

</tr>

<tr>

<td align="right" class="smallText">Total:</td>

<td align="right" class="smallText"><b>£4026</b></td>

</tr>

Edited by seodaddy
Link to comment
Share on other sites

I don't see a table column issue here, but I do see two opening tags for a table row instead of one in this section:

 

<td class="dataTableContent" align="right" valign="top"><b>£5744</b></td>
</tr>
<tr>

<tr>
<td align="right" class="smallText">Discount Coupon b applied:</td>

 

Thanks for the input Tracy :)

 

I have checked and their is only one key for the debug setting in the DB :(

and it is set to false!!!

 

I have had a look in the admin/modules.php file but cant find anything related to the discount coupons mod or the debug code :(

 

Has anyone else got an idea for a fix?

 

One user posted that they had closed an 'unclosed' <td> above the debug code and this had fixed the problem, however I cant find the culprit for this open tag anywhere.. I have highlighted it in the quote below.

 

I have checked the source in the files for the actual page (in this case admin/orders.php) and it seems to be correct??!!!

 

Any ideas?!

~Tracy
 

Link to comment
Share on other sites

Also, the debug info doesn't seem to be complete:

 

<!-- Discount Coupons DEBUG
order Object
(
[info] => Array
(
[order_status] => 1
[currency] => GBP
[currency_value] => 1.00000000
[payment_method] => Cash on Delivery
[cc_type

 

Let me do a little research and see where the debug PHP code is and I'll post it for you to compare with yours.

 

Thanks for the input Tracy :)

 

I have checked and their is only one key for the debug setting in the DB :(

and it is set to false!!!

 

I have had a look in the admin/modules.php file but cant find anything related to the discount coupons mod or the debug code :(

 

Has anyone else got an idea for a fix?

 

One user posted that they had closed an 'unclosed' <td> above the debug code and this had fixed the problem, however I cant find the culprit for this open tag anywhere.. I have highlighted it in the quote below.

 

I have checked the source in the files for the actual page (in this case admin/orders.php) and it seems to be correct??!!!

 

Any ideas?!

~Tracy
 

Link to comment
Share on other sites

Hi Tracy,

 

Have change it to the following, but still not working :(

tep_admin_files_boxes(FILENAME_INFORMATION_MANAGER, BOX_CATALOG_INFORMATION) .

tep_admin_files_boxes(FILENAME_PRODUCTS_EXPECTED, BOX_CATALOG_PRODUCTS_EXPECTED) .

tep_admin_files_boxes(FILENAME_DISCOUNT_COUPONS, BOX_CATALOG_DISCOUNT_COUPONS));

//Admin end

}

 

 

Well, for some reason your file looks a bit different from mine, and you have that products_expected link in there 3 times. It's commented out once above the discount coupon code changes and then again afterwards. If it helps, this is what my admin/includes/boxes/catalog.php looks like:

<?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>' .
							   '<a href="' . tep_href_link(FILENAME_PRODUCTS_EXPECTED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_PRODUCTS_EXPECTED . '</a><br>' .
							   //BOF Xsell
							   '<a href="' . tep_href_link(FILENAME_XSELL_PRODUCTS) . '" class="menuBoxContentLink">' . BOX_CATALOG_XSELL_PRODUCTS . '</a><br>' .
							   //EOF Xsell
							   //BOF Products Sort
							   '<a href="' . tep_href_link(FILENAME_PRODUCTS_SORTER, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_PRODUCTS_SORTER . '</a><br>' .
							   //EOF Products Sort
							   //BOF Discount Coupon Codes
							   '<a href="' . tep_href_link(FILENAME_DISCOUNT_COUPONS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_DISCOUNT_COUPONS . '</a>');
							   //EOF Discount Coupon Codes
 }

 $box = new box;
 echo $box->menuBox($heading, $contents);
?>

Link to comment
Share on other sites

Well, it appears to be in catalog/checkout_confirmation.php and of course mine has some spots commented out (like recalc shipping function) as I've not got them working properly yet. However, in the DCC v 3_31 original code, the debug section looks like this:

 

 //kgt - discount coupons
 if( tep_not_null( $coupon ) && is_object( $order->coupon ) ) { //if they have entered something in the coupon field
$order->coupon->verify_code();
if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DEBUG != 'true' ) {
	  if( !$order->coupon->is_errors() ) { //if we have passed all tests (no error message), make sure we still meet free shipping requirements, if any
		  if( $order->coupon->is_recalc_shipping() ) tep_redirect( tep_href_link( FILENAME_CHECKOUT_SHIPPING, 'error_message=' . urlencode( ENTRY_DISCOUNT_COUPON_SHIPPING_CALC_ERROR ), 'SSL' ) ); //redirect to the shipping page to reselect the shipping method
	  } else {
		  if( tep_session_is_registered('coupon') ) tep_session_unregister('coupon'); //remove the coupon from the session
		  tep_redirect( tep_href_link( FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode( implode( ' ', $order->coupon->get_messages() ) ), 'SSL' ) ); //redirect to the payment page
	  }
}
} else { //if the coupon field is empty, unregister the coupon from the session
	if( tep_session_is_registered('coupon') ) { //we had a coupon entered before, so we need to unregister it
  tep_session_unregister('coupon');
  //now check to see if we need to recalculate shipping:
  require_once( DIR_WS_CLASSES.'discount_coupon.php' );
  if( discount_coupon::is_recalc_shipping() ) tep_redirect( tep_href_link( FILENAME_CHECKOUT_SHIPPING, 'error_message=' . urlencode( ENTRY_DISCOUNT_COUPON_SHIPPING_CALC_ERROR ), 'SSL' ) ); //redirect to the shipping page to reselect the shipping method
}
}
//end kgt - discount coupons

 

So maybe double check that with the code you have.

 

Also, the debug info doesn't seem to be complete:

 

<!-- Discount Coupons DEBUG
order Object
(
[info] => Array
(
[order_status] => 1
[currency] => GBP
[currency_value] => 1.00000000
[payment_method] => Cash on Delivery
[cc_type

 

Let me do a little research and see where the debug PHP code is and I'll post it for you to compare with yours.

~Tracy
 

Link to comment
Share on other sites

I don't see a table column issue here, but I do see two opening tags for a table row instead of one in this section:

 

<td class="dataTableContent" align="right" valign="top"><b>£5744</b></td>
</tr>
<tr>

<tr>
<td align="right" class="smallText">Discount Coupon b applied:</td>

 

Thanks Tracey

 

here is the complete debug info from that page

 

<!-- Discount Coupons DEBUG

order Object

(

[info] => Array

(

[order_status] => 1

[currency] => GBP

[currency_value] => 1.00000000

[payment_method] => Cash on Delivery

[cc_type</td>

</tr>

<tr>

<td align="right" class="smallText">Sub-Total:</td>

<td align="right" class="smallText">£3497</td>

</tr>

<tr>

<td align="right" class="smallText">Flat Rate (Best Way):</td>

<td align="right" class="smallText">£5</td>

</tr>

<tr>

<td align="right" class="smallText">VAT:</td>

<td align="right" class="smallText">£524</td>

</tr>

<tr>

<td align="right" class="smallText">Total:</td>

<td align="right" class="smallText"><b>£4026</b></td>

</tr>

Link to comment
Share on other sites

Discount coupons is working fine on my new store it seems, except the number available is not going down, i set a new store code thing for people to save in celebration of the new store, max 50 available, but it has stayed at 50, not gone down, anyone know of this issue? help!

Link to comment
Share on other sites

Hmmm - something somewhere is having a glitch because the full debug report isn't printing:

[cc_type</td>

 

There should be CC info, or at least an ending "]" after [cc_type

Also, is there an opening <td> right before the <!-- Discount Coupons DEBUG ?

 

You might want to do a file comparison with the original DCC files and your store files to see if maybe something was missed. If you don't have a file comparison program WinMerge is free and works well :)

 

Thanks Tracey

 

here is the complete debug info from that page

~Tracy
 

Link to comment
Share on other sites

Not sure, but use the following search in Google - it does generate several different results, I just don't have time to read through them all at the moment:

 

site:www.oscommerce.com/forums "Discount Coupon Codes" +"Number available"

 

Also, try a file comparison program (such as WinMerge) to double check that you didn't miss something on install :)

 

Discount coupons is working fine on my new store it seems, except the number available is not going down, i set a new store code thing for people to save in celebration of the new store, max 50 available, but it has stayed at 50, not gone down, anyone know of this issue? help!

~Tracy
 

Link to comment
Share on other sites

Any more help?

 

and if i manually type in domain.co.uk/ai/coupons.php (ai is the admin folder), it says:

 

Access Denied

No Right Permission Access

Please contact your Web Administrator to request

more access or if you found any problem.

 

Hi Tracy,

 

Have change it to the following, but still not working :(

Link to comment
Share on other sites

Hmmm - on the permission denied - do you have the admin folder password protected? Also, what CHMOD settings do you have on the admin folder and specifically on the coupons.php file?

 

Any more help?

~Tracy
 

Link to comment
Share on other sites

Please, help...

 

I got this error

 

Parse error: syntax error, unexpected T_VARIABLE in /home/sunas10/public_html/trgovina/oscommerce-2.2rc2a/catalog/admin/coupons_exclusions.php on line 167

 

Any help?

 

Many thanks in advice...

Link to comment
Share on other sites

Hi, got another problem.

 

I have set up a few coupon codes, and no matter which one I try and enter, I keep getting the error message "The coupon code you have entered is not valid." Any ideas why? I am copy and pasting the code, so I know that it is right! Below is the one I have made...

 

2009-04-09

Coupon Name F&TF Special

Coupon Description This provides the customer with a discount for the release of the F&TF 4 Film

Coupon Amount 5.0000%

Coupon Minimum Order 99.0000

Free Shipping No Free Shipping

Coupon Code 34739b85461844

Uses per Coupon 0

Uses per Customer 1

Valid Customer List 0

Valid Product List

Valid Categories List

Start Date 04/09/2009

End Date 04/09/2010

Edited by true-tigger
Link to comment
Share on other sites

What version of DCC are you using?

 

Hi, got another problem.

 

I have set up a few coupon codes, and no matter which one I try and enter, I keep getting the error message "The coupon code you have entered is not valid." Any ideas why? I am copy and pasting the code, so I know that it is right! Below is the one I have made...

 

2009-04-09

Coupon Name F&TF Special

Coupon Description This provides the customer with a discount for the release of the F&TF 4 Film

Coupon Amount 5.0000%

Coupon Minimum Order 99.0000

Free Shipping No Free Shipping

Coupon Code 34739b85461844

Uses per Coupon 0

Uses per Customer 1

Valid Customer List 0

Valid Product List

Valid Categories List

Start Date 04/09/2009

End Date 04/09/2010

~Tracy
 

Link to comment
Share on other sites

Is your admin folder password protected? If so, you should login to www.mydomain.com/admin first and then click on the links from there to go to the coupons.php page.

 

What version of DCC are you using?

 

admin folder is rwx r-x r-x (755) and coupons.php is 644, now 755. I tried it at 777 aswell, but it forwards to that page again :s could that be why it isnt listing in the backend?

~Tracy
 

Link to comment
Share on other sites

I'm installing version 3.33. I am running osCommerce 2.2 rc2a.

 

On this instruction:

 

OPEN catalog/includes/classes/order.php

FIND on line 244:

$shown_price = tep_add_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) * $this->products[$index]['qty'];
$this->info['subtotal'] += $shown_price;

 

My code says:

$shown_price = $currencies->calculate_price($this->products[$index]['final_price'], $this->products[$index]['tax'], $this->products[$index]['qty']);
$this->info['subtotal'] += $shown_price;

 

Is this difference an issue?

I'm not sure why my code is different - as far as I can see it is the original rc2a code.

Edited by Floob
Link to comment
Share on other sites

Hmmm - I haven't used the newer versions or osC rc2. I am running v3.3 or 3.31 with osC 060817 and I simply modified the site code with the manul update info for rc2 :huh:

 

I'm not sure if copies of my files for comparison will help or not :blink:

 

Maybe someone who created a newer version would better be able to help troubleshoot?

 

ot_3_32

 

and I am logging in first. Anywho, main problem is it not accepting the codes at checkout.

~Tracy
 

Link to comment
Share on other sites

Hmmm - I haven't used the newer versions or osC rc2. I am running v3.3 or 3.31 with osC 060817 and I simply modified the site code with the manul update info for rc2 :huh:

 

I'm not sure if copies of my files for comparison will help or not :blink:

 

Maybe someone who created a newer version would better be able to help troubleshoot?

 

ot_3_32

 

and I am logging in first. Anywho, main problem is it not accepting the codes at checkout.

~Tracy
 

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...