infini Posted May 16, 2007 Share Posted May 16, 2007 The checkout_process.php page <?php include('includes/application_top.php'); // if the customer is not logged on, redirect them to the login page if (!tep_session_is_registered('customer_id')) { $navigation->set_snapshot(array('mode' => 'SSL', 'page' => FILENAME_CHECKOUT_PAYMENT)); tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); } if (!tep_session_is_registered('sendto')) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')); } if ( (tep_not_null(MODULE_PAYMENT_INSTALLED)) && (!tep_session_is_registered('payment')) ) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')); } // avoid hack attempts during the checkout procedure by checking the internal cartID if (isset($cart->cartID) && tep_session_is_registered('cartID')) { if ($cart->cartID != $cartID) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')); } } include(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_PROCESS); // load selected payment module require(DIR_WS_CLASSES . 'payment.php'); $payment_modules = new payment($payment); // load the selected shipping module require(DIR_WS_CLASSES . 'shipping.php'); $shipping_modules = new shipping($shipping); require(DIR_WS_CLASSES . 'order.php'); $order = new order; // load the before_process function from the payment modules $payment_modules->before_process(); require(DIR_WS_CLASSES . 'order_total.php'); $order_total_modules = new order_total; $order_totals = $order_total_modules->process(); // ------------------------------------------------------------------------------------------ // OrderCheck // test last orders_id $_oders_max_query = tep_db_query("select max(orders_id) as max_id from " . TABLE_ORDERS . ""); $_oders_max = tep_db_fetch_array($_oders_max_query); $_orders_id = $_oders_max["max_id"]; // test last holding_orders_id $holding_oders_max_query = tep_db_query("select max(orders_id) as max_id from " . TABLE_HOLDING_ORDERS . ""); $holding_oders_max = tep_db_fetch_array($holding_oders_max_query); $holding_insert_id = $holding_oders_max["max_id"]; // assign last orders_in to prevent duplicate entry $insert_id = ($_orders_id >= $holding_insert_id )? $_orders_id+1 : $holding_insert_id ; // ------------------------------------------------------------------------------------------ // OrderCheck // Added 'orders_id' => $insert_id, to the list below $sql_data_array = array('orders_id' => $insert_id, 'customers_id' => $customer_id, 'customers_name' => $order->customer['firstname'] . ' ' . $order->customer['lastname'], 'customers_company' => $order->customer['company'], 'customers_street_address' => $order->customer['street_address'], 'customers_suburb' => $order->customer['suburb'], 'customers_city' => $order->customer['city'], 'customers_postcode' => $order->customer['postcode'], 'customers_state' => $order->customer['state'], 'customers_country' => $order->customer['country']['title'], 'customers_telephone' => $order->customer['telephone'], 'customers_email_address' => $order->customer['email_address'], 'customers_address_format_id' => $order->customer['format_id'], 'delivery_name' => $order->delivery['firstname'] . ' ' . $order->delivery['lastname'], 'delivery_company' => $order->delivery['company'], 'delivery_street_address' => $order->delivery['street_address'], 'delivery_suburb' => $order->delivery['suburb'], 'delivery_city' => $order->delivery['city'], 'delivery_postcode' => $order->delivery['postcode'], 'delivery_state' => $order->delivery['state'], 'delivery_country' => $order->delivery['country']['title'], 'delivery_address_format_id' => $order->delivery['format_id'], 'billing_name' => $order->billing['firstname'] . ' ' . $order->billing['lastname'], 'billing_company' => $order->billing['company'], 'billing_street_address' => $order->billing['street_address'], 'billing_suburb' => $order->billing['suburb'], 'billing_city' => $order->billing['city'], 'billing_postcode' => $order->billing['postcode'], 'billing_state' => $order->billing['state'], 'billing_country' => $order->billing['country']['title'], 'billing_address_format_id' => $order->billing['format_id'], 'payment_method' => $order->info['payment_method'], 'cc_type' => $order->info['cc_type'], 'cc_owner' => $order->info['cc_owner'], 'cc_number' => $order->info['cc_number'], 'cc_expires' => $order->info['cc_expires'], 'date_purchased' => 'now()', 'orders_status' => $order->info['order_status'], 'currency' => $order->info['currency'], 'currency_value' => $order->info['currency_value']); tep_db_perform(TABLE_ORDERS, $sql_data_array); // ------------------------------------------------------------------------------------------ // OrderCheck // commented out the line below // $insert_id = tep_db_insert_id(); for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) { $sql_data_array = array('orders_id' => $insert_id, 'title' => $order_totals[$i]['title'], 'text' => $order_totals[$i]['text'], 'value' => $order_totals[$i]['value'], 'class' => $order_totals[$i]['code'], 'sort_order' => $order_totals[$i]['sort_order']); tep_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array); } $customer_notification = (SEND_EMAILS == 'true') ? '1' : '0'; $sql_data_array = array('orders_id' => $insert_id, 'orders_status_id' => $order->info['order_status'], 'date_added' => 'now()', 'customer_notified' => $customer_notification, 'comments' => $order->info['comments']); tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array); //kgt - discount coupons if( tep_session_is_registered( 'coupon' ) && is_object( $order->coupon ) ) { $sql_data_array = array( 'coupons_id' => $order->coupon->coupon['coupons_id'], 'orders_id' => $insert_id ); tep_db_perform( TABLE_DISCOUNT_COUPONS_TO_ORDERS, $sql_data_array ); } //end kgt - discount coupons // initialized for the email confirmation $products_ordered = ''; $subtotal = 0; $total_tax = 0; for ($i=0, $n=sizeof($order->products); $i<$n; $i++) { // Stock Update - Joao Correia if (STOCK_LIMITED == 'true') { if (DOWNLOAD_ENABLED == 'true') { $stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename FROM " . TABLE_PRODUCTS . " p LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES . " pa ON p.products_id=pa.products_id LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad ON pa.products_attributes_id=pad.products_attributes_id WHERE p.products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"; // Will work with only one option for downloadable products // otherwise, we have to build the query dynamically with a loop $products_attributes = $order->products[$i]['attributes']; if (is_array($products_attributes)) { $stock_query_raw .= " AND pa.options_id = '" . $products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . $products_attributes[0]['value_id'] . "'"; } $stock_query = tep_db_query($stock_query_raw); } else { $stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); } if (tep_db_num_rows($stock_query) > 0) { $stock_values = tep_db_fetch_array($stock_query); // do not decrement quantities if products_attributes_filename exists if ((DOWNLOAD_ENABLED != 'true') || (!$stock_values['products_attributes_filename'])) { $stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty']; } else { $stock_left = $stock_values['products_quantity']; } tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); if ( ($stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false') ) { tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); } } } // Update products_ordered (for bestsellers list) tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); $sql_data_array = array('orders_id' => $insert_id, 'products_id' => tep_get_prid($order->products[$i]['id']), 'products_model' => $order->products[$i]['model'], 'products_name' => $order->products[$i]['name'], 'products_price' => $order->products[$i]['price'], 'final_price' => $order->products[$i]['final_price'], 'products_tax' => $order->products[$i]['tax'], 'products_quantity' => $order->products[$i]['qty']); tep_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array); $order_products_id = tep_db_insert_id(); //------insert customer choosen option to order-------- $attributes_exist = '0'; $products_ordered_attributes = ''; if (isset($order->products[$i]['attributes'])) { $attributes_exist = '1'; for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) { if (DOWNLOAD_ENABLED == 'true') { $attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad on pa.products_attributes_id=pad.products_attributes_id where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'"; $attributes = tep_db_query($attributes_query); } else { $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'"); } $attributes_values = tep_db_fetch_array($attributes); $sql_data_array = array('orders_id' => $insert_id, 'orders_products_id' => $order_products_id, 'products_options' => $attributes_values['products_options_name'], 'products_options_values' => $attributes_values['products_options_values_name'], 'options_values_price' => $attributes_values['options_values_price'], 'price_prefix' => $attributes_values['price_prefix']); tep_db_perform(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array); if ((DOWNLOAD_ENABLED == 'true') && isset($attributes_values['products_attributes_filename']) && tep_not_null($attributes_values['products_attributes_filename'])) { $sql_data_array = array('orders_id' => $insert_id, 'orders_products_id' => $order_products_id, 'orders_products_filename' => $attributes_values['products_attributes_filename'], 'download_maxdays' => $attributes_values['products_attributes_maxdays'], 'download_count' => $attributes_values['products_attributes_maxcount']); tep_db_perform(TABLE_ORDERS_PRODUCTS_DOWNLOAD, $sql_data_array); } $products_ordered_attributes .= "\n\t" . $attributes_values['products_options_name'] . ' ' . $attributes_values['products_options_values_name']; } } //------insert customer choosen option eof ---- $total_weight += ($order->products[$i]['qty'] * $order->products[$i]['weight']); $total_tax += tep_calculate_tax($total_products_price, $products_tax) * $order->products[$i]['qty']; $total_cost += $total_products_price; $products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n"; } // lets start with the email confirmation $email_order = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n"; if ($order->info['comments']) { $email_order .= tep_db_output($order->info['comments']) . "\n\n"; } $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . EMAIL_SEPARATOR . "\n" . $products_ordered . EMAIL_SEPARATOR . "\n"; for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) { $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n"; } if ($order->content_type != 'virtual') { $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n"; } $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n"; if (is_object($$payment)) { $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . EMAIL_SEPARATOR . "\n"; $payment_class = $$payment; $email_order .= $payment_class->title . "\n\n"; if ($payment_class->email_footer) { $email_order .= $payment_class->email_footer . "\n\n"; } } tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); // send emails to other people if (SEND_EXTRA_ORDER_EMAILS_TO != '') { tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); } // load the after_process function from the payment modules $payment_modules->after_process(); $cart->reset(true); // unregister session variables used during checkout tep_session_unregister('sendto'); tep_session_unregister('billto'); tep_session_unregister('shipping'); tep_session_unregister('payment'); tep_session_unregister('comments'); //kgt - discount coupons tep_session_unregister('coupon'); //end kgt - discount coupons tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL')); require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> Quote Link to comment Share on other sites More sharing options...
kgt Posted May 16, 2007 Author Share Posted May 16, 2007 Here the list of the contributions installed: - Automatic remove button in shopping cart = http://www.oscommerce.com/community/contributions,3326 - Login box V5.4 = http://www.oscommerce.com/community/contributions,2058 - Anti Robot Registration Validation 1.0 + images = http://www.oscommerce.com/community/contributions,1237/ - Colissimo (French Post) = http://www.oscommerce.com/community/contri...earch,Colissimo - New Customer Emails v1.0 = http://www.oscommerce.com/community/contributions,2001/ - PDF Invoice = http://www.oscommerce.com/community/contributions,3027/ - fast easy checkout = http://www.oscommerce.com/community/contributions,3469 - Ultimate SEO URLs = http://www.oscommerce.com/community/contri...timate+seo+urls - Previous - Next - With detailed info = http://www.oscommerce.com/community/contributions,1164/ - customers stats orders = http://www.oscommerce.com/community/contributions,2983/ - AJAX Attribute Manager = http://www.oscommerce.com/community/contributions,4063 - OrderCheck = http://www.oscommerce.com/community/contributions,1168 I hope that that will be able to contribute to the resolution of my problem. I would be disappointed not to be able to use your contribution. Where necessary I can provide you by email an access to the site with a login and a password to carry out tests. Thank you for your assistance Please email me the code you have for checkout_process.php and checkout_confirmation.php. Fast easy checkout might be causing the problem. I recall someone else who ran into an issue who was using FEC, but I can't remember off the top of my head why. Quote Contributions Discount Coupon Codes Donations Link to comment Share on other sites More sharing options...
Micke Posted May 16, 2007 Share Posted May 16, 2007 For those of you also running Separate Pricing Per Customer on your store, I've just uploaded an Add-On to Discount Coupon Codes v3 to allow you to exclude customer groups from using coupons :thumbsup: Hi All! I'm almost done installing this add-on. I have a problem running the SQL. CREATE TABLE `discount_coupons_to_customer_groups` ( `coupons_id` VARCHAR( 33 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL , `customers_group_id` VARCHAR( 11 ) NOT NULL , PRIMARY KEY (`coupons_id`,`customers_group_id`) ) ENGINE = MYISAM When I try I get this message back from phpMyAdmin: #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 'COLLATE latin1_swedish_ci NOT NULL , `customers_group_id` VARC Why does that happen? Is there a way around it? //Micke Quote Link to comment Share on other sites More sharing options...
Micke Posted May 17, 2007 Share Posted May 17, 2007 Hi All! This works: CREATE TABLE IF NOT EXISTS discount_coupons_to_customer_groups ( coupons_id VARCHAR(33) NOT NULL DEFAULT '', customers_group_id INT(11) NOT NULL DEFAULT '0', PRIMARY KEY (coupons_id,customers_group_id) ); //Micke Quote Link to comment Share on other sites More sharing options...
infini Posted May 17, 2007 Share Posted May 17, 2007 kgt I removed FEC and installed V3 and both patchs according to. I have two problems: The VAT is not applied to the line of the coupon. When I indicate 10%, it is posted 1000% Thank you for your assistance Quote Link to comment Share on other sites More sharing options...
kgt Posted May 17, 2007 Author Share Posted May 17, 2007 kgt I removed FEC and installed V3 and both patchs according to. I have two problems: The VAT is not applied to the line of the coupon. When I indicate 10%, it is posted 1000% Thank you for your assistance I'm not sure what this means: "The VAT is not applied to the line of the coupon." Please read the manual describing how to actually use the coupons. There is a link to it on the coupons admin page. Quote Contributions Discount Coupon Codes Donations Link to comment Share on other sites More sharing options...
infini Posted May 17, 2007 Share Posted May 17, 2007 I'm not sure what this means: "The VAT is not applied to the line of the coupon." Please read the manual describing how to actually use the coupons. There is a link to it on the coupons admin page. The tax is not applied to the line of the coupon in the module order_total Quote Link to comment Share on other sites More sharing options...
kgt Posted May 17, 2007 Author Share Posted May 17, 2007 The tax is not applied to the line of the coupon in the module order_total You must show me an example of what you're getting and what you expect. One does not normally apply tax to an order total line, so I suspect what you're really looking for is something else. Quote Contributions Discount Coupon Codes Donations Link to comment Share on other sites More sharing options...
infini Posted May 17, 2007 Share Posted May 17, 2007 You must show me an example of what you're getting and what you expect. One does not normally apply tax to an order total line, so I suspect what you're really looking for is something else. Produits 1 x Fée Chataigne 42.50 € 1 x Champi 19.00 € -------------------------------------------------------------------------------- Discount Coupon 07NZ9M applied : -15.00 Sous-total TTC : 43.56 € dont TVA 19.6% : 7.14 € Colissimo suivi (1.15 kg) : 7.20 € Total TTC : 50.76 € 42.50 + 19 = 61.5 61.5 - 15 = 46.50 but the subtotal = 43.56 43.56 = 61.50 - (15 + (15 * 19.6/100)) 19.6% = French tax I suppose that the line does not take account of the tax in the module ot_discount_coupon 'text' => $display_type.$currencies->format( $discount, true, $order->info['currency'], $order->info['currency_value'] ), Quote Link to comment Share on other sites More sharing options...
infini Posted May 17, 2007 Share Posted May 17, 2007 You must show me an example of what you're getting and what you expect. One does not normally apply tax to an order total line, so I suspect what you're really looking for is something else. Produits 1 x Fée Chataigne 42.50 € 1 x Champi 19.00 € -------------------------------------------------------------------------------- Discount Coupon 07NZ9M applied : -15.00 Sous-total TTC : 43.56 € dont TVA 19.6% : 7.14 € Colissimo suivi (1.15 kg) : 7.20 € Total TTC : 50.76 € 42.50 + 19 = 61.5 61.5 - 15 = 46.50 but the subtotal = 43.56 43.56 = 61.50 - (15 + (15 * 19.6/100)) 19.6% = French tax I suppose that the line does not take account of the tax in the module ot_discount_coupon 'text' => $display_type.$currencies->format( $discount, true, $order->info['currency'], $order->info['currency_value'] ), Quote Link to comment Share on other sites More sharing options...
infini Posted May 17, 2007 Share Posted May 17, 2007 (edited) In V2 with this code in ot_discount_coupons.php function process() { global $order, $currencies; if( tep_not_null( $order->info['coupon'] ) ) { $this->coupon = new discount_coupon( $order->info['coupon'] ); //print_r( $order ); //kgt - use this to debug order object contents //print_r( $this->coupon ); //kgt - use this to debug coupon object contents //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 = array( array_sum( $order->info['applied_discount'] ) ); else $discount = $order->info['applied_discount']; foreach( $discount as $key => $value ) { if ($value > 0) { $display_type = ( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_TYPE == 'true' ? '-' : '' ); $this->output[] = array('title' => $this->format_display( $order->info['coupon'], $key ) . ' TTC : ', 'text' => $display_type.$currencies->format( $value, true, $order->info['currency'], $order->info['currency_value'] ) . ' €', 'value' => $display_type.$value); } } } else $this->enabled = false; } the posted amount did not add an additional taxe Produits 1 x Fée Chataigne 42.50 € 1 x Champi 19.00 € -------------------------------------------------------------------------------- Discount Coupon 07NZ9M applied : -15.00 € Sous-total TTC : 46.50 € dont TVA 19.6% : 7.14 € Colissimo suivi (1.15 kg) : 7.20 € Total TTC : 53.70 € Edited May 17, 2007 by infini Quote Link to comment Share on other sites More sharing options...
kgt Posted May 17, 2007 Author Share Posted May 17, 2007 In V2 with this code in ot_discount_coupons.phpthe posted amount did not add an additional taxe Is this for a fixed or percentage discount? Quote Contributions Discount Coupon Codes Donations Link to comment Share on other sites More sharing options...
kgt Posted May 17, 2007 Author Share Posted May 17, 2007 In V2 with this code in ot_discount_coupons.phpthe posted amount did not add an additional taxe Is this for a fixed or percentage discount? Quote Contributions Discount Coupon Codes Donations Link to comment Share on other sites More sharing options...
infini Posted May 17, 2007 Share Posted May 17, 2007 (edited) Is this for a fixed or percentage discount? No, for a fixed amount For the percentage if I seized 10%, it post 1000%. It is another problem :-) Edited May 17, 2007 by infini Quote Link to comment Share on other sites More sharing options...
kgt Posted May 17, 2007 Author Share Posted May 17, 2007 No, for a fixed amount Please turn on debugging and send me the debugging output. See the manual for help on how to do that. Quote Contributions Discount Coupon Codes Donations Link to comment Share on other sites More sharing options...
infini Posted May 17, 2007 Share Posted May 17, 2007 (edited) Please turn on debugging and send me the debugging output. See the manual for help on how to do that. <!-- Discount Coupons DEBUG order Object ( [info] => Array ( [order_status] => 1 [currency] => EUR [currency_value] => 1.00000000 [payment_method] => Chèque [cc_type] => [cc_owner] => [cc_number] => [cc_expires] => [shipping_method] => Colissimo suivi (1.15 kg) [shipping_cost] => 7.2 [subtotal] => 43.559 [tax] => 7.1384314381271 [tax_groups] => Array ( [dont TVA 19.6%] => 7.1384314381271 ) [coupon] => 2HBFHN [applied_discount] => Array ( ) [comments] => [total] => 50.759 ) [totals] => Array ( ) [products] => Array ( [0] => Array ( [qty] => 1 [name] => Fée Chataigne [model] => FIGB001chata [tax] => 19.6 [tax_description] => dont TVA 19.6% [price] => 35.5351 [final_price] => 35.5351 [weight] => 0.20 [id] => 479 ) [1] => Array ( [qty] => 1 [name] => Champi [model] => CHAMPI [tax] => 19.6 [tax_description] => dont TVA 19.6% [price] => 15.8863 [final_price] => 15.8863 [weight] => 0.45 [id] => 60 ) ) [customer] => Array ( [firstname] => xxxxxxx [lastname] => xxxxx [company] => [street_address] => xxxxxxxxxx [suburb] => [city] => xxxxxxxxx [postcode] => xxxxxxx [state] => [zone_id] => 0 [country] => Array ( [id] => 73 [title] => France [iso_code_2] => FR [iso_code_3] => FRA ) [format_id] => 1 [telephone] => xxxxxxxxxxxxx [email_address] => xxxxxxxxxxx ) [delivery] => Array ( [firstname] => xxxxxxxxxx [lastname] => xxxxxxxxxx [company] => [street_address] => xxxxxxxxxxxxxxx [suburb] => [city] => xxxxxxxxxxxxxxx [postcode] => xxxxxxxxxxxxx [state] => [zone_id] => 0 [country] => Array ( [id] => 73 [title] => France [iso_code_2] => FR [iso_code_3] => FRA ) [country_id] => 73 [format_id] => 1 ) [content_type] => physical [billing] => Array ( [firstname] => xxxxxxxxxx [lastname] => xxxxxxxxxxxx [company] => [street_address] => xxxxxxxxxxxxxxx [suburb] => [city] => xxxxxxxxxxxxxxxx [postcode] => xxxxxxxxx [state] => [zone_id] => 0 [country] => Array ( [id] => 73 [title] => France [iso_code_2] => FR [iso_code_3] => FRA ) [country_id] => 73 [format_id] => 1 ) [coupon] => discount_coupon Object ( [messages] => Array ( [debug] => Array ( [0] => INFO: MODULE_ORDER_TOTAL_DISCOUNT_COUPON_USE_LANGUAGE_FILE = false [1] => INFO: MODULE_ORDER_TOTAL_DISCOUNT_COUPON_ALLOW_NEGATIVE = false [2] => INFO: MODULE_ORDER_TOTAL_DISCOUNT_COUPON_RANDOM_CODE_LENGTH = 6 [3] => INFO: MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_LINES = true [4] => INFO: MODULE_ORDER_TOTAL_DISCOUNT_COUPON_EXCLUDE_SPECIALS = true [5] => INFO: MODULE_ORDER_TOTAL_DISCOUNT_COUPON_SORT_ORDER = 1 [6] => INFO: MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_TYPE = true [7] => INFO: MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_SUBTOTAL = true [8] => INFO: MODULE_ORDER_TOTAL_DISCOUNT_COUPON_STATUS = true [9] => INFO: MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_CONFIG = Discount Coupon applied [10] => INFO: MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DEBUG = true [11] => INFO: Percentage of discount applied to product 479: 0.29170734363514. [12] => INFO: Fixed discount applied to product 479: 10.365849626809. [13] => INFO: Product 479 passed exclusion check. Discount 10.365849626809 applied. (fixed) [14] => INFO: Discount of 10.365849626809 applied to product 479 ($35.5351). [15] => INFO: Applied tax of 19.6 to: 30.102 [16] => INFO: Calculating tax on 30.102. Displayed price 30.102. [17] => INFO: Percentage of discount applied to product 60: 0.29170734363514. [18] => INFO: Fixed discount applied to product 60: 4.6341503731909. [19] => INFO: Product 60 passed exclusion check. Discount 4.6341503731909 applied. (fixed) [20] => INFO: Discount of 4.6341503731909 applied to product 60 ($15.8863). [21] => INFO: Applied tax of 19.6 to: 13.457 [22] => INFO: Calculating tax on 13.457. Displayed price 13.457. ) ) [coupon] => Array ( [coupons_id] => 2HBFHN [coupons_description] => [coupons_discount_amount] => 15.000000000000 [coupons_discount_type] => fixed [coupons_date_start] => 2007-05-01 00:00:00 [coupons_date_end] => 2007-05-31 00:00:00 [coupons_max_use] => 1 [coupons_min_order] => 0.0000 [coupons_min_order_type] => price [coupons_number_available] => 0 ) [applied_discount] => Array ( [dont TVA 19.6%] => 15 ) [cart_info] => Array ( [valid_products] => Array ( [count] => 2 [line_items] => 2 [total] => 51.4214 ) [total_products] => Array ( [count] => 2 [line_items] => 2 [total] => 51.4214 ) [exclusions] => Array ( [categories] => Array ( ) [products] => Array ( ) [manufacturers] => Array ( ) ) ) ) ) End Discount Coupons DEBUG--> Edited May 17, 2007 by infini Quote Link to comment Share on other sites More sharing options...
infini Posted May 17, 2007 Share Posted May 17, 2007 The probleme is the same with purcentage Quote Link to comment Share on other sites More sharing options...
kgt Posted May 17, 2007 Author Share Posted May 17, 2007 The probleme is the same with purcentage It's not a problem. The calculations are correct. You have your store set to display products with tax applied. Discounts happen BEFORE tax. So you cannot just add up your product prices with tax applied and subtract the discount. 1 x Prod 1: 35.5351 (without tax) 1 x Prod 2: 15.8863 (without tax) Subtotal: 51.4214 (without tax) Discount: -15 (without tax) -------- 36.4214 (without tax) x 1.196 (tax) -------- 43.56 (subtotal with discount and tax applied) + 7.20 (shipping) -------- 50.76 (total) Quote Contributions Discount Coupon Codes Donations Link to comment Share on other sites More sharing options...
infini Posted May 17, 2007 Share Posted May 17, 2007 It's not a problem. The calculations are correct. You have your store set to display products with tax applied. Discounts happen BEFORE tax. So you cannot just add up your product prices with tax applied and subtract the discount. 1 x Prod 1: 35.5351 (without tax) 1 x Prod 2: 15.8863 (without tax) Subtotal: 51.4214 (without tax) Discount: -15 (without tax) -------- 36.4214 (without tax) x 1.196 (tax) -------- 43.56 (subtotal with discount and tax applied) + 7.20 (shipping) -------- 50.76 (total) Thank you for your detail I ensure you that with V2 I had 61.50 - 15 = 46.50 (tax included) whereas with V3 I have 61.50 - 15 = 43.56 (tax included) I want almost to reinstall V2 to confirm my remarks : -) Quote Link to comment Share on other sites More sharing options...
kgt Posted May 17, 2007 Author Share Posted May 17, 2007 Thank you for your detail I ensure you that with V2 I had 61.50 - 15 = 46.50 (tax included) whereas with V3 I have 61.50 - 15 = 43.56 (tax included) I want almost to reinstall V2 to confirm my remarks : -) That might be the case. If so, it was wrong. ;) This contribution was always written with the intention of applying discounts before tax. Quote Contributions Discount Coupon Codes Donations Link to comment Share on other sites More sharing options...
imagixx Posted May 17, 2007 Share Posted May 17, 2007 A great contrib! Any idea what I would add to CRE Loaded's Google Checkout contrib to get the coupon discount to carry forward to Google Checkout? Quote Link to comment Share on other sites More sharing options...
kgt Posted May 17, 2007 Author Share Posted May 17, 2007 A great contrib! Any idea what I would add to CRE Loaded's Google Checkout contrib to get the coupon discount to carry forward to Google Checkout? I'm totally unfamiliar with Google Checkout, so I really don't know. Many payment processors don't have the ability to accept discount lines. This is a common complaint for those using Paypal, for example. To get any discounts using Paypal, you must use their aggregate order total rather than the itemized. Google may have a similar feature. Quote Contributions Discount Coupon Codes Donations Link to comment Share on other sites More sharing options...
imagixx Posted May 18, 2007 Share Posted May 18, 2007 I'm totally unfamiliar with Google Checkout, so I really don't know. Many payment processors don't have the ability to accept discount lines. This is a common complaint for those using Paypal, for example. To get any discounts using Paypal, you must use their aggregate order total rather than the itemized. Google may have a similar feature. Google will accept a discount. Here's the download: http://www.websitetemplatedesign.com/suppo...id=31&nav=0 I could jusyt get by crediting (refunding) the appropriate amount. I'm sure you have too much on your plate. Thanx, Matin Quote Link to comment Share on other sites More sharing options...
kgt Posted May 18, 2007 Author Share Posted May 18, 2007 Google will accept a discount. Here's the download: http://www.websitetemplatedesign.com/suppo...id=31&nav=0 I could jusyt get by crediting (refunding) the appropriate amount. I'm sure you have too much on your plate. Thanx, Matin Try changing line 211 if includes/modules/google.php from this: if ($value == 'ot_coupon.php' || $value == 'ot_gv.php') { to this: if ($value == 'ot_discount_coupon.php' || $value == 'ot_coupon.php' || $value == 'ot_gv.php') { Quote Contributions Discount Coupon Codes Donations Link to comment Share on other sites More sharing options...
madcrazygirl Posted May 18, 2007 Share Posted May 18, 2007 Thanks for this suggestion kgt as I too want this to work with the google checkout ipn contribution. At present google just ignores the coupon. I tried this but then it returned an error in the file when reaching the google site. 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.