♥zelf Posted December 15, 2008 Share Posted December 15, 2008 I just uploaded the Virtual Merchant a.k.a. Nova, Elavon, ViaKlix ChargeIt contribution here: http://addons.oscommerce.com/info/6417 This will be the official support forum for this contribution. The contribution works similar to the Authorize.net AIM module, but with many enhancments to reduce credit card declines with the Virtual Merchant system and to return friendly and nicely formatted error messages. The contribution also makes CVV2 information an actual option to require or not require. There are many admin options to enable Dynamic currency conversion (DCC), that can make merchant money, as well as error checking and admin error emails for when customers receive credit card errors for testing. Also, has option to enable a call for help number if users have problems charging their card. Quote Virtual Merchant a.k.a. Elavon, ViaKlix, Nova Payment Module Contribution Link to comment Share on other sites More sharing options...
apache510 Posted January 5, 2009 Share Posted January 5, 2009 I loaded the module but the test credit card number has expired. The expiration date given was 12/08. Is there another set of numbers that I can use to continue testing? Quote Link to comment Share on other sites More sharing options...
♥zelf Posted January 8, 2009 Author Share Posted January 8, 2009 I loaded the module but the test credit card number has expired. The expiration date given was 12/08. Is there another set of numbers that I can use to continue testing? You should be able to use any expiration date in the future. I will check into it. Quote Virtual Merchant a.k.a. Elavon, ViaKlix, Nova Payment Module Contribution Link to comment Share on other sites More sharing options...
apache510 Posted January 12, 2009 Share Posted January 12, 2009 I discovered a bug. If you enter no credit card number you get the message: Warning: str_repeat() [function.str-repeat]: Second argument has to be greater than or equal to 0 in C:\xampp\htdocs\catalog\includes\modules\payment\chargeit.php on line 235 Quote Link to comment Share on other sites More sharing options...
♥zelf Posted January 14, 2009 Author Share Posted January 14, 2009 I discovered a bug. If you enter no credit card number you get the message: Warning: str_repeat() [function.str-repeat]: Second argument has to be greater than or equal to 0 in C:\xampp\htdocs\catalog\includes\modules\payment\chargeit.php on line 235 You should not be able to not enter a credit card. Did you correctly install the cc_validation class? Not entering a credit card should popup an alert window stating you need to enter a credit card. Quote Virtual Merchant a.k.a. Elavon, ViaKlix, Nova Payment Module Contribution Link to comment Share on other sites More sharing options...
fishonafly Posted January 20, 2009 Share Posted January 20, 2009 You should not be able to not enter a credit card. Did you correctly install the cc_validation class? Not entering a credit card should popup an alert window stating you need to enter a credit card. Thanks for your effort in contributing this. I tried to install the ChargeIt module last night and today. I got it installed just fine, but am having trouble testing it. Before I changed the error scripting I tested it to see if it was working. When I go to the checkout page and enter the test card number with expiration of 12/09 and click 'Continue' from the Payment Information page, it simply retunrs back there with no error message. IT is definitely using the ChargeIt script from the heading. Then I went ahead and changed the two script files to accomodate the error messages, but now when I go to the Payment Information page it comes up completely blank and I see no PHP errors in the log? Any thoughts on what the heck I have done wrong here? Thanks for your help. Quote Link to comment Share on other sites More sharing options...
♥zelf Posted January 20, 2009 Author Share Posted January 20, 2009 Thanks for your effort in contributing this. I tried to install the ChargeIt module last night and today. I got it installed just fine, but am having trouble testing it. Before I changed the error scripting I tested it to see if it was working. When I go to the checkout page and enter the test card number with expiration of 12/09 and click 'Continue' from the Payment Information page, it simply retunrs back there with no error message. IT is definitely using the ChargeIt script from the heading. Then I went ahead and changed the two script files to accomodate the error messages, but now when I go to the Payment Information page it comes up completely blank and I see no PHP errors in the log? Any thoughts on what the heck I have done wrong here?Thanks for your help. PM your site with the class in test mode please. I might be able to better help you troubleshoot seeing the errors. Quote Virtual Merchant a.k.a. Elavon, ViaKlix, Nova Payment Module Contribution Link to comment Share on other sites More sharing options...
♥zelf Posted January 22, 2009 Author Share Posted January 22, 2009 Just uploaded Version 1.1 of this contribution. It contains the following updates. Release Updates v 1.1 (No database changes in this version) + install instructions updated. v 1.0 was missing a couple of steps + maxFieldLenAry holds the max lengths of submission data according to VM Developer's guide + several substr calls in before_process() method trimming field data according lengths in maxFieldLenAry. + updated validEmail() method to check for max length of email in maxFieldLenAry + updated testing credit card expiration date in chargeit.php language file + updated error message display. Stands out more and now has error icon. + cc_chargeit_error.gif that displays on new error message display Contribution URL: http://addons.oscommerce.com/info/6417 Quote Virtual Merchant a.k.a. Elavon, ViaKlix, Nova Payment Module Contribution Link to comment Share on other sites More sharing options...
apache510 Posted January 24, 2009 Share Posted January 24, 2009 I just installed it and it seems to work fine with one exception. It does not take the test credit card: Credit Card Test #: Card: 5000300020003003 Expiration: 1209 CVV2: 123 Any value under $50.00 I get the error message: The first four digits of the number entered are: 5000. If that number is correct, we do not accept that type of credit card. If it is wrong, please try again. Quote Link to comment Share on other sites More sharing options...
♥zelf Posted January 25, 2009 Author Share Posted January 25, 2009 (edited) The first four digits of the number entered are: 5000. If that number is correct, we do not accept that type of credit card. If it is wrong, please try again. This is from the chargeit_cc_validation.php class. I need to add a method for running the testing credit card. I will release a small update that will allow you to use the testing credit card. Glad you have it running. Incidentally, if you set the module to Testing and not Production you should be able to use actual credit cards, but they will not be charged. However, the cards will be sent to Virtual Merchant's processor, and tested as if they were a real credit card or return errors if there are any errors with your connection. Orders will also dump into your orders table in testing mode. Just remember to turn it to production before you start using it live. Edited January 25, 2009 by zelf Quote Virtual Merchant a.k.a. Elavon, ViaKlix, Nova Payment Module Contribution Link to comment Share on other sites More sharing options...
Guest Posted January 26, 2009 Share Posted January 26, 2009 Hi I downloaded the contribution, but every time that I input the credit card information I get this error: "Credit Card Error: The card entered is being declined. This most often is due to incorrectly entered information. Please try re-entering your information." I have tried the test credit card number provided in the contribution, and I have tried a working real credit card, but in both cases I get the same result. Finally, I checked the merchant's log-in, and password info and it's correct. Any help? Thanks in advance: Fabian. Quote Link to comment Share on other sites More sharing options...
♥zelf Posted January 27, 2009 Author Share Posted January 27, 2009 (edited) "Credit Card Error: The card entered is being declined. This most often is due to incorrectly entered information. Please try re-entering your information." This is just a friendly message meant for end users. To see actual Virtual Merchant errors -> In the administration panel turn on "Enable email errors to admin email below" and then in the "Admin email" field put in your email address. This will email the actual error if any are being returned by Virtual Merchant. There are several things that could cause this problem. For example, in your Virtual Merchant terminal did you setup the referring url that you set in the "Set Referer URL". In any event, start by turning on error emails so you can see if any errors are being returned by Virtual Merchant. If the errors do not help please post the errors and I would be happy to assist further. Edited January 27, 2009 by zelf Quote Virtual Merchant a.k.a. Elavon, ViaKlix, Nova Payment Module Contribution Link to comment Share on other sites More sharing options...
vlademir Posted January 27, 2009 Share Posted January 27, 2009 Got everything setup and working but I keep getting this error from Virtual Merchant when charging sales tax. Error Message(s): 4009. Required Field Not Supplied. The field Sales Tax (ssl_salestax) required but not supplied in the authorization request. Any help would be much appreciated. Quote Link to comment Share on other sites More sharing options...
♥zelf Posted January 27, 2009 Author Share Posted January 27, 2009 Got everything setup and working but I keep getting this error from Virtual Merchant when charging sales tax. Error Message(s): 4009. Required Field Not Supplied. The field Sales Tax (ssl_salestax) required but not supplied in the authorization request. Any help would be much appreciated. The total dollar amount being charged including tax, shipping, is being sent to Virtual Merchant in the ssl_amount field. In this scenario the default ssl_salestax field in Virtual Merchant is an extra field that you can set to not required in your Virtual Merchant terminal. In order to use the ChargeIt contribution your payment fields should look like the following: Quote Virtual Merchant a.k.a. Elavon, ViaKlix, Nova Payment Module Contribution Link to comment Share on other sites More sharing options...
Russw40 Posted January 28, 2009 Share Posted January 28, 2009 This is just a friendly message meant for end users. To see actual Virtual Merchant errors -> In the administration panel turn on "Enable email errors to admin email below" and then in the "Admin email" field put in your email address. This will email the actual error if any are being returned by Virtual Merchant. There are several things that could cause this problem. For example, in your Virtual Merchant terminal did you setup the referring url that you set in the "Set Referer URL". In any event, start by turning on error emails so you can see if any errors are being returned by Virtual Merchant. If the errors do not help please post the errors and I would be happy to assist further. Zelf, Thank You so much for your work on this module. I thought I followed the instructions but I get this email error: Customer ID #4 xxxxxxx@xxxxxxx xxxxxx xxxxxx United States Error Message(s): 4012. VID/UID Invalid. The VirtualMerchant ID and/or User ID supplied in the authorization request is invalid. Address Verification Response: CVV2 Verification Response: I am using the same User ID I used with the other version of ViaKlix module ( I was moved to a new server and the old module dosn't work on it)...what am I missing? Thanks, Russ Quote Link to comment Share on other sites More sharing options...
♥zelf Posted January 28, 2009 Author Share Posted January 28, 2009 (edited) Error Message(s): 4012. VID/UID Invalid. The VirtualMerchant ID and/or User ID supplied in the authorization request is invalid.Address Verification Response: CVV2 Verification Response: Virtual Merchant has errors that are often not helpful. I believe I remember this error had to do with an incorrect system setup in the Advanced configuration area of the Virtual Merchant terminal in regards to http transactions versus referrers. Your configuration should look like the picture below and you should have added the referrer url you entered into the ChargeIt module "Set Referer URL" field, into the "Authorized Referrers" field in Virtual Terminal. e.g. https://secure.yoursite.com/checkout_confirmation.php Let me know if any of this helps. The final step of course is to contact Virtual Merchant and they can tell you what problems the transactions are receiving in more detail. Edited January 28, 2009 by zelf Quote Virtual Merchant a.k.a. Elavon, ViaKlix, Nova Payment Module Contribution Link to comment Share on other sites More sharing options...
Russw40 Posted January 28, 2009 Share Posted January 28, 2009 Virtual Merchant has errors that are often not helpful. I believe I remember this error had to do with an incorrect system setup in the Advanced configuration area of the Virtual Merchant terminal in regards to http transactions versus referrers. Your configuration should look like the picture below and you should have added the referrer url you entered into the ChargeIt module "Set Referer URL" field, into the "Authorized Referrers" field in Virtual Terminal. e.g. https://secure.yoursite.com/checkout_confirmation.php Let me know if any of this helps. The final step of course is to contact Virtual Merchant and they can tell you what problems the transactions are receiving in more detail. Thanks, I copy and pasted so they are the same. Guess I will have to give them another call. Thanks, Russ Quote Link to comment Share on other sites More sharing options...
♥zelf Posted January 28, 2009 Author Share Posted January 28, 2009 (edited) Guess I will have to give them another call. Virtual Merchant will have more details on what the error is. Particularly with connection issues they do not reveal in an error message what the problem is. Edited January 28, 2009 by zelf Quote Virtual Merchant a.k.a. Elavon, ViaKlix, Nova Payment Module Contribution Link to comment Share on other sites More sharing options...
eyelight Posted January 30, 2009 Share Posted January 30, 2009 Zelf, First, thanks for this module and the work you have already done. Question...I have your Virtual Merchant Payment Gateway installed as well as Check or Money Order option. When I go to the "Payment Information" page, there is a radio button selection where you can choose to use your credit card option or the check/money order option. When selecting the check/money order option, the javascript validation for the your credit card option continues to validate and won't allow the user to "Continue". Thoughts? Quote Link to comment Share on other sites More sharing options...
♥zelf Posted January 31, 2009 Author Share Posted January 31, 2009 Zelf, First, thanks for this module and the work you have already done. Question...I have your Virtual Merchant Payment Gateway installed as well as Check or Money Order option. When I go to the "Payment Information" page, there is a radio button selection where you can choose to use your credit card option or the check/money order option. When selecting the check/money order option, the javascript validation for the your credit card option continues to validate and won't allow the user to "Continue". Thoughts? Let me recreate this scenario with money order option tonight. Hold tight. If it is a problem with my javascript I will release a fix tonight. Quote Virtual Merchant a.k.a. Elavon, ViaKlix, Nova Payment Module Contribution Link to comment Share on other sites More sharing options...
♥zelf Posted January 31, 2009 Author Share Posted January 31, 2009 When I go to the "Payment Information" page, there is a radio button selection where you can choose to use your credit card option or the check/money order option. When selecting the check/money order option, the javascript validation for the your credit card option continues to validate and won't allow the user to "Continue". To fix this behavior where you have multiple payment methods in /catalog/classes/payment.php replace the entire "function javascript_validation()" method around line 80 with the code below: function javascript_validation() { $js = ''; if (is_array($this->modules)) { $js = '<script language="javascript"><!-- ' . "\n" . // added by Zelf 'function returnObjById( id )' . "\n" . '{' . "\n" . ' if (document.getElementById)' . "\n" . ' var returnVar = document.getElementById(id);' . "\n" . ' else if (document.all)' . "\n" . ' var returnVar = document.all[id];' . "\n" . ' else if (document.layers)' . "\n" . ' var returnVar = document.layers[id];' . "\n" . ' return returnVar;' . "\n" . '}' . "\n\n" . 'function check_form() {' . "\n" . ' var error = 0;' . "\n" . ' var error_message = "' . JS_ERROR . '";' . "\n" . ' var payment_value = null;' . "\n" . ' if (document.checkout_payment.payment.length) {' . "\n" . ' for (var i=0; i<document.checkout_payment.payment.length; i++) {' . "\n" . ' if (document.checkout_payment.payment[i].checked) {' . "\n" . ' payment_value = document.checkout_payment.payment[i].value;' . "\n" . ' }' . "\n" . ' }' . "\n" . ' } else if (document.checkout_payment.payment.checked) {' . "\n" . ' payment_value = document.checkout_payment.payment.value;' . "\n" . ' } else if (document.checkout_payment.payment.value) {' . "\n" . ' payment_value = document.checkout_payment.payment.value;' . "\n" . ' }' . "\n\n"; reset($this->modules); while (list(, $value) = each($this->modules)) { $class = substr($value, 0, strrpos($value, '.')); if ($GLOBALS[$class]->enabled) { $js .= $GLOBALS[$class]->javascript_validation(); } } $js .= "\n" . ' if (payment_value == null) {' . "\n" . ' error_message = error_message + "' . JS_ERROR_NO_PAYMENT_MODULE_SELECTED . '";' . "\n" . ' error = 1;' . "\n" . ' }' . "\n\n" . ' if (error == 1) {' . "\n" . ' alert(error_message);' . "\n" . ' return false;' . "\n" . ' } else {' . "\n" . ' return true;' . "\n" . ' }' . "\n" . '}' . "\n" . '//--></script>' . "\n"; } return $js; } Quote Virtual Merchant a.k.a. Elavon, ViaKlix, Nova Payment Module Contribution Link to comment Share on other sites More sharing options...
creativeone Posted February 20, 2009 Share Posted February 20, 2009 Hi Thanks for this wonderful module. I have installed a couple of times to make sure I did everything correctly. When I try to test it (in production with my own cc) virtual merchant tells me the order is going through, however I am directed to a page with this Fatal error: Call to a member function call_api() on a non-object in /home/rockhill/public_html/register/checkout_process.php on line 127 How can I fix this? That line has buysafe info which appears to be commented out. Any help would be greatly appreciated. Thanks Quote Link to comment Share on other sites More sharing options...
♥zelf Posted February 20, 2009 Author Share Posted February 20, 2009 Fatal error: Call to a member function call_api() on a non-object in /home/rockhill/public_html/register/checkout_process.php on line 127That line has buysafe info which appears to be commented out. The error you mention here is not a method in the ChargeIt class. What contribution is calling the call_api() function? call_api appears to belong to an object that is not being instantiated. I would suggest looking at line 127 of your checkout_process.php and determine why this function call is giving you this error. Post your checkout_process.php if you would like me to take a look at it. Quote Virtual Merchant a.k.a. Elavon, ViaKlix, Nova Payment Module Contribution Link to comment Share on other sites More sharing options...
creativeone Posted February 20, 2009 Share Posted February 20, 2009 The error you mention here is not a method in the ChargeIt class. What contribution is calling the call_api() function? call_api appears to belong to an object that is not being instantiated. I would suggest looking at line 127 of your checkout_process.php and determine why this function call is giving you this error. Post your checkout_process.php if you would like me to take a look at it. Line 127 talks about the buysafe stuff. Here is my checkout_process.php Thanks so much <?php /* $Id: checkout_process.php 1750 2007-12-21 05:20:28Z hpdl $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2007 osCommerce Released under the GNU General Public License */ 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 there is nothing in the customers cart, redirect them to the shopping cart page if ($cart->count_contents() < 1) { tep_redirect(tep_href_link(FILENAME_SHOPPING_CART)); } // if no shipping method has been selected, redirect the customer to the shipping method selection page if (!tep_session_is_registered('shipping') || !tep_session_is_registered('sendto')) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', '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; // Stock Check $any_out_of_stock = false; if (STOCK_CHECK == 'true') { for ($i=0, $n=sizeof($order->products); $i<$n; $i++) { if (tep_check_stock($order->products[$i]['id'], $order->products[$i]['qty'])) { $any_out_of_stock = true; } } // Out of Stock if ( (STOCK_ALLOW_CHECKOUT != 'true') && ($any_out_of_stock == true) ) { tep_redirect(tep_href_link(FILENAME_SHOPPING_CART)); } } $payment_modules->update_status(); if ( ( is_array($payment_modules->modules) && (sizeof($payment_modules->modules) > 1) && !is_object($$payment) ) || (is_object($$payment) && ($$payment->enabled == false)) ) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(ERROR_NO_PAYMENT_MODULE_SELECTED), 'SSL')); } require(DIR_WS_CLASSES . 'order_total.php'); $order_total_modules = new order_total; $order_totals = $order_total_modules->process(); // load the before_process function from the payment modules $payment_modules->before_process(); $sql_data_array = array('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' => trim($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); $insert_id = tep_db_insert_id(); // {{ buySAFE Module $buysafe_cart_id = MODULE_BUYSAFE_BUYSAFE_CART_PREFIX . '-' . tep_session_id() . (tep_count_customer_orders()-1); $checkout_params = array('WantsBond' => ($WantsBond ? $WantsBond : 'false'), 'orders_id' => $insert_id, 'buysafe_cart_id' => $buysafe_cart_id); $checkout_result = $buysafe_module->call_api('SetShoppingCartCheckout', $checkout_params); if (is_array($checkout_result) && $checkout_result['IsBuySafeEnabled'] == 'true') { $update_data_array = array('buysafe_cart_id' => $buysafe_cart_id, 'buysafe_client_ip' => tep_get_ip_address(), 'buysafe_session_id' => tep_session_id()); tep_db_perform(TABLE_ORDERS, $update_data_array, 'update', "orders_id = '" . (int)$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); // 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 .= $order->info['payment_method'] . "\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'); tep_session_unregister('payment_error_return'); // {{ buySAFE Module tep_session_unregister('WantsBond'); // }} 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...
♥zelf Posted February 20, 2009 Author Share Posted February 20, 2009 Line 127 talks about the buysafe stuff. $checkout_result = $buysafe_module->call_api('SetShoppingCartCheckout', $checkout_params); This line is expecting an object called $buysafe_module to have been instantiated. Where is the $buysafe_module object being created? For example to instantiate and access methods in the buysafe class, which I am not familiar with by the way, the class itself would need to be accessible by the checkout_process.php page through an include of the class at the top of the page or an include in some other class/include file checkout_process.php includes. You may need to check with whomever created the buysafe contribution as to why it is not being instantiated. Quote Virtual Merchant a.k.a. Elavon, ViaKlix, Nova Payment Module Contribution 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.