Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Discount Coupon Codes


kgt

Recommended Posts

Thanks. New problem.

 

Fatal error: Cannot redeclare class discount_coupon in c:\EasyPHP1-8\www\catalog\includes\classes\discount_coupon.php on line 14

 

Yes, I read the docs.

 

Problem:

Fatal error: Cannot redeclare class discount_coupon in

***path to shop***/includes/classes/discount_coupon.php on line 14.

 

Solution:

Edit the file includes/classes/discount_coupon.php and comment out the line

require_once( DIR_FS_CATALOG.DIR_WS_CLASSES.'discount_coupon.php' );

 

I would do this, but 'require_once( DIR_FS_CATALOG.DIR_WS_CLASSES.'discount_coupon.php' );' is NOT in the file to comment out?

 

Tom

using 2.1 & new install of this contrib.

Link to comment
Share on other sites

Thanks. New problem.

 

Fatal error: Cannot redeclare class discount_coupon in c:\EasyPHP1-8\www\catalog\includes\classes\discount_coupon.php on line 14

 

Yes, I read the docs.

 

Problem:

Fatal error: Cannot redeclare class discount_coupon in

***path to shop***/includes/classes/discount_coupon.php on line 14.

 

Solution:

Edit the file includes/classes/discount_coupon.php and comment out the line

require_once( DIR_FS_CATALOG.DIR_WS_CLASSES.'discount_coupon.php' );

 

I would do this, but 'require_once( DIR_FS_CATALOG.DIR_WS_CLASSES.'discount_coupon.php' );' is NOT in the file to comment out?

 

Tom

using 2.1 & new install of this contrib.

 

That should read

 

Solution:

Edit the file includes/modules/order_total/ot_discount_coupon.php and comment out the line

require_once( DIR_FS_CATALOG.DIR_WS_CLASSES.'discount_coupon.php' );

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

THANKS !

This seems to work fine for the discount line itself. However, the next lines (e.g. subtotal) are still calculated without this rounding. Could some logic be applied to the subtotal (and total ?) please ?

I guess the new rounded discount value needs to picked up when displaying the subtotal line rather then the original not-rounded amount.

e.g.

products : 104.00

discount 5% : 5.00 (original 5.22)

subtotal : 98.78 (this should be in fact 99 now because 104-5=99)

shipping: 6.20

Total : 104.98 (this should be in fact 105.20 now)

 

Could you help me with this or would it require a total re-design of the standard subtotal/total oscommerce logic ?

 

 

If this were easy to do, the discounts would never have a chance of being off in the first place.

 

I am working on a version (almost complete) that will be more accurate. Indeed, I haven't been able to figure out how to get inaccurate totals with it yet - a good sign. With that version, you should be able to do what you want easily enough.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

kgt, Everything is working fine locally, BUT, I'm getting a lousy 1064 error in admin on the live site after installing.

 

Discount Coupons NOTICE: Click here to read the Discount Coupon Codes manual for help editing coupons.

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 '-12, 12' at line 1

 

select * from discount_coupons cd order by cd.coupons_date_end, coupons_date_start limit -12, 12

 

Update for anyone else having this problem.

 

Found the solution here:

 

http://www.oscommerce.com/community/bugs,1605

(look for the post dated april 15 05)

 

This is a bug in oscommerce

admin->includes->classes->split_page_result.php file.

 

Error code :

Approximate Line : 34

Function : splitPageResults

 

LOOK FOR

 

$offset = ($max_rows_per_page * ($current_page_number - 1));

$sql_query .= " limit " . $offset . ", " . $max_rows_per_page;

 

This creates a problem if there is no record in database.

 

Fix ( Replace the above two lines with this code )

 

$offset = 0;

if($current_page_number > 0){

$offset = ($max_rows_per_page * ($current_page_number - 1));

}

$sql_query .= " limit " . $offset . ", " . $max_rows_per_page;

 

 

Seems to be working now.

Link to comment
Share on other sites

I have installed the coupon module (it is great, thanx to whom ever did this!).

 

I'm having a problem though:

 

I have created 1 discount coupon of '12345'. The 'Do you have a promotional code or discount coupon?' appears on my Payment Information screen. When i press 'continue' The page refreshes and my CC info and Coupon Code is no longer there.

 

I notice the URL is listed as:

checkout_payment.php?error_message=The+coupon+code+you+have+entered+is+not+valid.&osCsid=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

 

It does not seem to be able to reference my coupon code, what am I doing wrong?

 

Any help is appreciated - thanx

Link to comment
Share on other sites

I have created 1 discount coupon of '12345'. The 'Do you have a promotional code or discount coupon?' appears on my Payment Information screen. When i press 'continue' The page refreshes and my CC info and Coupon Code is no longer there.

 

I notice the URL is listed as:

checkout_payment.php?error_message=The+coupon+code+you+have+entered+is+not+valid.

 

It does not seem to be able to reference my coupon code, what am I doing wrong?

 

 

This can happen if you enter your dates in the incorrect format. The format expected is taken from admin/includes/languages/english.php. If the format in that file is mm/dd/yyyy, then you will have this problem if you try to enter a date as dd/mm/yyyy.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

Hi All,

 

