kgt Posted August 23, 2006 Author Share Posted August 23, 2006 After looking into it, the randomly generated coupon codes are alphanumeric but upon further inspection, when I try to enter that into the checkout page it comes back and says invalid coupon code. Any ideas? It will say invalid code if today's date doesn't fall within the coupon's dates (if the coupon doesn't have unlimited dates). That seems to be the most common cause for people getting this error. You must enter the dates in the format used by your admin section. You can double check this by looking in admin/includes/languages/english.php. Towards the top, you will see the date formats. Quote Contributions Discount Coupon Codes Donations Link to comment Share on other sites More sharing options...
Guest Posted August 23, 2006 Share Posted August 23, 2006 Help... starting to get bleary eyed. Installed and when I go to catalog I get: HEADING_TITLE TEXT_DISCOUNT_COUPONS_ID TEXT_INFO_DISCOUNT_PERCENT TEXT_INFO_DATE_START TEXT_INFO_DATE_END TEXT_INFO_MAX_USE TEXT_INFO_MIN_ORDER TEXT_INFO_NUMBER_AVAILABLE No errors on site... just can't even get to make a coupon Quote Link to comment Share on other sites More sharing options...
kgt Posted August 23, 2006 Author Share Posted August 23, 2006 Help... starting to get bleary eyed. Installed and when I go to catalog I get: HEADING_TITLE TEXT_DISCOUNT_COUPONS_ID TEXT_INFO_DISCOUNT_PERCENT TEXT_INFO_DATE_START TEXT_INFO_DATE_END TEXT_INFO_MAX_USE TEXT_INFO_MIN_ORDER TEXT_INFO_NUMBER_AVAILABLE No errors on site... just can't even get to make a coupon You didn't get the language file uploaded. Upload admin/includes/languages/english/coupons.php from the zip file. Quote Contributions Discount Coupon Codes Donations Link to comment Share on other sites More sharing options...
Guest Posted August 23, 2006 Share Posted August 23, 2006 You didn't get the language file uploaded. Upload admin/includes/languages/english/coupons.php from the zip file. Thank you! I figured it was something obvious. Quote Link to comment Share on other sites More sharing options...
Guest Posted August 23, 2006 Share Posted August 23, 2006 Hi I had the same prob as modulate on page 7, I fixed it with your instructions to add more code to admin/coupon.php but now I got another prob 1054 - Unknown column 'number_available' in 'field list' insert into discount_coupons ( coupons_id, coupons_description, coupons_discount_percent, date_start, date_end, max_use, min_order, number_available) values ('scott', 'scott', '.5', null, null, 0, 0, 0) [TEP STOP] Any ideas? Quote Link to comment Share on other sites More sharing options...
kgt Posted August 23, 2006 Author Share Posted August 23, 2006 Hi I had the same prob as modulate on page 7, I fixed it with your instructions to add more code to admin/coupon.php but now I got another probAny ideas? What version did you download? Quote Contributions Discount Coupon Codes Donations Link to comment Share on other sites More sharing options...
Guest Posted August 23, 2006 Share Posted August 23, 2006 What version did you download? 1.4 from 27th June Quote Link to comment Share on other sites More sharing options...
kgt Posted August 23, 2006 Author Share Posted August 23, 2006 1.4 from 27th June If you upgraded, you need to upgrade the database as well. From the upgrade instructions: **************** STEP 2 ****************Modify the database Run these statements via the SQL tab in phpMyAdmin. ALTER TABLE discount_coupons ADD COLUMN number_available INT(3) DEFAULT 0 NOT NULL AFTER min_order; Quote Contributions Discount Coupon Codes Donations Link to comment Share on other sites More sharing options...
Guest Posted August 23, 2006 Share Posted August 23, 2006 If you upgraded, you need to upgrade the database as well. From the upgrade instructions: Hi it was a fresh install but altering the database table has fixed the prob thank you! Quote Link to comment Share on other sites More sharing options...
Guest Posted August 24, 2006 Share Posted August 24, 2006 Great contribution and easy to install also for newbies like me :) . i have the version ot_discount_coupon_codes_1.4a: here it take % and not amount. Is it possible to change that to an amount. Or maybe make a new version with both? Quote Link to comment Share on other sites More sharing options...
Efish Posted August 24, 2006 Share Posted August 24, 2006 God bless the programmer who will make it possible to insert an amount and not a %. :) Quote Link to comment Share on other sites More sharing options...
kgt Posted August 24, 2006 Author Share Posted August 24, 2006 God bless the programmer who will make it possible to insert an amount and not a %.:) It will be. I'm in the final stages of testing. If anyone wants to help by testing for me, send me an email. Quote Contributions Discount Coupon Codes Donations Link to comment Share on other sites More sharing options...
kgt Posted August 24, 2006 Author Share Posted August 24, 2006 I added version 2.0. Some big changes, including the ability to used fixed discounts and to configure how the discount line is displayed on the confirmation screen, invoices, etc. http://www.oscommerce.com/community/contributions,4269 If you're interested in using fixed discounts, please read the important note in the package detail. Quote Contributions Discount Coupon Codes Donations Link to comment Share on other sites More sharing options...
RichardsonDA Posted August 24, 2006 Share Posted August 24, 2006 Hi....thanks for the update.... (version 2).. I've installed this on a system thats hopefully going live in September... Although I have a few queries.... Its allowing more than 1 use if set to 1 Its allowing a coupon to be used on orders of less than the minimum And the report for coupon usage in 1.4 needs re-doing for 2 Ta Thanks for a good addition by the way :) Quote Link to comment Share on other sites More sharing options...
RichardsonDA Posted August 24, 2006 Share Posted August 24, 2006 Just checked and it does the same for both fixed and % I've upgraded for 1.4 to 2 if that helps 1.4 worked fine regarding the conditions Quote Link to comment Share on other sites More sharing options...
RichardsonDA Posted August 24, 2006 Share Posted August 24, 2006 Just going to re-do everything incase I've mist something Just as well I like my backups ;-) Quote Link to comment Share on other sites More sharing options...
RichardsonDA Posted August 25, 2006 Share Posted August 25, 2006 Just noticed in the download for version 2 you have a file to replace existing which is \catalog\checkout_payment.php but there are no edits for checkout_payment in the updates files.. I have not replaced the file as I was expecting edits I've replaced the file to see if that make the difference....but it made no difference.. Quote Link to comment Share on other sites More sharing options...
kgt Posted August 25, 2006 Author Share Posted August 25, 2006 Hi....thanks for the update.... (version 2).. I've installed this on a system thats hopefully going live in September... Although I have a few queries.... Its allowing more than 1 use if set to 1 Its allowing a coupon to be used on orders of less than the minimum And the report for coupon usage in 1.4 needs re-doing for 2 Ta Thanks for a good addition by the way :) Quick Fix - I updated the contribution downloads as well: checkout_confirmation.php line 74 after $this_coupon = new discount_coupon( $HTTP_POST_VARS['coupon'] ); add $this_coupon->verify_code(); includes/classes/discount_coupon.php line 68-78 replace function check_coupons_max_use( $code = '' ) { $check_use_query = tep_db_query($sql = "SELECT COUNT(*) AS cnt FROM ".TABLE_ORDERS." AS o INNER JOIN ".TABLE_DISCOUNT_COUPONS_TO_ORDERS." dc2o ON dc2o.orders_id=o.orders_id AND o.customers_id = '".$customer_id."' AND dc2o.coupons_id='".tep_db_prepare_input( $this->code )."'"); $use = tep_db_fetch_array( $check_use_query ); //show error message if coupons_max_use is equal to the number of times this customer has used the code if( $this->coupon['coupons_max_use'] <= $use['cnt'] ) $error_message[] = sprintf( ENTRY_DISCOUNT_COUPON_USE_ERROR, $use['cnt'], $this->coupon['coupons_max_use'] ); //display the error message for number of times used } with function check_coupons_max_use() { global $customer_id; $check_use_query = tep_db_query($sql = "SELECT COUNT(*) AS cnt FROM ".TABLE_ORDERS." AS o INNER JOIN ".TABLE_DISCOUNT_COUPONS_TO_ORDERS." dc2o ON dc2o.orders_id=o.orders_id AND o.customers_id = '".(int)$customer_id."' AND dc2o.coupons_id='".tep_db_prepare_input( $this->code )."'"); $use = tep_db_fetch_array( $check_use_query ); //show error message if coupons_max_use is equal to the number of times this customer has used the code if( $this->coupon['coupons_max_use'] <= $use['cnt'] ) $this->error_message[] = sprintf( ENTRY_DISCOUNT_COUPON_USE_ERROR, $use['cnt'], $this->coupon['coupons_max_use'] ); //display the error message for number of times used } Quote Contributions Discount Coupon Codes Donations Link to comment Share on other sites More sharing options...
RichardsonDA Posted August 25, 2006 Share Posted August 25, 2006 Cheer for the updates...I've applied them.... Get his message now when min order is not reached Fatal error: Call to a member function on a non-object in c:\apache\htdocs\cbr-forum\catalog\includes\classes\discount_coupon.php on line 65 but works fine when min order is met and works fine for max usage..... so half way there now - laughs Quote Link to comment Share on other sites More sharing options...
kgt Posted August 25, 2006 Author Share Posted August 25, 2006 Cheer for the updates...I've applied them....Get his message now when min order is not reached Fatal error: Call to a member function on a non-object in c:\apache\htdocs\cbr-forum\catalog\includes\classes\discount_coupon.php on line 65 but works fine when min order is met and works fine for max usage..... so half way there now - laughs Line 54-67 includes\classes\discount_coupon.php replace function check_coupons_min_order() { global $order; //if we display the subtotal without the discount applied, then just compare the subtotal to the minimum order if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_SUBTOTAL == 'false' && $this->coupon['coupons_min_order'] > $order->info['subtotal'] ) { $this->error_message[] = sprintf( ENTRY_DISCOUNT_COUPON_MIN_ERROR, $currencies->format( $this->coupon['coupons_min_order'], true, $order->info['currency'], $order->info['currency_value'] ) ); //if we display the subtotal with the discount applied, then we need to compare the subtotal with the discount added back in to the minimum order } else if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_SUBTOTAL == 'true' ) { $subtotal = $order->info['subtotal']; foreach( $order->info['applied_discount'] as $discount ) { $subtotal += $discount; } if( $this->coupon['coupons_min_order'] > $subtotal ) $this->error_message[] = sprintf( ENTRY_DISCOUNT_COUPON_MIN_ERROR, $currencies->format( $this->coupon['coupons_min_order'], true, $order->info['currency'], $order->info['currency_value'] ) ); } } with function check_coupons_min_order() { global $order, $currencies; //if we display the subtotal without the discount applied, then just compare the subtotal to the minimum order if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_SUBTOTAL == 'false' && $this->coupon['coupons_min_order'] > $order->info['subtotal'] ) { $this->error_message[] = sprintf( ENTRY_DISCOUNT_COUPON_MIN_ERROR, $currencies->format( $this->coupon['coupons_min_order'], true, $order->info['currency'], $order->info['currency_value'] ) ); //if we display the subtotal with the discount applied, then we need to compare the subtotal with the discount added back in to the minimum order } else if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_SUBTOTAL == 'true' ) { $subtotal = $order->info['subtotal']; foreach( $order->info['applied_discount'] as $discount ) { $subtotal += $discount; } if( $this->coupon['coupons_min_order'] > $subtotal ) $this->error_message[] = sprintf( ENTRY_DISCOUNT_COUPON_MIN_ERROR, $currencies->format( $this->coupon['coupons_min_order'], true, $order->info['currency'], $order->info['currency_value'] ) ); } } Quote Contributions Discount Coupon Codes Donations Link to comment Share on other sites More sharing options...
RichardsonDA Posted August 25, 2006 Share Posted August 25, 2006 Cheers; thats resolved the problem !! :-) Double tested it agian... Works fine with Min order not being reached Works fine with Min order being reached Works fine with max usage reached Works fine with max usage not being reached Thanks again....a fantastic addition :-) Cheers And thanks for your hard work in the 1st instance as well as the modifications in bug fixing...cheers Dave Quote Link to comment Share on other sites More sharing options...
Guest Posted August 26, 2006 Share Posted August 26, 2006 This is a great contribution! Quick comment on the updated 2.0 "upgrade_from_ot_discount_coupon_codes_1.4.txt" upgrade instructions text: In the database changes section, you may want to determine what the proper order is for the coupons_max_order field changes. It's obvious what needs to be done when one is making the changes, but you might be able to avoid questions in the future if you can figure out the requirements for the ADD COLUMN or CHANGE statement. In my case, I didn't have the max_order field although i've been using the contribution successfully. In any event, great contribution and thanks for all your hard work! Quote Link to comment Share on other sites More sharing options...
Guest Posted August 26, 2006 Share Posted August 26, 2006 Curses! I'm upgrading from 1.4 to 2.0 and am having a bit of a challenge trying to figure out which changes apply to my 1.4 installation. I started out installing 1.4a, but when I determined that it only worked with dollar value discounts, I backed it out to 1.4. This may be part of my problem with the confusing upgrade path. While making changes to admin/includes/languages/english/coupons.php I'm coming across changes that I have in my version of the file, that are not in the 2.0 version of the file. For example, these defines are in my 1.4 version of this file, but are not in the 2.0 version: define('TEXT_DISCOUNT_COUPONS_ID_HINT', '(This is the code given to the customer. Leave blank to generate a random code.)'); define('TEXT_DISCOUNT_COUPONS_PERCENT_HINT', '(Enter a decimal percent. eg ".15" instead of "15" or "15%")'); define('TEXT_DISCOUNT_COUPONS_MAX_USE_HINT', '(Maximum number of times a customer may use this code. Leave blank or enter 0 for unlimited.)'); This is a very minor issue since it looks like you've just removed the hint defines, but it makes me paranoid since the removal of these lines isn't mentioned in the manual upgrade instructions. Quote Link to comment Share on other sites More sharing options...
wenmian Posted August 26, 2006 Share Posted August 26, 2006 (edited) Kgt, nice contrib, but i only managed to get it to work partly. I'm using v2.0 with the latest bugfix u posted. here's the situation. when i set the sort_order of the discount coupon order module to a UNIQUE number as u mentioned, I get this error at the checkout_confirmation.php screen: Fatal error: Cannot redeclare class discount_coupon in c:\wamp\www\shop\includes\classes\discount_coupon.php on line 14 I find that when i set the order to something that is non-unique (same order number as that of sub-total for instance), the module works - only draw back is that it will not show the discount text since the order is non-unique. I'm looking at how there a redeclare could have been introduced. Looking at the checkout_confirmation code, there is only one line that says "new discount_coupon(....)". The other instance occurs in class\order.php which is being "required" by checkout_confirmation.php. However, these are in your original files so I'm puzzled why its not working on mine. Could this problem be due to my installation of "master products" contrib. Will appreciate any advise you can give. Thank you. PS: I also double checked all the changes that are to be made and nothings amiss. Edited August 26, 2006 by wenmian Quote Link to comment Share on other sites More sharing options...
wenmian Posted August 27, 2006 Share Posted August 27, 2006 Kgt, I've managed to solve the problem i think. I removed the line: "require_once( DIR_FS_CATALOG.DIR_WS_CLASSES.'discount_coupon.php' );" from the file 'ot_discount_coupon.php'. Apparently this has resulted in 2 instances of require for the discount_coupon class. Kgt, let me know if this modification is acceptable. 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.