Jump to content

kgt

Members
  • Content count

    2,878
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by kgt

  1. Changing that section to this: //shipping zone exclusions $check_user_query = tep_db_query($sql = 'SELECT dc2z.geo_zone_id FROM '.TABLE_DISCOUNT_COUPONS_TO_ZONES.' dc2z LEFT JOIN '.TABLE_ZONES_TO_GEO_ZONES.' z2g USING( geo_zone_id ) WHERE ( z2g.zone_id='.(int)$delivery['zone_id'].' or z2g.zone_id = 0 or z2g.zone_id IS NULL ) AND ( z2g.zone_country_id='.(int)$delivery['country_id'].' or z2g.zone_country_id = 0 ) AND dc2z.coupons_id="'.tep_db_input( $code ).'"' ); if (tep_db_num_rows( $check_user_query ) > 0 ) { $this->message( ENTRY_DISCOUNT_COUPON_ERROR ); //display the error message //use this to debug exclusions: //$this->message( 'Shipping Zones exclusion check failed' ); } //end shipping zone exclusions Should fix the problem and allow you to still use zone exclusions. The reason it fails when you have only digital problem is because there's no shipping address needed - thus there's no zone to check against.
  2. You're getting a different error than the database error, probably the same problem others have been reporting that is a result of the install instructions missing some code. admin/includes/boxes/catalog.php needs to be: //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 and admin/includes/boxes/reports.php needs to be: //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>'); /************* '<a href="' . tep_href_link(FILENAME_STATS_CUSTOMERS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_ORDERS_TOTAL . '</a>'); *************/ //end kgt - discount coupons report
  3. I mean look in the README file on how to go about capturing the debug output, then send it to me in a PM or email.
  4. Can you PM or email me debug output? See the README for help with that.
  5. Make sure you've made the changes to checkout_process.php. Also see the README for help with fixing Paypal IPN if you use that as a payment module. Some payment modules may alter the way checkout_process.php operates or bypass it completely. It all depends on what else you have installed.
  6. Several people have asked about this. I gave suggestions in a previous thread. Basically it's something you have to take care of in the Paypal module.
  7. Please PM or email me a debug output. See the README for help with this.
  8. See the README for help with common problems like this one. Likely causes are a non-unique sort order, you missed the changes to includes/classes/order.php, or you missed the changes to checkout_confirmation.php.
  9. Replace includes/modules/order_total/ot_discount_coupons.php with the following: <?php /* * ot_discount_coupons.php * August 4, 2006 * author: Kristen G. Thorson * ot_discount_coupon_codes version 3.0 * * * Released under the GNU General Public License * */ class ot_discount_coupon { var $title, $output, $coupon; function ot_discount_coupon() { $this->code = 'ot_discount_coupon'; $this->title = MODULE_ORDER_TOTAL_DISCOUNT_COUPON_TITLE; $this->enabled = ((MODULE_ORDER_TOTAL_DISCOUNT_COUPON_STATUS == 'true') ? true : false); $this->sort_order = MODULE_ORDER_TOTAL_DISCOUNT_COUPON_SORT_ORDER; $this->output = array(); } function process() { global $order, $currencies; if( is_object( $order->coupon ) ) { //if the order total lines for multiple tax groups should be displayed as one, add them all together if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_LINES == 'false' ) $discount_lines = array( array_sum( $order->coupon->applied_discount ) ); else $discount_lines = $order->coupon->applied_discount; if( is_array( $discount_lines ) ) foreach( $discount_lines as $tax_group => $discount ) { if( $discount > 0 ) { //add in the tax if needed: if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_TAX == 'Display discount with discounted tax applied' && is_array( $order->coupon->discount_tax ) ) $discount += array_sum( $order->coupon->discount_tax ); //determine the display type (with or without the minus sign): $display_type = ( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_TYPE == 'true' ? '-' : '' ); $text = $display_type . $currencies->format( $discount, true, $order->info['currency'], $order->info['currency_value'] ); //add debug text if debug is on: if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DEBUG == 'true' ) $text .= print_r( "\n\n<!-- Discount Coupons DEBUG\n".print_r( $order, true )."\nEnd Discount Coupons DEBUG-->\n\n", true ); $this->output[] = array( 'title' => $order->coupon->format_display( $tax_group ) . ':', 'text' => $text, 'value' => $display_type . $discount ); } } //determine if we need to display a second line to show tax no longer applied if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_TAX == 'Display discounted tax in separate line' && is_array( $order->coupon->discount_tax ) ) { $discounted_tax = array_sum( $order->coupon->discount_tax ); $text = $display_type . $currencies->format( $discounted_tax, true, $order->info['currency'], $order->info['currency_value'] ); $this->output[] = array( 'title' => MODULE_ORDER_TOTAL_DISCOUNT_COUPON_TAX_NOT_APPLIED . ':', 'text' => $text, 'value' => $display_type . $discounted_tax ); } } else $this->enabled = false; } function check() { if (!isset($this->_check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_DISCOUNT_COUPON_STATUS'"); $this->_check = tep_db_num_rows($check_query); } return $this->_check; } function keys() { return array( 'MODULE_ORDER_TOTAL_DISCOUNT_COUPON_STATUS', 'MODULE_ORDER_TOTAL_DISCOUNT_COUPON_SORT_ORDER', 'MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_TYPE', 'MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_SUBTOTAL', 'MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_TAX', 'MODULE_ORDER_TOTAL_DISCOUNT_COUPON_EXCLUDE_SPECIALS', 'MODULE_ORDER_TOTAL_DISCOUNT_COUPON_RANDOM_CODE_LENGTH', 'MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_LINES', 'MODULE_ORDER_TOTAL_DISCOUNT_COUPON_RECALC_SHIPPING', 'MODULE_ORDER_TOTAL_DISCOUNT_COUPON_ALLOW_NEGATIVE', 'MODULE_ORDER_TOTAL_DISCOUNT_COUPON_USE_LANGUAGE_FILE', 'MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_CONFIG', 'MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DEBUG'); } function install() { tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable discount coupon?', 'MODULE_ORDER_TOTAL_DISCOUNT_COUPON_STATUS', 'true', '', '615', '1', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now()), ('Sort Order', 'MODULE_ORDER_TOTAL_DISCOUNT_COUPON_SORT_ORDER', '0', 'Order in which the discount coupon code order total line will be displayed on order confirmation, invoice, etc.', '615', '2', '', now()), ('Display discount with minus (-) sign?', 'MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_TYPE', 'true', '<b>true</b> - the discount will be displayed with a minus sign<br><b>false</b> - the discount will be displayed without a minus sign', '615', '3', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now()), ('Display subtotal with applied discount?', 'MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_SUBTOTAL', 'true', '<b>true</b> - the order subtotal will be displayed with the discount applied<br><b>false</b> - the order subtotal will be displayed without the discount applied', '615', '4', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now()), ('Display tax in discount line?', 'MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_TAX', 'None', 'Select the method for displaying tax in the discount line.', '615', '5', 'tep_cfg_select_option(array(\'None\', \'Display discounted tax in separate line\', \'Display discount with discounted tax applied\'), ', now()), ('Exclude product specials?', 'MODULE_ORDER_TOTAL_DISCOUNT_COUPON_EXCLUDE_SPECIALS', 'true', '<b>true</b> - products with active specials will be excluded from discounts<br><b>false</b> - products with active specials will NOT be excluded from discounts', '615', '6', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now()), ('Random Code Length', 'MODULE_ORDER_TOTAL_DISCOUNT_COUPON_RANDOM_CODE_LENGTH', '6', 'Length for randomly generated coupon codes.', '615', '7', '', now()), ('Display discount total lines for each tax group?', 'MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_LINES', 'false', '<b>true</b> - the discount coupon order total lines will be displayed for each tax group for the order<br><b>false</b> - the discount order total lines will be combined and displayed as one line', '615', '8', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now()), ('Recalculate Free Shipping and Table Shipping limits?', 'MODULE_ORDER_TOTAL_DISCOUNT_COUPON_RECALC_SHIPPING', 'true', '<b>true</b> - the discounted order total will be used to determine if the shipping rate has changed<br><b>false</b> - the shipping rate will be based on the original (non-discounted) order total', '615', '9', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now()), ('Allow negative order total?', 'MODULE_ORDER_TOTAL_DISCOUNT_COUPON_ALLOW_NEGATIVE', 'false', 'Set to true if you want negative order totals when the discount is greater than the order total.', '615', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now()), ('Use the language file to format display string?', 'MODULE_ORDER_TOTAL_DISCOUNT_COUPON_USE_LANGUAGE_FILE', 'false', '<b>true</b> - use the format found in language file (used for when you have multiple languages and want the order total line to format display depending on language choice)<br><b>false</b> - use the format and language below', '615', '11', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now()), ('Display Format for Order Total Line', 'MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_CONFIG', 'Discount Coupon [code] applied', 'Display format for the discount coupon code order total line.<br><br>Variables:<br>[code]<br>[coupon_desc]<br>[discount_amount]<br>[min_order]<br>[number_available]<br>[tax_desc]', '615', '12', '', now()), ('Debug Mode', 'MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DEBUG', 'false', 'To use: on checkout confirmation page, View Source in browser for debug output. <b>This must be set to false for live shops or error messages will not display.</b>', '615', '13', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now())"); tep_db_query("CREATE TABLE IF NOT EXISTS discount_coupons ( coupons_id VARCHAR(32) NOT NULL DEFAULT '', coupons_description VARCHAR(64) NOT NULL DEFAULT '', coupons_discount_amount DECIMAL(15,12) NOT NULL DEFAULT '0.0000', coupons_discount_type ENUM ('fixed','percent','shipping') NOT NULL DEFAULT 'percent', coupons_date_start DATETIME DEFAULT NULL, coupons_date_end DATETIME DEFAULT NULL, coupons_max_use INT(3) NOT NULL DEFAULT 0, coupons_min_order DECIMAL(15,4) NOT NULL DEFAULT '0.0000', coupons_min_order_type ENUM('price','quantity') DEFAULT 'price', coupons_number_available INT(3) NOT NULL DEFAULT 0, PRIMARY KEY (coupons_id) )"); tep_db_query("CREATE TABLE IF NOT EXISTS discount_coupons_to_orders ( coupons_id VARCHAR(32) NOT NULL DEFAULT '', orders_id INT(11) NOT NULL DEFAULT '0', PRIMARY KEY (coupons_id,orders_id) )"); tep_db_query("CREATE TABLE IF NOT EXISTS discount_coupons_to_categories ( coupons_id VARCHAR(32) NOT NULL DEFAULT '', categories_id INT(11) NOT NULL DEFAULT '0', PRIMARY KEY (coupons_id,categories_id) )"); tep_db_query("CREATE TABLE IF NOT EXISTS discount_coupons_to_products ( coupons_id VARCHAR(32) NOT NULL DEFAULT '', products_id INT(11) NOT NULL DEFAULT '0', PRIMARY KEY (coupons_id,products_id) )"); tep_db_query("CREATE TABLE IF NOT EXISTS discount_coupons_to_manufacturers ( coupons_id VARCHAR(32) NOT NULL DEFAULT '', manufacturers_id INT(11) NOT NULL DEFAULT '0', PRIMARY KEY (coupons_id,manufacturers_id) )"); tep_db_query("CREATE TABLE IF NOT EXISTS discount_coupons_to_customers ( coupons_id VARCHAR(32) NOT NULL DEFAULT '', customers_id INT(11) NOT NULL DEFAULT '0', PRIMARY KEY (coupons_id,customers_id) )"); tep_db_query("CREATE TABLE IF NOT EXISTS discount_coupons_to_zones ( coupons_id VARCHAR(32) NOT NULL DEFAULT '', geo_zone_id INT(11) NOT NULL DEFAULT '0', PRIMARY KEY (coupons_id,geo_zone_id) )"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } } ?> This fix only affects MySQL 5 users with strict SQL turned on.
  10. The SQL you posted is not from version 3.3. Try downloading the package again and uploading admin/coupons.php again. I'm not sure what's happened, but it seems you have an old version of that file up there.
  11. Double check the code you added to checkout_process.php. Also, if you're using Paypal IPN, see the README. There's an additional step you need to take to get it working.
  12. Did you upgrade or install from scratch? The problem file is admin/coupons.php. The SQL statement above is from versions 2.* of DCC. Triple check that file.
  13. The order total stored in the database has four digits after the decimal point. I think the reason you've never run into this problem before is simply that there aren't many chances for the order total to have more than two digits after the decimal point until you introduce a discount. The rounding is something that really probably should be done in the Paypal module. If you PM or email me the code for your paypal module (found in includes/modules/payment/name_of_paypal_module.php, then I can take a look at it for you. What I will be adding is something like this: global $currencies; $order_total = number_format($order->info['total'] * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency)); And replace all instances of $order->info['total'] with $order_total (the rounded version of $order->info['total']). By the way, good job on the debugging. I think you're probably correct on the reason for the error.
  14. You have a template installed and template makers like to move that function to the header. Remove the tep_show_category() function from includes/boxes/categories.php.
  15. PM or email me your code for that file and I will take a look at it.
  16. Make sure you have edited admin/includes/boxes/catalog.php.
  17. Revisit the install instructions for admin/includes/boxes/catalog.php. You're probably just missing the changes to that file.
  18. When you installed DCC, you probably overwrote some necessary code in includes/classes/order.php. Did you install manually or did you just upload the DCC files from the install zip? If you edited order.php manually, double-check against a backup to see if any of the option type feature code is missing. If you just uploaded the files from the install zip, then you've overwritten the code for the option type feature changes. You'll need to restore from backup and edit that file manually for DCC to get both installed. (I am making a guess that the conflict is in includes/classes/order.php. It is possible the conflict is actually elsewhere, but that's the most obvious place.)
  19. The files that changed in version 3.3 were includes/classes/order.php and includes/classes/discount_coupon.php. You can also check the install instructions for that version to get both a complete list of new files and a list of the changed files. If your installation still looks correct, see the manual for help on obtaining a debug output and send that to me via email or PM.
  20. Please revisit the install instructions, specifically the section on editing includes/database_tables.php.
  21. That's part of the difficulty with using any discounting scheme with osCommerce. It simply was not written with discounts in mind. So the contributions that apply discounts have to perform some twisted logic to get them to work. It also tends to interfere with other contributions that affect that part of the process. There's just no way around it, unfortunately. Discounts are actually a complicated beast in any cart/checkout software.
  22. This might fix it: includes/classes/order.php replace this: //kgt - discount coupon if( is_object( $this->coupon ) ) { $this->info['total'] = $this->coupon->finalize_discount( $this->info ); } //end kgt - discount coupon with this: //kgt - discount coupon if( is_object( $this->coupon ) ) { $this->info['total'] = $this->coupon->finalize_discount( $this->info ); if( $this->coupon->coupon['coupons_discount_type'] == 'shipping' ) $this->info['shipping_cost'] = $this->coupon->applied_discount['shipping']; } //end kgt - discount coupon CCGV might still try to integrate the discount into the subtotal, in which case you'll need to add: if( $this->coupon->coupon['coupons_discount_type'] != 'shipping' ) right before the $this->info['total'] = $this->coupon->finalize_discount( $this->info ); line.
  23. My guess is that the root of the problem is due to a conflict between how DCC and CCGV work. CCGV and DCC apply discounts at different points in the process, which is one of the reasons I developed DCC. I had a customer with taxable and non-taxable items and needed a discount to be applied to each item. CCGV, as I last looked at it, applies discounts to the subtotal. That works fine, and is more accurate for many people, especially if you tend to have carts with large numbers of items. Depending on how it's configured, CCGV will completely recalculate all order totals if it's set to do so. Check that module setting first, and see if toggling that makes a difference. I suspect the cause is thus: DCC applies the discount in the order class (includes/classes/order.php) CCGV applies the discount in the order total module DCC happens before CCGV. CCGV pulls the order total from the order class (which has the DCC discount applied) and recalculates tax and shipping and subtracts the CCGV discount. So CCGV is seeing the shipping discount already applied, and just integrating that discount into the subtotal.
  24. Discount Coupon Codes version 3.3 has been uploaded Bug Fixes: Fixed bug that caused subtotal to be incorrect when products with more than 1 quantity are in cart. This is a full package. Upgrade instructions assume version 3.2 is installed.
  25. Can you PM or email me some debug output for this? Make sure you use a CA shipping address when you checkout. See the manual for help on getting debug output.
×