Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

samie

Archived
  • Posts

    4
  • Joined

  • Last visited

Profile Information

  • Real Name
    samiee

samie's Achievements

  1. thanks steve, i really like ur script thats why i installed it, isnt there anny other option to get it working without requiring people to register themselfes, becoz i want to avoid the registering.
  2. here is the php code of that payment module. <?php /* $Id: icepay.php, v2.0 2009/01/20 11:58:00 osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2008 osCommerce Released under the GNU General Public License */ if ( !class_exists("icepay_order_total") ) { class icepay_order_total { var $modules; // class constructor function icepay_order_total() { global $language; if (defined('MODULE_ORDER_TOTAL_INSTALLED') && tep_not_null(MODULE_ORDER_TOTAL_INSTALLED)) { $this->modules = explode(';', MODULE_ORDER_TOTAL_INSTALLED); reset($this->modules); while (list(, $value) = each($this->modules)) { include_once(DIR_WS_LANGUAGES . $language . '/modules/order_total/' . $value); include_once(DIR_WS_MODULES . 'order_total/' . $value); $class = substr($value, 0, strrpos($value, '.')); //echo($class.'<BR>'); //$GLOBALS[$class] = new $class; } } } function process() { $order_total_array = array(); if (is_array($this->modules)) { reset($this->modules); while (list(, $value) = each($this->modules)) { $class = substr($value, 0, strrpos($value, '.')); if ($GLOBALS[$class]->enabled) { $i=0; if (tep_not_null($GLOBALS[$class]->output[$i]['title']) && tep_not_null($GLOBALS[$class]->output[$i]['text'])) { $order_total_array[] = array ( 'code' => $GLOBALS[$class]->code, 'title' => $GLOBALS[$class]->output[$i]['title'], 'text' => $GLOBALS[$class]->output[$i]['text'], 'value' => $GLOBALS[$class]->output[$i]['value'], 'sort_order' => $GLOBALS[$class]->sort_order ); } } } } return $order_total_array; } function output() { $output_string = ''; if (is_array($this->modules)) { reset($this->modules); while (list(, $value) = each($this->modules)) { $class = substr($value, 0, strrpos($value, '.')); if ($GLOBALS[$class]->enabled) { $size = sizeof($GLOBALS[$class]->output); for ($i=0; $i<$size; $i++) { $output_string .= ' <tr>' . "\n" . ' <td align="right" class="main">' . $GLOBALS[$class]->output[$i]['title'] . '</td>' . "\n" . ' <td align="right" class="main">' . $GLOBALS[$class]->output[$i]['text'] . '</td>' . "\n" . ' </tr>'; } } } } return $output_string; } } } if ( !class_exists('icepay') ) { class icepay { var $code; var $title; var $description; var $enabled; var $form_action_url = 'https://pay.icepay.eu/basic/'; function icepay() { global $order; $statuserror = false; $this->code = 'icepay'; $this->title = MODULE_PAYMENT_ICEPAY_TEXT_TITLE; $this->description = MODULE_PAYMENT_ICEPAY_TEXT_DESCRIPTION; $this->sort_order = MODULE_PAYMENT_ICEPAY_SORT_ORDER; $this->enabled = ((MODULE_PAYMENT_ICEPAY_STATUS == 'True') ? true : false); if ((int)MODULE_PAYMENT_ICEPAY_ORDER_STATUS_ID > 0) $this->order_status = MODULE_PAYMENT_ICEPAY_ORDER_STATUS_ID; if ((int)MODULE_PAYMENT_ICEPAY_ORDER_STATUS_ID == 0) $statuserror = true; if ((int)MODULE_PAYMENT_ICEPAY_CANCELLED_ORDER_STATUS_ID == 0) $statuserror = true; if ((int)MODULE_PAYMENT_ICEPAY_REFUND_ORDER_STATUS_ID == 0) $statuserror = true; if ((int)MODULE_PAYMENT_ICEPAY_SUCCESS_ORDER_STATUS_ID == 0) $statuserror = true; if ((int)MODULE_PAYMENT_ICEPAY_CHARGEBACK_ORDER_STATUS_ID == 0) $statuserror = true; if ((int)MODULE_PAYMENT_ICEPAY_OPEN_ORDER_STATUS_ID == 0) $statuserror = true; if ($statuserror){ $this->description .= "<BR><BR><font color=#FF0000><B>Order statuses can not be default and need to be unique! Please set them properly.</B></font>"; }; if (is_object($order)) $this->update_status(); } function update_status() { global $order; if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_ICEPAY_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_ICEPAY_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() { return false; } function selection() { return array( 'id' => $this->code, 'module' => $this->title); } function pre_confirmation_check() { return false; } function confirmation() { return false; } function process_button() { global $order_total_modules;// = new order_total; global $customer_id, $order, $currencies, $currency, $language, $languages_id; $this->createOrder(); $icepay_country = $this->getUserCountry(MODULE_PAYMENT_ICEPAY_COUNTRY); $icepay_currency = $this->getUserCurrency(MODULE_PAYMENT_ICEPAY_CURRENCY); $icepay_language = $this->getUserLanguage(MODULE_PAYMENT_ICEPAY_LANGUAGE); $amount = number_format($order->info['total'] * $currencies->get_value($icepay_currency), $currencies->currencies[$icepay_currency]['decimal_places'], '.', '') * 100; $checksum = sha1(MODULE_PAYMENT_ICEPAY_MERCHANT_ID . "|" . MODULE_PAYMENT_ICEPAY_SECRET . "|" . $amount . "||" . $this->order_id . " " . $icepay_language . "|" . $icepay_currency . "|" . $icepay_country ); $process_button_string = tep_draw_hidden_field('ic_merchantid', MODULE_PAYMENT_ICEPAY_MERCHANT_ID) . tep_draw_hidden_field('ic_orderid', "") . tep_draw_hidden_field('ic_amount', $amount) . tep_draw_hidden_field('ic_currency', $icepay_currency) . tep_draw_hidden_field('ic_language', $icepay_language) . tep_draw_hidden_field('ic_country', $icepay_country) . tep_draw_hidden_field('ic_description', STORE_NAME) . tep_draw_hidden_field('ic_reference', $this->order_id . " " . $icepay_language) . tep_draw_hidden_field('ic_fp', $this->generateFingerPrint()) . tep_draw_hidden_field('chk', $checksum); return $process_button_string; } function before_process() { return false; } function after_process() { return false; } function get_error() { global $HTTP_GET_VARS; if (isset($HTTP_GET_VARS['message']) && (strlen($HTTP_GET_VARS['message']) > 0)) { $error = stripslashes(urldecode($HTTP_GET_VARS['message'])); } else { $error = MODULE_PAYMENT_ICEPAY_TEXT_ERROR_MESSAGE; } return array( 'title' => MODULE_PAYMENT_ICEPAY_TEXT_ERROR, 'error' => $error ); } function check() { if (!isset($this->_check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_ICEPAY_STATUS'"); $this->_check = tep_db_num_rows($check_query); } return $this->_check; } function _installstatus( $status_name, $public_flag = 0 ) { $check_query = tep_db_query("select orders_status_id from " . TABLE_ORDERS_STATUS . " where orders_status_name = '$status_name' limit 1"); if (tep_db_num_rows($check_query) < 1) { $status_query = tep_db_query("select max(orders_status_id) as status_id from " . TABLE_ORDERS_STATUS); $status = tep_db_fetch_array($status_query); $status_id = $status['status_id']+1; $languages = tep_get_languages(); for ($i=0, $n=sizeof($languages); $i<$n; $i++) { tep_db_query("insert into " . TABLE_ORDERS_STATUS . " (orders_status_id, language_id, orders_status_name) values ('" . $status_id . "', '" . $languages[$i]['id'] . "', '$status_name')"); } $flags_query = tep_db_query("describe " . TABLE_ORDERS_STATUS . " public_flag"); if (tep_db_num_rows($flags_query) == 1) { tep_db_query("update " . TABLE_ORDERS_STATUS . " set public_flag = " . $public_flag . " and downloads_flag = 0 where orders_status_id = '" . $status_id . "'"); } } else { $check = tep_db_fetch_array($check_query); $status_id = $check['orders_status_id']; } } function install() { $this->_installstatus( "Preparing [iCEPAY]", 0 ); $this->_installstatus( "Open [iCEPAY]", 1 ); $this->_installstatus( "Success [iCEPAY]", 1 ); $this->_installstatus( "Cancelled [iCEPAY]", 0 ); $this->_installstatus( "Refund [iCEPAY]", 0 ); $this->_installstatus( "Chargeback [iCEPAY]", 0 ); 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 ICEPAY Module', 'MODULE_PAYMENT_ICEPAY_STATUS', 'True', 'Do you want to enable ICEPAY for online payments?', '6', '1', '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 ('Merchant ID', 'MODULE_PAYMENT_ICEPAY_MERCHANT_ID', 'ICEPAY', 'Merchant ID to use for the ICEPAY service', '6', '2', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Secret code', 'MODULE_PAYMENT_ICEPAY_SECRET', 'ICEPAY', 'Secret code to use for the ICEPAY service', '6', '2', 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 ('Send e-mail to customer?', 'MODULE_PAYMENT_ICEPAY_SENDEMAIL_OK', 'True', 'Send confirmation email to customer after a successful payment?', '6', '1', '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_ICEPAY_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())"); // statuses 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 (preparing)', 'MODULE_PAYMENT_ICEPAY_ORDER_STATUS_ID', '0', 'Set the status of prepared orders', '6', '0', '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, use_function, date_added) values ('Set Order Status (open)', 'MODULE_PAYMENT_ICEPAY_OPEN_ORDER_STATUS_ID', '0', 'Set the status of orders waiting for payment.', '6', '0', '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, use_function, date_added) values ('Set Order Status (successful)', 'MODULE_PAYMENT_ICEPAY_SUCCESS_ORDER_STATUS_ID', '0', 'Set the status of successful orders', '6', '0', '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, use_function, date_added) values ('Set Order Status (cancelled)', 'MODULE_PAYMENT_ICEPAY_CANCELLED_ORDER_STATUS_ID', '0', 'Set the status of cancelled orders', '6', '0', '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, use_function, date_added) values ('Set Order Status (refund)', 'MODULE_PAYMENT_ICEPAY_REFUND_ORDER_STATUS_ID', '0', 'Set the status of successful orders', '6', '0', '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, use_function, date_added) values ('Set Order Status (chargeback)', 'MODULE_PAYMENT_ICEPAY_CHARGEBACK_ORDER_STATUS_ID', '0', 'Set the status of cancelled orders', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())"); // Regional settings $this->default_language = $this->getDefaultLanguage(); $this->default_currency = DEFAULT_CURRENCY; $this->default_country = 'DETECT'; $this->languages_dbstring = $this->db_implode($this->allowedLanguages()); $this->currencies_dbstring = $this->db_implode($this->allowedCurrencies()); $this->countries_dbstring = $this->db_implode($this->allowedCountries()); 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 ('Language display settings', 'MODULE_PAYMENT_ICEPAY_LANGUAGE', '".$this->default_language."', 'Set the language. Default setting is current OSCommerce language.', '6', '1', 'tep_cfg_select_option(array(".$this->languages_dbstring."), ', 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 ('Currency', 'MODULE_PAYMENT_ICEPAY_CURRENCY', '".$this->default_currency."', 'Set the currency. Default setting is current OSCommerce currency.', '6', '1', 'tep_cfg_select_option(array(".$this->currencies_dbstring."), ', 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 ('Country', 'MODULE_PAYMENT_ICEPAY_COUNTRY', '".$this->default_country."', 'Set the country. Default setting is DETECT, using the country of the user.', '6', '1', 'tep_cfg_select_option(array(".$this->countries_dbstring."), ', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return array ( 'MODULE_PAYMENT_ICEPAY_STATUS', 'MODULE_PAYMENT_ICEPAY_MERCHANT_ID', 'MODULE_PAYMENT_ICEPAY_SECRET', 'MODULE_PAYMENT_ICEPAY_ORDER_STATUS_ID', 'MODULE_PAYMENT_ICEPAY_SUCCESS_ORDER_STATUS_ID', 'MODULE_PAYMENT_ICEPAY_CANCELLED_ORDER_STATUS_ID', 'MODULE_PAYMENT_ICEPAY_REFUND_ORDER_STATUS_ID', 'MODULE_PAYMENT_ICEPAY_CHARGEBACK_ORDER_STATUS_ID', 'MODULE_PAYMENT_ICEPAY_OPEN_ORDER_STATUS_ID', 'MODULE_PAYMENT_ICEPAY_SORT_ORDER', 'MODULE_PAYMENT_ICEPAY_SENDEMAIL_OK', 'MODULE_PAYMENT_ICEPAY_LANGUAGE', 'MODULE_PAYMENT_ICEPAY_CURRENCY', 'MODULE_PAYMENT_ICEPAY_COUNTRY' ); } function createOrder() { global $customer_id; global $languages_id; global $order; global $order_totals; global $order_products_id; global $order_total_modules; if (empty($order_totals)) { $order_total_modules = new icepay_order_total(); $order_totals = $order_total_modules->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' => $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(); 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); } $sql_data_array = array('orders_id' => $insert_id, 'orders_status_id' => $order->info['order_status'], 'date_added' => 'now()', 'customer_notified' => '0', 'comments' => $order->info['comments']); tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array); 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']; } } } $this->order_id = $insert_id; } function getLanguage() { return MODULE_PAYMENT_ICEPAY_LANGUAGE; } function getChecksum( $amount, $icepay_language, $icepay_country, $icepay_currency) { $checksum = sha1(MODULE_PAYMENT_ICEPAY_MERCHANT_ID . "|" . MODULE_PAYMENT_ICEPAY_SECRET . "|" . $amount . "||" . $this->order_id . " " . $icepay_language . "|" . $icepay_currency . "|" . $icepay_country ); return $checksum; } function getOrderAmount() { global $order, $currencies; $amount = number_format($order->info['total'] * $currencies->get_value(DEFAULT_CURRENCY), $currencies->currencies[DEFAULT_CURRENCY]['decimal_places'], '.', '') * 100; return $amount; } // Functions added function GetCoreClasses() { return array ( 'icepay.php', 'icepay_cc.php', 'icepay_ddebit.php', 'icepay_ideal.php', 'icepay_pbar.php', 'icepay_wallie.php', 'icepay_wire.php', 'icepay_sms.php', 'icepay_giropay.php', 'icepay_ebanking.php', 'icepay_fasterpay.php', '../../../ext/modules/payment/icepay/notify.php', '../../../ext/modules/payment/icepay/icelib.php' ); } function generateFingerPrint() { if ( $this->fingerPrint != "" ) return $this->fingerPrint; $content = ""; foreach ( $this->GetCoreClasses() as $item ) { //echo (dirname(__FILE__).'/'.$item.'<BR>'); if ( false === ($content .= file_get_contents( dirname(__FILE__).'/'.$item ))) { }; }; //if ( false === ($content .= file_get_contents( dirname(__FILE__).'/'.$item ))) //throw new Exception( "Could not generate fingerprint" ); $this->fingerPrint = sha1($content); return $this->fingerPrint; } function db_implode($array) { $str = ''; $lem = array_keys($array); $char = htmlentities(', '); for($i=0;$i<sizeof($lem);$i++) { $str .= "\'".(($i == sizeof($lem)-1) ? $array[$lem[$i]]."\'" : $array[$lem[$i]]."\'".$char); } return $str; } function allowedCurrencies() { return array( 'DETECT', 'EUR', 'GBP', 'USD', 'AUD', 'CAD', 'CHF', 'CZK', 'PLN', 'SKK', 'MXN', 'CLP', 'LVL' ); } function allowedIssuers() { return array(); } function allowedCountries() { return array( 'DETECT', '00', 'NL', 'AT', 'AU', 'BE', 'CA', 'CH', 'CZ', 'DE', 'ES', 'IT', 'LU', 'PL', 'PT', 'SK', 'UK', 'US', 'FR' ); } function allowedLanguages() { return array( 'DETECT', 'EN', 'DE', 'NL' ); } function getDefaultLanguage() { // getLanguage() function is altered to return the icepay setting to all modules global $languages_id; $query = tep_db_query("select languages_id, name, code, image, directory from " . TABLE_LANGUAGES . " where languages_id = " . $languages_id . " limit 1"); if ($languages = tep_db_fetch_array($query)) { return strtoupper($languages['code']); } return "EN"; } function getUserLanguage($savedSetting) { if ($savedSetting != "DETECT"){ return $savedSetting; } global $languages_id; $query = tep_db_query("select languages_id, name, code, image, directory from " . TABLE_LANGUAGES . " where languages_id = " . $languages_id . " limit 1"); if ($languages = tep_db_fetch_array($query)) { return strtoupper($languages['code']); } return "EN"; } function getUserCountry($savedSetting) { if ($savedSetting != "DETECT"){ return $savedSetting; } global $customer_country_id; $query = tep_db_query("select countries_iso_code_2 from " . TABLE_COUNTRIES . " where countries_id = " . $customer_country_id . " limit 1"); if ($countries = tep_db_fetch_array($query)) { return strtoupper($countries['countries_iso_code_2']); } return "NL"; } function getUserCurrency($savedSetting) { if ($savedSetting != "DETECT"){ return $savedSetting; } global $currency; return $currency; } } // class } // if ?>
  3. Hello, Great job on this wonderful contribution, its really useful! i am having one problem with a payment method "Icepay", the problem is when the address fields and other fields are saved in the onepagecheckout, then there is no problem selecting and proccesing the payment through Icepay. But when a new costumer tries to fill in the fields and selects Icepay as the method it gives an error on the next page... this is the error: 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 'limit 1' at line 1 select countries_iso_code_2 from countries where countries_id = limit 1 [TEP STOP] it would be great if you could have a solution for this, you can take a look at our test store on this url: http://okesite.com/catalog1/product_info.php?products_id=28 I hope you, or someone else will be able to help, thanks in advance.
×
×
  • Create New...