My Class, has methods that are fine and others that don't work at all. My problem is while I debug it, I don't get any output just a blank page:
<?php
class ic {
var $code, $title, $description, $enabled;
//Test variable to check output
var $test = 5;
/* Curl method not used in this version so far
I am trying to find out a way to submit the data, stucked with a blank page!!!
function https_send($params)
{
$test_mode=0;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://www.internationalcheckout.com/cart.php");
// Seed cURL connection options
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POST, 1);
// Create iData packet from individual fields...
$idata=implode(",",$params["iData"]);
// Compose and send POST message
curl_setopt($ch, CURLOPT_POSTFIELDS, 'Company=' . $params["iccompany"] . '&iData=' . $idata);
$result=curl_exec ($ch);
curl_close ($ch);
return $result;
}*/
// Sets the class code, description, and status.
//This is working the module was properly installed and inititialised in Admin
function ic() {
global $order;
$this->code = 'ic';
if (IS_ADMIN_FLAG === true) {
// Payment module title in Admin
$this->title = MODULE_PAYMENT_IC_TEXT_ADMIN_TITLE;
} else {
$this->title = MODULE_PAYMENT_IC_TEXT_CATALOG_TITLE;
}
$this->description = MODULE_PAYMENT_IC_TEXT_DESCRIPTION;
$this->sort_order = MODULE_PAYMENT_IC_SORT_ORDER;
$this->enabled = ((MODULE_PAYMENT_IC_STATUS == 'True') ? true : false);
if ((int)MODULE_PAYMENT_IC_ORDER_STATUS_ID > 0) {
$this->order_status = MODULE_PAYMENT_IC_ORDER_STATUS_ID;
}
if (is_object($order)) $this->update_status();
}
// class methods
// There is no need to update status all info is transmitted to the other server
function update_status() {
return false;
}
// No need to check user input submited on checkout_payment.php with javascript (client-side).
function javascript_validation() {
return false;
}
function selection() {
return false;
}
function pre_confirmation_check() {
return false;
}
function confirmation() {
return false;
}
//Prepare the data from the cart to be transmited
function process_button() {
global $_SERVER, $product;
$products = $_SESSION['cart']->get_products();
for ($i=0, $n=sizeof($products); $i<$n; $i++) {
$productsImage = (IMAGE_SHOPPING_CART_STATUS == 1 ? zen_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], IMAGE_SHOPPING_CART_WIDTH, IMAGE_SHOPPING_CART_HEIGHT) : ''); // This checks the cart status and retrieves the image location using the function zen_image
$quantityField = zen_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"');// quantity in cart
$productsPrice = $currencies->display_price($products[$i]['final_price'], zen_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . ($products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->display_price($products[$i]['onetime_charges'], zen_get_tax_rate($products[$i]['tax_class_id']), 1) : ''); // This checks for additional charges and taxes
$productsPriceEach = $currencies->display_price($products[$i]['final_price'], zen_get_tax_rate($products[$i]['tax_class_id']), 1) . ($products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->display_price($products[$i]['onetime_charges'], zen_get_tax_rate($products[$i]['tax_class_id']), 1) : '');// Calculates the individual product final price
/* Create a smaller Array to hold just the data above
and as is in a loop store all the list iterations, if the user orders more products*/
$productArray[$i] = array( 'productsImage'=>$productsImage,
'productsName'=>$productsName,
'quantityField'=>$quantityField,
'productsPrice'=>$productsPrice,
'productsPriceEach'=>$productsPriceEach,
'rowClass'=>$rowClass,
'id'=>$products[$i]['id']);
} // end FOR loop
//Traverse the array to check if cart data is there during test mode it will be removed after fixing
// So far it's not displaying anything a blank page
foreach ($productArray as $key => $value) {
echo $key . " >" . $value . "<br />";
// Comment the string until it has proper form
// This var holds the hidden fields within the form
/*$process_button_string = zen_draw_hidden_field('ItemQuantity',$product['quantityField']).
zen_draw_hidden_field('ItemImage',$product['productsImage']) .
zen_draw_hidden_field('ItemDescription',$product['productsName']) .
zen_draw_hidden_field('ItemPrice',$product['productsPrice']);
// echo $process_button_string;
// $process_button_string .= zen_draw_hidden_field(zen_session_name(), zen_session_id());
return $process_button_string;*/
}
}
// !Functions to execute before processing the order
function before_process() {
return false;
}
/* global $_POST;
$params['iccompany']= MODULE_PAYMENT_IC_COMPANY;
$params['ItemQuantity'] = $_POST['ItemQuantity'];
$params['ItemImage'] = $_POST['ItemImage'];
$params['ItemDescription'] = $_POST['ItemDescription'];
$params['ItemPrice'] = $_POST['ItemPrice'];
$params['iccompany'] = urlencode($params['iccompany']);
$params['iData'][0] = urlencode($params['ItemQuantity']);
$params['iData'][1] = urlencode($params['ItemImage']);
$params['iData'][2] = urlencode($params['ItemDescription']);
$params['iData'][3] = urlencode($params['ItemPrice']);
*/
// remove params with empty values
/* foreach ($params as $key => $value) {
if (!$value) {
unset($params[$key]);
}*/
function after_process() {
return false;
}
/* function get_error() {
global $_GET;
$error = array('title' => "ERROR",
'error' => stripslashes(urldecode($_GET['error'])));
return $error;
}*/
// Admin mod section ---
// Working, successful installation in test server
function check() {
global $db;
if (!isset($this->_check)) {
$check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_IC_STATUS'");
$this->_check = $check_query->RecordCount();
}
return $this->_check;
}
function install() {
global $db;
/* zen_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Allow International Checkout', 'MODULE_PAYMENT_IC_STATUS', 'True', 'Do you want to accept International Checkout payments?', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())");
zen_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('International Checkout Company', 'MODULE_PAYMENT_IC_COMPANY', '', 'Company used for International Checkout payments', '6', '0', now())");*/
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable International Checkout Module', 'MODULE_PAYMENT_IC_STATUS', 'True', 'Do you want to accept International Checkout payments?', '6', '130', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())");
$db->Execute("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_IC_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '131' , now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('International Checkout Company ID', 'MODULE_PAYMENT_IC_COMPANY', '', 'Company used for International Checkout payments', '6', '132', now())");
}
function remove() {
$db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
function keys() {
return array('MODULE_PAYMENT_IC_STATUS', 'MODULE_PAYMENT_IC_SORT_ORDER', 'MODULE_PAYMENT_IC_COMPANY');
}
}
?>
Code and comments continues next