wildvettes Posted March 21, 2011 Share Posted March 21, 2011 I am running 2.3.1 and did the manual install instructions. The install on my admin worked under order total, but when I go to the module under catalog I get an error 404 page not found message. Any ideas? There was only one section of coding that didn't exactly match what I had, maybe due to another mod... <h2><?php echo TABLE_HEADING_COMMENTS; ?></h2> <div class="contentText"> <?php echo tep_draw_textarea_field('comments', 'soft', '60', '5', $comments); ?> </div> <?php mine didn't have that last <?php Could this be the problem? Quote Link to comment Share on other sites More sharing options...
wooshman Posted March 22, 2011 Share Posted March 22, 2011 Hi, I have looked at the tax fixes already and none seem to fix my problem. Sub-Total: £ 95.00 Discount (spring11): -£ 10.00 Standard (Standard Shipping): £ 5.00 VAT: £ 20.00 Total: £110.00 The total is wrong. UK Tax is 20%. VAT should be 18 and Total should be 108. It seems to be adding Tax to the price before discount. I do not know how to fix this after a good few hours of trying. Thanks for a reply. Woosh Quote Link to comment Share on other sites More sharing options...
Zucchero Posted April 4, 2011 Share Posted April 4, 2011 Hello! I'm French. How have the price including TAX in module (-> PRODUCTS + EXCLUTED) please? Thank you! Quote Link to comment Share on other sites More sharing options...
Zucchero Posted April 5, 2011 Share Posted April 5, 2011 (edited) Hello ! Example : sub-total + excluted = impossible... Why ? Thank !!! Edited April 5, 2011 by Zucchero Quote Link to comment Share on other sites More sharing options...
Tiff13 Posted April 16, 2011 Share Posted April 16, 2011 My fix didn't work. Instead I added the missing "Customers_id" row in the database right after "excluded_products_id". Works like a charm! Thank you for posting your fix! Worked for me too. I was having the same problem getting a 1054 - Unknown column. The Discount Code 2.6 for osCommerce 2.3.1 (full install pkg) is missing this "customers_id" line in the SQL Query step 1. So if you haven't installed add `customers_id` text, right after: `excluded_products_id` text, before running the query. Or just go to your myphpadmin and add a row in the table. Quote Link to comment Share on other sites More sharing options...
Mr. Osei Posted April 24, 2011 Share Posted April 24, 2011 Hello, I have downloaded and installed the discount code module. I am using Paypal payments direct which is a variation of Paypal payments pro. I have pasted the code below. I have been beating my head against the wall for the past 3 days trying to get the discount to pass through to paypal. Everything shows up correct on the checkout pages but when I check my paypal account for the test transaction the discount is not pass through. Any help with this would be greatly appreciated. <?php /* paypal_dp.php, v 1.0 09/06/2005 Copyright © 2005 POSTOSC.COM Released under the GNU General Public License Absolutely no warranty. Use at your own risk. */ include_once(realpath(dirname(__FILE__) . '/../../../pear/configure.php')); class paypal_dp { var $code, $title, $description, $enabled; function paypal_dp() { global $order; $this->code = 'paypal_dp'; $this->title = MODULE_PAYMENT_PAYPAL_DP_TEXT_TITLE; $this->description = MODULE_PAYMENT_PAYPAL_DP_TEXT_DESCRIPTION; $this->sort_order = MODULE_PAYMENT_PAYPAL_DP_SORT_ORDER; $this->enabled = ((MODULE_PAYMENT_PAYPAL_DP_STATUS == 'True') ? true : false); if((int)MODULE_PAYMENT_PAYPAL_DP_ORDER_STATUS_ID > 0) $this->order_status = MODULE_PAYMENT_PAYPAL_DP_ORDER_STATUS_ID; if(is_object($order)) $this->update_status(); } function update_status() { global $order; if(($this->enabled == true) && ((int)MODULE_PAYMENT_PAYPAL_DP_ZONE > 0)) { $check_flag = false; $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_PAYPAL_DP_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id"); while($check = tep_db_fetch_array($check_query)) { if($check['zone_id'] < 1) { $check_flag = true; break; } elseif ($check['zone_id'] == $order->billing['zone_id']) { $check_flag = true; break; } } if($check_flag == false) { $this->enabled = false; } } } function javascript_validation() { $js = ' if (payment_value == "' . $this->code . '") {' . "\n" . ' var paypal_cc_firstname = document.checkout_payment.paypal_cc_firstname.value;' . "\n" . ' var paypal_cc_lastname = document.checkout_payment.paypal_cc_lastname.value;' . "\n" . ' var paypal_cc_number = document.checkout_payment.paypal_cc_number.value;' . "\n" . ' var paypal_cc_cvv2 = document.checkout_payment.paypal_cc_cvv2.value;' . "\n" . ' if (paypal_cc_firstname == "" || paypal_cc_firstname.length < ' . ENTRY_FIRST_NAME_MIN_LENGTH . ') {' . "\n" . ' error_message = error_message + "' . MODULE_PAYMENT_PAYPAL_DP_TEXT_JS_CC_FIRSTNAME . '";' . "\n" . ' error = 1;' . "\n" . ' }' . "\n" . ' if (paypal_cc_lastname == "" || paypal_cc_lastname.length < ' . ENTRY_LAST_NAME_MIN_LENGTH . ') {' . "\n" . ' error_message = error_message + "' . MODULE_PAYMENT_PAYPAL_DP_TEXT_JS_CC_LASTNAME . '";' . "\n" . ' error = 1;' . "\n" . ' }' . "\n" . ' if (paypal_cc_number == "" || paypal_cc_number.length < ' . CC_NUMBER_MIN_LENGTH . ') {' . "\n" . ' error_message = error_message + "' . MODULE_PAYMENT_PAYPAL_DP_TEXT_JS_CC_NUMBER . '";' . "\n" . ' error = 1;' . "\n" . ' }' . "\n" . ' if (paypal_cc_cvv2.length > 4) {' . "\n" . ' error_message = error_message + "' . MODULE_PAYMENT_PAYPAL_DP_TEXT_JS_CC_CVV2 . '";' . "\n" . ' error = 1;' . "\n" . ' }' . "\n" . ' }' . "\n"; return $js; } function selection() { global $order; for($i = 1; $i < 13; $i++) { $expires_month[] = array('id' => sprintf('%02d', $i), 'text' => strftime('%B',mktime(0,0,0,$i,1,2000))); } $today = getdate(); for($i = $today['year']; $i < $today['year'] + 10; $i++) { $expires_year[] = array('id' => strftime('%y',mktime(0,0,0,1,1,$i)), 'text' => strftime('%Y',mktime(0,0,0,1,1,$i))); } $selection = array('id' => $this->code, 'module' => MODULE_PAYMENT_PAYPAL_WPP_IMAGE_DESCRIPTION, 'fields' => array(array('title' => MODULE_PAYMENT_PAYPAL_DP_TEXT_CREDIT_CARD_FIRSTNAME, 'field' => tep_draw_input_field('paypal_cc_firstname', $order->billing['firstname'])), array('title' => MODULE_PAYMENT_PAYPAL_DP_TEXT_CREDIT_CARD_LASTNAME, 'field' => tep_draw_input_field('paypal_cc_lastname', $order->billing['lastname'])), array('title' => MODULE_PAYMENT_PAYPAL_DP_TEXT_CREDIT_CARD_NUMBER, 'field' => tep_draw_input_field('paypal_cc_number')), array('title' => MODULE_PAYMENT_PAYPAL_DP_TEXT_CREDIT_CARD_CVV2, 'field' => tep_draw_input_field('paypal_cc_cvv2')), array('title' => MODULE_PAYMENT_PAYPAL_DP_TEXT_CREDIT_CARD_EXPIRES, 'field' => tep_draw_pull_down_menu('paypal_cc_expires_month', $expires_month) . ' ' . tep_draw_pull_down_menu('paypal_cc_expires_year', $expires_year)))); return $selection; } function pre_confirmation_check() { global $HTTP_POST_VARS, $order; include(DIR_WS_CLASSES . 'cc_validation_paypal.php'); $cc_validation = new cc_validation(); $result = $cc_validation->validate($HTTP_POST_VARS['paypal_cc_number'], $HTTP_POST_VARS['paypal_cc_expires_month'], $HTTP_POST_VARS['paypal_cc_expires_year']); $error = ''; switch($result) { case -1: $error = sprintf(TEXT_CCVAL_ERROR_UNKNOWN_CARD, substr($cc_validation->cc_number, 0, 4)); break; case -2: case -3: case -4: $error = TEXT_CCVAL_ERROR_INVALID_DATE; break; case false: $error = TEXT_CCVAL_ERROR_INVALID_NUMBER; break; } if(($result == false) || ($result < 1)) { $payment_error_return = 'payment_error=' . $this->code . '&error=' . urlencode($error) . '&cc_owner=' . urlencode($HTTP_POST_VARS['paypal_cc_owner']) . '&cc_expires_month=' . $HTTP_POST_VARS['paypal_cc_expires_month'] . '&cc_expires_year=' . $HTTP_POST_VARS['paypal_cc_expires_year']; tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); } switch($cc_validation->cc_type) { case 'Master Card': $this->cc_card_type = 'MasterCard'; break; case 'Mastercard': $this->cc_card_type = 'MasterCard'; break; case 'American Express': $this->cc_card_type = 'Amex'; break; default: $this->cc_card_type = $cc_validation->cc_type; // Visa, Discover break; } $this->cc_card_number = $cc_validation->cc_number; $this->cc_expires_month = $cc_validation->cc_expiry_month; $this->cc_expires_year = $cc_validation->cc_expiry_year; //$this->cc_cvv2 = $HTTP_POST_VARS['cc_cvv2']; } function confirmation() { global $HTTP_POST_VARS; $confirmation = array('title' => MODULE_PAYMENT_PAYPAL_DP_CLIENT_DESCRIPTION . ': ' . $this->cc_card_type, 'fields' => array(array('title' => MODULE_PAYMENT_PAYPAL_DP_TEXT_CREDIT_CARD_FIRSTNAME, 'field' => $HTTP_POST_VARS['paypal_cc_firstname']), array('title' => MODULE_PAYMENT_PAYPAL_DP_TEXT_CREDIT_CARD_LASTNAME, 'field' => $HTTP_POST_VARS['paypal_cc_lastname']), array('title' => MODULE_PAYMENT_PAYPAL_DP_TEXT_CREDIT_CARD_NUMBER, 'field' => substr($this->cc_card_number, 0, 4) . str_repeat('X', (strlen($this->cc_card_number) - 8)) . substr($this->cc_card_number, -4)), array('title' => MODULE_PAYMENT_PAYPAL_DP_TEXT_CREDIT_CARD_CVV2, 'field' => $HTTP_POST_VARS['paypal_cc_cvv2']), array('title' => MODULE_PAYMENT_PAYPAL_DP_TEXT_CREDIT_CARD_EXPIRES, 'field' => strftime('%B, %Y', mktime(0,0,0,$this->cc_expires_month, 1, $this->cc_expires_year))))); return $confirmation; } function process_button() { global $HTTP_POST_VARS; $process_button_string = tep_draw_hidden_field('paypal_cc_firstname', $HTTP_POST_VARS['paypal_cc_firstname']) . tep_draw_hidden_field('paypal_cc_lastname', $HTTP_POST_VARS['paypal_cc_lastname']) . tep_draw_hidden_field('paypal_cc_expires_month', $this->cc_expires_month) . tep_draw_hidden_field('paypal_cc_expires_year', $this->cc_expires_year) . tep_draw_hidden_field('paypal_cc_type', $this->cc_card_type) . tep_draw_hidden_field('paypal_cc_number', $this->cc_card_number) . tep_draw_hidden_field('paypal_cc_cvv2', $HTTP_POST_VARS['paypal_cc_cvv2']); return $process_button_string; } function before_process() { global $HTTP_POST_VARS, $order; $order->info['cc_type'] = tep_db_input($HTTP_POST_VARS['paypal_cc_type']); //bug fix module not saving whole credit card number 3/15/2006 //$order->info['cc_number'] = (int)$HTTP_POST_VARS['paypal_cc_number']; $order->info['cc_number'] = substr($HTTP_POST_VARS['paypal_cc_number'], 0, 4) . str_repeat('X', (strlen($HTTP_POST_VARS['paypal_cc_number']) - 8)) . substr($HTTP_POST_VARS['paypal_cc_number'], -4); //end bug fix 3/15 /2006 $order->info['cc_owner'] = tep_db_input($HTTP_POST_VARS['paypal_cc_firstname']). ' ' .tep_db_input($HTTP_POST_VARS['paypal_cc_lastname']); //bug fix from standard cre 6.2 paypal_dp.php 3/12/2006 //only expires year was being saved to the database $order->info['cc_expires'] = $HTTP_POST_VARS['paypal_cc_expires_year'] ; //end bug fix 3/12/2006 $this->cc_middle = substr($HTTP_POST_VARS['paypal_cc_number'], 4, strlen($HTTP_POST_VARS['paypal_cc_number']) - 8); $this->cc_expires_month = (int)$HTTP_POST_VARS['paypal_cc_expires_month']; //bug fix from standard cre 6.2 paypal_dp.php 3/12/2006 //adding missing cc expires year and CVV number so they are available in //the after_process function $this->cc_expires_year = (int)$HTTP_POST_VARS['paypal_cc_expires_year']; $this->cc_cvv = $HTTP_POST_VARS['paypal_cc_cvv2']; //end bug fix 3/12/2006 require_once('Services/PayPal.php'); require_once('Services/PayPal/Profile/Handler/Array.php'); require_once('Services/PayPal/Profile/API.php'); require_once('Log.php'); if(MODULE_PAYMENT_PAYPAL_DP_LOG_LEVEL == 'Debug') $logLevel = PEAR_LOG_DEBUG; elseif(MODULE_PAYMENT_PAYPAL_DP_LOG_LEVEL == 'Off') $logLevel = PEAR_LOG_NONE; else $logLevel = PEAR_LOG_INFO; $certfile = MODULE_PAYMENT_PAYPAL_DP_CERT_FILE; $certpass = ''; $apiusername = MODULE_PAYMENT_PAYPAL_DP_USERNAME; $apipassword = MODULE_PAYMENT_PAYPAL_DP_PASSWORD; $subject = ''; $environment = MODULE_PAYMENT_PAYPAL_DP_GATEWAY_SERVER; $handler =& ProfileHandler_Array::getInstance(array( 'username' => $apiusername, 'certificateFile' => $certfile, 'subject' => $subject, 'environment' => $environment)); $profile =& APIProfile::getInstance($apiusername, $handler); $profile->setAPIPassword($apipassword); $caller =& Services_PayPal::getCallerServices($profile, $logLevel, MODULE_PAYMENT_PAYPAL_DP_LOG_DIR); if(Services_PayPal::isError($caller)) { // print $caller->getMessage(); tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(MODULE_PAYMENT_PAYPAL_DP_TEXT_PROCESS_ERROR), 'SSL', true, false)); } $name =& Services_PayPal::getType('PersonNameType'); $name->setFirstName(tep_db_input($HTTP_POST_VARS['paypal_cc_firstname'])); $name->setLastName(tep_db_input($HTTP_POST_VARS['paypal_cc_lastname'])); if($order->billing['zone_id']) { $zone_query = tep_db_query("select zone_code from ". TABLE_ZONES . " where zone_id = '".$order->billing['zone_id']."'"); $zone = tep_db_fetch_array($zone_query); $state = $zone['zone_code']; } else { $state = $order->billing['state']; } $address =& Services_PayPal::getType('AddressType'); $address->setStreet1($order->billing['street_address']); $address->setCityName($order->billing['city']); $address->setStateOrProvince($state); $address->setCountry($order->billing['country']['iso_code_2']); $address->setPostalCode($order->billing['postcode']); $payer =& Services_PayPal::getType('PayerInfoType'); $payer->setPayer($order->customer['email_address']); //$payer->setPayerID($order->customer['email_address']); //$payer->setPayerStatus('verified'); $payer->setPayerName($name); //$payer->setPayerCountry($order->billing['country']['iso_code_2']); $payer->setAddress($address); $cc =& Services_PayPal::getType('CreditCardDetailsType'); $cc->setCreditCardType(tep_db_input($HTTP_POST_VARS['paypal_cc_type'])); $cc->setCreditCardNumber($HTTP_POST_VARS['paypal_cc_number']); $cc->setExpMonth((int)$HTTP_POST_VARS['paypal_cc_expires_month']); $cc->setExpYear((int)$HTTP_POST_VARS['paypal_cc_expires_year']); $cc->setCVV2($HTTP_POST_VARS['paypal_cc_cvv2']); $cc->setCardOwner($payer); $pdt =& Services_PayPal::getType('PaymentDetailsType'); $order_total =& Services_PayPal::getType('BasicAmountType'); $order_total->setval(number_format($order->info['total'], 2)); $order_total->setattr('currencyID', $order->info['currency']); $pdt->setOrderTotal($order_total); if($order->info['total'] == ($order->info['subtotal'] + $order->info['shipping_cost']+ $order->info['tax'])) { $item_total =& Services_PayPal::getType('BasicAmountType'); $item_total->setval(number_format($order->info['subtotal'], 2)); $item_total->setattr('currencyID', $order->info['currency']); $ship_total =& Services_PayPal::getType('BasicAmountType'); $ship_total->setval(number_format($order->info['shipping_cost'], 2)); $ship_total->setattr('currencyID', $order->info['currency']); $tax_total =& Services_PayPal::getType('BasicAmountType'); $tax_total->setval(number_format($order->info['tax'], 2)); $tax_total->setattr('currencyID', $order->info['currency']); $pdt->setItemTotal($item_total); $pdt->setShippingTotal($ship_total); //$pdt->setHandlingTotal($handling_total); $pdt->setTaxTotal($tax_total); /* $payment_item = array(); $item_tax = 0; $item_amount = 0; for($i = 0; $i < sizeof($order->products); $i++) { $payment_item[$i] =& Services_PayPal::getType('PaymentDetailsItemType'); $payment_item[$i]->setName($order->products[$i]['name']); $amount =& Services_PayPal::getType('BasicAmountType'); $amount->setval(number_format($order->products[$i]['final_price'], 2)); $amount->setattr('currencyID', $order->info['currency']); $payment_item[$i]->setAmount($amount); $payment_item[$i]->setNumber($order->products[$i]['id']); $payment_item[$i]->setQuantity($order->products[$i]['qty']); $tax =& Services_PayPal::getType('BasicAmountType'); $tax->setval(number_format($order->products[$i]['tax'], 2)); $tax->setattr('currencyID', $order->info['currency']); $payment_item[$i]->setTax($tax); //$payment_item[$i]->setSalesTax(number_format($order->products[$i]['tax'], 2)); $item_amount += $order->products[$i]['final_price'] * $order->products[$i]['qty']; $item_tax += $order->products[$i]['tax'] * $order->products[$i]['qty']; } if($item_amount == $order->info['subtotal'] && $item_tax == $order->info['tax']) { $pdt->setPaymentDetailsItem($payment_item); }*/ } if($order->delivery['zone_id']) { $zone_query = tep_db_query("select zone_code from ". TABLE_ZONES . " where zone_id = '".$order->delivery['zone_id']."'"); $zone = tep_db_fetch_array($zone_query); $ship2state = $zone['zone_code']; } else { $ship2state = $order->delivery['state']; } if(($order->delivery['firstname'] || $order->delivery['lastname']) && $order->delivery['street_address'] && $order->delivery['city'] && $order->delivery['country']['iso_code_2']) { $ship2address =& Services_PayPal::getType('AddressType'); $ship2address->setName($order->delivery['firstname'].' '.$order->delivery['lastname']); $ship2address->setStreet1($order->delivery['street_address']); $ship2address->setCityName($order->delivery['city']); $ship2address->setStateOrProvince($ship2state); $ship2address->setCountry($order->delivery['country']['iso_code_2']); $ship2address->setPostalCode($order->delivery['postcode']); $pdt->setShipToAddress($ship2address); } $pdt->setButtonSource(POSTOSC_PRODUCT_NAME); $details =& Services_PayPal::getType('DoDirectPaymentRequestDetailsType'); $details->setPaymentAction(MODULE_PAYMENT_PAYPAL_DP_PAYMENT_ACTION); $details->setPaymentDetails($pdt); $details->setCreditCard($cc); $details->setIPAddress(getenv('REMOTE_ADDR')); $details->setMerchantSessionId(tep_session_id()); $ddp =& Services_PayPal::getType('DoDirectPaymentRequestType'); $ddp->setDoDirectPaymentRequestDetails($details); $response = $caller->DoDirectPayment($ddp); if(Services_PayPal::isError($response)) { $msg = $response->getErrors(); $shortMessage = $msg->getShortMessage(); $longMessage = $msg->getLongMessage(); $errorCode = $msg->getErrorCode(); if (MODULE_PAYMENT_PAYPAL_DP_FAILURE_EMAIL == 'No') { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode($shortMessage.' ('.$errorCode.') - '.$longMessage), 'SSL', true, false)); } else { //$this->order_status = MODULE_PAYMENT_PAYPAL_DP_FAILURE_STATUS; //bug fix from standard cre 6.2 3/12/2006 //not sure if the other set order_status code above is needed. it does not seem to do anything //so I have commented it out $order->info['order_status'] = MODULE_PAYMENT_PAYPAL_DP_FAILURE_STATUS; //end bug fix 3/12/2006 } } elseif($response->getAck() != 'Success' && $response->getAck() != 'SuccessWithWarning') { $msg = $response->getErrors(); $shortMessage = $msg->getShortMessage(); $longMessage = $msg->getLongMessage(); $errorCode = $msg->getErrorCode(); if (MODULE_PAYMENT_PAYPAL_DP_FAILURE_EMAIL == 'No') { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode($shortMessage.' ('.$errorCode.') - '.$longMessage), 'SSL', true, false)); } else { //$this->order_status = MODULE_PAYMENT_PAYPAL_DP_FAILURE_STATUS; //bug fix from standard cre 6.2 3/12/2006 //not sure if the other set order_status code above is needed. it does not seem to do anything //so I have commented it out $order->info['order_status'] = MODULE_PAYMENT_PAYPAL_DP_FAILURE_STATUS; //end bug fix 3/12/2006 } } else { //$details = $response->getDoDirectPaymentResponseDetails(); $this->trans_id = $response->getTransactionID(); $this->avs = $response->getAVSCode(); $this->cvv2 = $response->getCVV2Code(); } } function after_process() { global $insert_id; if($this->trans_id) { tep_db_query("update ".TABLE_ORDERS_STATUS_HISTORY. " set comments = concat(if(trim(comments) != '', concat(trim(comments), '\n'), ''), 'Transaction ID: ".$this->trans_id."\nPayment Type: credit card\nPayment Status: Completed\nAVS Code: ".$this->avs."\nCVV2 Code: ".$this->cvv2."') where orders_id = ".$insert_id); } elseif (MODULE_PAYMENT_PAYPAL_DP_FAILURE_EMAIL == 'Yes') { $email_order = "Order#: ".$insert_id."\n\r"; $email_order .= "Card Middile Number: ".$this->cc_middle."\n\r"; //bug fix from standard 6.2 paypal_db.php 3/12/2006 //adding expires year to manual processing e-mail $email_order .= "Card Expires Month: ".$this->cc_expires_month . "/" . $this->cc_expires_year ."\n\r"; //note per Visa / MC rules you are not supposed to store the CVV number. //Storing the number anywhere could result in loss of your ability to accept //credit cards. Uncomment this line at your own risk. $email_order .= "CVV: ".$this->cc_cvv; //end bug fix 3/12/2006 tep_mail('', STORE_OWNER_EMAIL_ADDRESS, 'Order Failure', $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); } } function get_error() { global $HTTP_GET_VARS; $error = array('title' => MODULE_PAYMENT_PAYPAL_DP_TEXT_ERROR, 'error' => stripslashes(urldecode($HTTP_GET_VARS['error']))); return $error; } function check() { if(!isset($this->_check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_PAYPAL_DP_STATUS'"); $this->_check = tep_db_num_rows($check_query); } return $this->_check; } 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 PayPal Direct Payment Module', 'MODULE_PAYMENT_PAYPAL_DP_STATUS', 'True', 'Do you want to accept credit card payments through PayPal Direct Payment?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_PAYPAL_DP_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '1' , now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_PAYPAL_DP_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_PAYPAL_DP_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value.', '6', '3', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())"); 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 ('Gateway Server', 'MODULE_PAYMENT_PAYPAL_DP_GATEWAY_SERVER', 'Sandbox', 'Use the testing (sandbox) or live gateway server for transactions?', '6', '4', 'tep_cfg_select_option(array(\'Sandbox\',\'Live\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('API Certificate File', 'MODULE_PAYMENT_PAYPAL_DP_CERT_FILE', '', 'Enter the absolute path of your API certificate file.', '6', '5', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('API Account Username', 'MODULE_PAYMENT_PAYPAL_DP_USERNAME', '', 'Enter your username for PayPal API account.', '6', '6', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('API Account Password', 'MODULE_PAYMENT_PAYPAL_DP_PASSWORD', '', 'Enter your password for PayPal API account.', '6', '7', now())"); 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 ('Payment Action', 'MODULE_PAYMENT_PAYPAL_DP_PAYMENT_ACTION', 'Sale', 'Sale or Authorization (Capture later)?', '6', '9', 'tep_cfg_select_option(array(\'Sale\', \'Authorization\'), ', now())"); 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 ('Manual Processing if Failed', 'MODULE_PAYMENT_PAYPAL_DP_FAILURE_EMAIL', 'Yes', 'Do you want to receive credit card information by email if failed?', '6', '10', 'tep_cfg_select_option(array(\'Yes\', \'No\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Order Status if Failed', 'MODULE_PAYMENT_PAYPAL_DP_FAILURE_STATUS', '1', 'Order status for manual processing.', '6', '11', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())"); 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 ('Log Level', 'MODULE_PAYMENT_PAYPAL_DP_LOG_LEVEL', 'Off', 'Do you want to turn on logging?', '6', '12', 'tep_cfg_select_option(array(\'Debug\', \'Normal\', \'Off\'), ',now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Log Directory', 'MODULE_PAYMENT_PAYPAL_DP_LOG_DIR', '', 'Enter the absolute path to your log directory. It must be writable.', '6', '13', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return array('MODULE_PAYMENT_PAYPAL_DP_STATUS', 'MODULE_PAYMENT_PAYPAL_DP_ZONE', 'MODULE_PAYMENT_PAYPAL_DP_ORDER_STATUS_ID', 'MODULE_PAYMENT_PAYPAL_DP_SORT_ORDER', 'MODULE_PAYMENT_PAYPAL_DP_GATEWAY_SERVER', 'MODULE_PAYMENT_PAYPAL_DP_CERT_FILE', 'MODULE_PAYMENT_PAYPAL_DP_USERNAME', 'MODULE_PAYMENT_PAYPAL_DP_PASSWORD', 'MODULE_PAYMENT_PAYPAL_DP_LOG_LEVEL', 'MODULE_PAYMENT_PAYPAL_DP_LOG_DIR', 'MODULE_PAYMENT_PAYPAL_DP_PAYMENT_ACTION', 'MODULE_PAYMENT_PAYPAL_DP_FAILURE_EMAIL', 'MODULE_PAYMENT_PAYPAL_DP_FAILURE_STATUS'); } } ?> Quote Link to comment Share on other sites More sharing options...
jlmorales Posted April 25, 2011 Share Posted April 25, 2011 Please do you find the solution... Having the same issue Quote Link to comment Share on other sites More sharing options...
jlmorales Posted April 25, 2011 Share Posted April 25, 2011 Probelm: When I have a discount code set up for 10% on a category. It does not calculate the tax portion properly. Example: Subtotal: $590.00 Discount: $59.00 5% Tax: $29.50 Total: $560.50 The tax amount should be 26.55 and the Total should be $557.55 Quote Link to comment Share on other sites More sharing options...
chicagola Posted May 11, 2011 Share Posted May 11, 2011 I installed Discount Code 2.9 for osCommerce 2.2, and everything works good, except the discount is not adding to the total. Sub-Total: $160.00 Discount (PERKS): $32.00 United Parcel Service (1 x 4lbs) (Ground): $14.30 Total: $174.30 Any thoughts? Quote Link to comment Share on other sites More sharing options...
danthman Posted August 1, 2011 Share Posted August 1, 2011 I added Discount codes to OSCommerce 2.2 and it totals fine but I get MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_CONFIG instead of the discount coupon that was used on the checkout page and on the order process email. Thinking it was a problem with the includes/languages/english/modules/order_total/ot_discount_coupon.php file I changed MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY to MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_CONFIG and now I see Discount Coupon %s applied. Getting closer, bit it still does not display the actual discount code used. What have I done wrong? Thanks for the help, Dan Quote Link to comment Share on other sites More sharing options...
yadetar Posted August 5, 2011 Share Posted August 5, 2011 Hello all, Great contrib. but I have some problem with it: (I have 2.3.1 and istalled Discount Code 2.6 for osCommerce 2.3.1) In the installation manual it says that "Set the sort order for order total modules under Administration -> Modules -> Order Total." My problem is that for some reason at the _modules -> order total_ I cannot change anything after the installation of this contrib. I can just add the discount code module, but after loading this module, the change option dissapears. How could I change the sort order OR how to have the change option back? Could someone help me with this? I would appreciate it a lot! BR, yadetar Quote Link to comment Share on other sites More sharing options...
Ausgirl Posted August 6, 2011 Share Posted August 6, 2011 There is a fix for PayPal Express on high-quality-php-coding website for PayPal to accept the discount code for 2.2 I was wondering if there was a fix for PayPal Express to accept the discount in OSC 2.3 as at the moment, it does not recognize the discount & customers are charged full price and of course the code is different in 2.2 from 2.3 and I have no idea what to change in the payments/paypal_express.php Help appreciated :) Quote Link to comment Share on other sites More sharing options...
yadetar Posted August 7, 2011 Share Posted August 7, 2011 Hello all, Great contrib. but I have some problem with it: (I have 2.3.1 and istalled Discount Code 2.6 for osCommerce 2.3.1) In the installation manual it says that "Set the sort order for order total modules under Administration -> Modules -> Order Total." My problem is that for some reason at the _modules -> order total_ I cannot change anything after the installation of this contrib. I can just add the discount code module, but after loading this module, the change option dissapears. How could I change the sort order OR how to have the change option back? Could someone help me with this? I would appreciate it a lot! BR, yadetar Nevermind about this. Problem solved. It was a typo in my files.. Quote Link to comment Share on other sites More sharing options...
digital_i Posted August 17, 2011 Share Posted August 17, 2011 (edited) I'm getting an error on my checkout screen (checkout_payment.php) at the top. Any ideas as to the problem? $(document).ready(function() { var a = 0; discount_code_process(); $('#discount_code').blur(function() { if (a == 0) discount_code_process(); a = 0 }); $("#discount_code").keypress(function(event) { if (event.which == 13) { event.preventDefault(); a = 1; discount_code_process() } }); function discount_code_process() { if ($("#discount_code").val() != "") { $("#discount_code").attr("readonly", "readonly"); $("#discount_code_status").empty().append(''); $.post("discount_code.php", { discount_code: $("#discount_code").val() }, function(data) { data == 1 ? $("#discount_code_status").empty().append('') : $("#discount_code_status").empty().append(''); $("#discount_code").removeAttr("readonly") }); } } }); #EDIT: The error is below the main bar but right above payment information. Edited August 17, 2011 by digital_i Quote Link to comment Share on other sites More sharing options...
Papa Bear Posted August 22, 2011 Share Posted August 22, 2011 Thank you for posting your fix! Worked for me too. I was having the same problem getting a 1054 - Unknown column. The Discount Code 2.6 for osCommerce 2.3.1 (full install pkg) is missing this "customers_id" line in the SQL Query step 1. So if you haven't installed add `customers_id` text, right after: `excluded_products_id` text, before running the query. Or just go to your myphpadmin and add a row in the table. I must be missing something because I tried this and it still does not carry over.. Quote Link to comment Share on other sites More sharing options...
Ausgirl Posted September 18, 2011 Share Posted September 18, 2011 There is now an update for discount codes to be accepted via PayPal for 2.3 http://addons.oscommerce.com/info/7700 Quote Link to comment Share on other sites More sharing options...
eldridge Posted October 6, 2011 Share Posted October 6, 2011 I installed the add-on however, when creating a coupon, this is the error: Fatal error: Call to a member function format() on a non-object in /home/**/public_html/**/admin/includes/functions/general.php on line 223 Please help! Quote Link to comment Share on other sites More sharing options...
nahi_sonu Posted October 16, 2011 Share Posted October 16, 2011 Hi, i had oscommerce 2.2rc1.. ive upgraded my store to v2.3.1 (manual upgrade) ive installed the discount code addon and its working fine except 2 issues im having. 1. when i select (any number) in " Discount coupon stops working after that.. if i leave it blank then it works just fine. 2. Discount in percentage not working.. when i use percentage as discount, it shows invalid coupon sign in ajax check. please help me out on these issue. thanks. Quote outside links are not allowed in signatures Link to comment Share on other sites More sharing options...
nahi_sonu Posted October 20, 2011 Share Posted October 20, 2011 Hi, i had oscommerce 2.2rc1.. ive upgraded my store to v2.3.1 (manual upgrade) ive installed the discount code addon and its working fine except 2 issues im having. 1. when i select (any number) in " Discount coupon stops working after that.. if i leave it blank then it works just fine. 2. Discount in percentage not working.. when i use percentage as discount, it shows invalid coupon sign in ajax check. please help me out on these issue. thanks. bump Quote outside links are not allowed in signatures Link to comment Share on other sites More sharing options...
iffy Posted October 31, 2011 Share Posted October 31, 2011 Thanks for the great add-on. It's functionality is exactly what I needed without too many modifications. After testing the coupon codes, there are 2 problems I ran across, but not sure if there are more. 1) when you set a minimum order, it was calculating the minimum based on the order total, which included tax and shipping. I needed the minimum to be on the subtotal of all items purchased before shipping and tax. 2) the tax calculation is based on the subtotal before discount. I'd like the tax to be calculated after the discount. I've tried what others have posted before with no luck. The tax is still calculated incorrectly. I was able to solve #1 with a minor change, which I have posted below if anyone needs it. If anyone has solved the tax problem, please post a solution. Thanks. in ot_discount.php on line 40, change: $check_query = tep_db_query("select dc.products_id, dc.categories_id, dc.manufacturers_id, dc.excluded_products_id, dc.customers_id, dc.orders_total, dc.order_info, dc.discount_values, dc.number_of_products from " . TABLE_DISCOUNT_CODES . " dc where dc.discount_codes = '" . tep_db_input($sess_discount_code) . "' and if(dc.expires_date = '0000-00-00', date_format(date_add(now(), interval 1 day), '%Y-%m-%d'), dc.expires_date) >= date_format(now(), '%Y-%m-%d') and dc.minimum_order_amount <= " . $order->info['total'] . " and dc.status = '1' limit 1"); to: $check_query = tep_db_query("select dc.products_id, dc.categories_id, dc.manufacturers_id, dc.excluded_products_id, dc.customers_id, dc.orders_total, dc.order_info, dc.discount_values, dc.number_of_products from " . TABLE_DISCOUNT_CODES . " dc where dc.discount_codes = '" . tep_db_input($sess_discount_code) . "' and if(dc.expires_date = '0000-00-00', date_format(date_add(now(), interval 1 day), '%Y-%m-%d'), dc.expires_date) >= date_format(now(), '%Y-%m-%d') and dc.minimum_order_amount <= " . $order->info['subtotal'] . " and dc.status = '1' limit 1"); It's a simple one word change to check minimum order using order subtotal instead of order total. BTW- I am using Discount Code version 2.9 on oscommerce 2.2 (newer add on with older shopping cart) Best, Iffy www.cuddlebugfactory.com Quote Link to comment Share on other sites More sharing options...
Tom14 Posted November 1, 2011 Share Posted November 1, 2011 Hello. In the admin overview the orders are doesn't count, isn' it? I tried several adjustments with orders but der counter shows zero. Can anybody confirm that? Thanks Regards Quote Link to comment Share on other sites More sharing options...
'GaryLack-Jones' Posted November 16, 2011 Share Posted November 16, 2011 Hi first time posting here, hoping someone can help or redirect me to the relevent topic. I installed this: Discount Code update 2.9 for osCommerce 2.2 high-quality-php-coding 21 Feb 2011 Changes: - Added discount code editing Screenshots are available at http://high-quality-php-coding.com/discount_code_module_for_oscommerce.html Discount Code for osCommerce Online Merchant v2.3.1 can be downloaded at http://addons.oscommerce.com/info/7700 Everything admin side works fine, however in testing eg making a dummy order i am getting an error on the checkout page. http://silverbirchcrafts.co.uk/checkout_shipping.php The error is Warning: Cannot modify header information - headers already sent by (output started at /home/sites/silverbirchcrafts.co.uk/public_html/includes/application_top.php:523) in /home/sites/silverbirchcrafts.co.uk/public_html/includes/functions/general.php on line 33 Ive double checked all the code ive changed as per the readme and everything seems to be in order, hoping someone can help. Rgds. Gary Quote Link to comment Share on other sites More sharing options...
'GaryLack-Jones' Posted November 16, 2011 Share Posted November 16, 2011 Ive replaced the file application_top.php to the original file temporarily so users can still order normally until i find a resolution to the issue. Rgds. Gary Quote Link to comment Share on other sites More sharing options...
Crazypilot Posted November 20, 2011 Share Posted November 20, 2011 Hi All, I am having the same problem that many other are complaining about. When discount is set as a percentage, like 10%, then the NET price is discounted by 10% = all correct. Sample: original price 100€ will be discounted with 10% and show as subtotal 90€. But, when the TAX /VAT is added to the NET price, then the TAX/VAT is calculated on the price BEFORE the discount. It should off course be based and calculated on the price AFTER discount, right? Example on how it should be with 15% TAX/VAT: NET price before discount: 100€ Discount 10% ==> NET Price after discount = 90€ TAX/VAT 15% ==> 0,15 x 90€ = 13,5€ Total Price= 90 + 13,50 = 103,50€ including TAX Now Example on how it is wrongly working: NET price before discount: 100€ Discount 10% ==> NET Price after discount = 90€ TAX/VAT 15% ==> 0,15 x ( Wrongly based on original price) 100€ = 15,00€ Total Price= 90 + 15,00 = 105,00€ including TAX which is giving a false TAX figure As seen, the latter example is wrong and is giving me faulty invoices/Receipts and can not be used for fiscal declarations. I contacted high-quality-php-coding.com that created this handy ADD-ON and explained the problem and got following reply: Hello, Thank you for your interest in our product. To get correct order total info, you should adjust the following variables: $order->info['tax'] $order->info['tax_groups'][<your tax>] $order->info['total'] Sincerely, The High Quality PHP Coding Team. Maybe someone smarter than I can help me figure out where and how to use this information to get the contribution to show correct TAX? It is a super good contribution, BUT as long as it shows wrong TAX, it can not really be used right? Best regards CrazyP Quote Link to comment Share on other sites More sharing options...
S.James Posted November 22, 2011 Share Posted November 22, 2011 Like this add am using to offer free shipping when the code is entered. Customer selects shipping option then goes to payment page selects how to pay and then enters the code click continue and we get this error message (Your calculated shipping charges have changed) then it goes back to choose shipping options. Any help on correct this 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.