I was wondering if anyone has expanded on this contribution to allow it to offer a coupon code that will offer free shipping and just drop the shipping charge when the coupon code is entered?

 

Any help is appriciated.

 

Regards,

Jp

Link to comment
Share on other sites

Hello rogertvr / kgt,

 

I am also having the problem whereby I've set the max-use for a discount code but all customers paying via the paypal ipn mod have infinite goes at using the discount code.

 

I've set the auto return on etc. Did you resolve the problem that was occurring? Was there an error in the checkout.process.php file that was sent? If so, could you share this with me as I've run out of ideas.

 

Many Thanks,

 

James

Link to comment
Share on other sites

kgt, got a syntax error when installing the 'reports' code.

 

syntax error, unexpected ')' in /home/xxxxxx/public_html/catalog/admin/includes/boxes/reports.php on line 32

 

 

admin/includes/boxes/reports.php ----------------------------------------------

 

line 26

replace

 

'<a href="' . tep_href_link(FILENAME_STATS_CUSTOMERS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_ORDERS_TOTAL . '</a>');

 

with

 

//kgt - discount coupons report

'<a href="' . tep_href_link(FILENAME_STATS_CUSTOMERS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_ORDERS_TOTAL . '</a><br>' .

'<a href="' . tep_href_link(FILENAME_STATS_DISCOUNT_COUPONS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_DISCOUNT_COUPONS . '</a>');

//end kgt - discount coupons report

 

 

Don't know if this has been visited already, but the fix for me is in BOLD below.

 

with

 

//kgt - discount coupons report

'<a href="' . tep_href_link(FILENAME_STATS_CUSTOMERS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_ORDERS_TOTAL . '</a><br>' .

'<a href="' . tep_href_link(FILENAME_STATS_DISCOUNT_COUPONS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_DISCOUNT_COUPONS . '</a><br>' .

//end kgt - discount coupons report

 

 

Tom

Edited by dragon5
Link to comment
Share on other sites

Hi All,

 

I was wondering if anyone has expanded on this contribution to allow it to offer a coupon code that will offer free shipping and just drop the shipping charge when the coupon code is entered?

 

Any help is appriciated.

 

Regards,

Jp

This is exactly what I want. That is the main reason I want to offer special discounts at times. My shipping is based upon total of order so there is no specific discount I could give to all customers that would make the shipping 0.

Link to comment
Share on other sites

I am having a serious problem after installing this contribution. I hope that you guys can help me.

 

I am using paypal ipn, and when returning from the paypal payment page to checkout_process.php I get this error:

 

Parse error: syntax error, unexpected T_STRING in /home/shopdom/public_html/includes/languages/espanol/checkout_process.php on line 16

 

No confirmation email is sent and the shopping cart retains the paid items.

 

Any idea how to solve this? I will really appreciate it.

Link to comment
Share on other sites

kgt, got a syntax error when installing the 'reports' code.

 

syntax error, unexpected ')' in /home/xxxxxx/public_html/catalog/admin/includes/boxes/reports.php on line 32

admin/includes/boxes/reports.php ----------------------------------------------

 

line 26

replace

 

'<a href="' . tep_href_link(FILENAME_STATS_CUSTOMERS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_ORDERS_TOTAL . '</a>');

 

with

 

//kgt - discount coupons report

'<a href="' . tep_href_link(FILENAME_STATS_CUSTOMERS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_ORDERS_TOTAL . '</a><br>' .

'<a href="' . tep_href_link(FILENAME_STATS_DISCOUNT_COUPONS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_DISCOUNT_COUPONS . '</a>');

//end kgt - discount coupons report

Don't know if this has been visited already, but the fix for me is in BOLD below.

 

with

 

//kgt - discount coupons report

'<a href="' . tep_href_link(FILENAME_STATS_CUSTOMERS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_ORDERS_TOTAL . '</a><br>' .

'<a href="' . tep_href_link(FILENAME_STATS_DISCOUNT_COUPONS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_DISCOUNT_COUPONS . '</a><br>' .

//end kgt - discount coupons report

Tom

 

 

It's because you have another contribution installed.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

You have a syntax error in includes/languages/espanol/checkout_process.php. Whatever changes you made to that file caused an error.

Thank you very much!

 

I have found another problem: I am using paypal ipn and the discount although it shows in checkout_confirmation.php it is not being passed on to paypal. Any idea why?

Link to comment
Share on other sites

You have a syntax error in includes/languages/espanol/checkout_process.php. Whatever changes you made to that file caused an error.

Thank you very much!

 

I have found another problem: I am using paypal ipn and the discount although it shows in checkout_confirmation.php it is not being passed on to paypal. Any idea why?

Link to comment
Share on other sites

You have a syntax error in includes/languages/espanol/checkout_process.php. Whatever changes you made to that file caused an error.

Thank you very much!

 

I have found another problem: I am using paypal ipn and the discount although it shows in checkout_confirmation.php it is not being passed on to paypal. Any idea why?

Link to comment
Share on other sites

When do you expect to have the new version ready as it seems that a lot of things will be improved.

I guess we can download it from contribution list page once it's ready?

 

There should be some major improvements. It's mostly done, just needs to go through testing. If anyone is willing to help out with testing, please email or PM me.

Contributions

 

Discount Coupon Codes

Donations

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