Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

One Page Checkout Support


Guest

Recommended Posts

Two questions:

 

Firstly, does One Page Checkout work with any of the PayPal IPN modules? If so, which one?

 

Secondly...what are these new files in the One Page Checkout contrib referencing PayPal Express?

 

PayPal Express is an alternative checkout. You put an item in your cart, click on a PayPal Express button located under your cart...and go straight to PayPal. It bypasses any checkout procedure you have installed.

 

Or is this something different that they have chosen to call PayPal Express? Confused.

 

- Andrea

Hi Andrea,

 

I did a file compare there are no changes made to paypal express module, must have been left in by mistake im guessing don't worry about that file

 

Steve

Link to comment
Share on other sites

Hi Steve,

 

Why are they working on the inclusion of other coupon modules and payment modules and not addressing the problems with PayPal IPN?

 

I mean...any website owner worth their salt has a PayPal IPN module installed, not PayPal Standard. Wish I had a buck for every customer that paid for something and did not complete checkout to kick off the order processing in Admin. God bless PayPal IPN. They need to address that.

 

This checkout could be great, but until it works with any version of PayPal IPN...forget it.

 

- Andrea

Link to comment
Share on other sites

Steve I really need some help with understanding why tax calculation suddenly disappeared from the checkout page...this is the major issue I am experiencing before going live and it seems really hard to troubleshot...

in the effort to solve my problem I just tried to install the latest release of onepage checkout as you also suggested, but had a bunch of errors...so I switched back to my old files and the store checkout works fine...except it does not display any tax charges at all...

i have tax set up in the admin panel and reviewed other forum posts about missing tax information...everything seems fine on my admin panel side...

the fact is that tax were "working" before, but the store was adding CT tax to all my orders even if the "customer" state was different...tax were added as soon as entering the checkout page without logging in or typing any address...

so I deleted all my tax settings in admin panel and created new ones from scratch...from that time no tax are calculated at checkout anymore...

dont really know where to start to troubleshoot this...

any additional help you or someone else reading can provide me?

Link to comment
Share on other sites

Hi Steve,

 

Why are they working on the inclusion of other coupon modules and payment modules and not addressing the problems with PayPal IPN?

 

I mean...any website owner worth their salt has a PayPal IPN module installed, not PayPal Standard. Wish I had a buck for every customer that paid for something and did not complete checkout to kick off the order processing in Admin. God bless PayPal IPN. They need to address that.

 

This checkout could be great, but until it works with any version of PayPal IPN...forget it.

 

- Andrea

Hi Andrea,

 

Paypal standard is meat to be api same as paypal ipn, but you have to set up the api in paypal also im not to sure if many have had much success getting paypal standard to work with even normal osc

 

Also it now has code for CCGV and the KGT coupon, i wish they would include coupons by ingo

 

Steve

Edited by steve_s
Link to comment
Share on other sites

Steve I really need some help with understanding why tax calculation suddenly disappeared from the checkout page...this is the major issue I am experiencing before going live and it seems really hard to troubleshot...

in the effort to solve my problem I just tried to install the latest release of onepage checkout as you also suggested, but had a bunch of errors...so I switched back to my old files and the store checkout works fine...except it does not display any tax charges at all...

i have tax set up in the admin panel and reviewed other forum posts about missing tax information...everything seems fine on my admin panel side...

the fact is that tax were "working" before, but the store was adding CT tax to all my orders even if the "customer" state was different...tax were added as soon as entering the checkout page without logging in or typing any address...

so I deleted all my tax settings in admin panel and created new ones from scratch...from that time no tax are calculated at checkout anymore...

dont really know where to start to troubleshoot this...

any additional help you or someone else reading can provide me?

Does tax work on normal checkout? if not its to do with admin, make sure tax order total is set to display = true, also in tax zones you setup country then click on the country to go into and add state to the country to apply tax

 

Steve

Link to comment
Share on other sites

Does tax work on normal checkout? if not its to do with admin, make sure tax order total is set to display = true, also in tax zones you setup country then click on the country to go into and add state to the country to apply tax

 

Steve

 

Steve no tax in normal checkout...can you suggest me where to look into admin files?

Link to comment
Share on other sites

Thanks Steve...I fixed the tax issue...

almost ready to go live...but I was not able to solve the problem with the error I get after completing the transaction and clicking on the paypal "return to the merchant website" button

Before it used to take me back to the cart...now I received an error that says:

 

Fatal error: Call to a member function on a non-object in /homepages/5/d180349627/htdocs/domainname.com/e-store/includes/modules/payment/paypal_standard.php on line 522

 

The file I see on the address bar when the error is displayed is checkout_process.php and the error instead refers to paypal_standard.php line 522

which corresponds to this line of code:

 

$sendToFormatted = $onePageCheckout->getAddressFormatted('sendto');

 

any idea of what is causing it?

I tried to install the new onepage checkout version, but I get other errors so I would like to stick with this one I have now since it is working almost fine except for this error...

Link to comment
Share on other sites

Thanks Steve...I fixed the tax issue...

almost ready to go live...but I was not able to solve the problem with the error I get after completing the transaction and clicking on the paypal "return to the merchant website" button

Before it used to take me back to the cart...now I received an error that says:

 

Fatal error: Call to a member function on a non-object in /homepages/5/d180349627/htdocs/domainname.com/e-store/includes/modules/payment/paypal_standard.php on line 522

 

The file I see on the address bar when the error is displayed is checkout_process.php and the error instead refers to paypal_standard.php line 522

which corresponds to this line of code:

 

$sendToFormatted = $onePageCheckout->getAddressFormatted('sendto');

 

any idea of what is causing it?

I tried to install the new onepage checkout version, but I get other errors so I would like to stick with this one I have now since it is working almost fine except for this error...

Yes its the code you added in that file for paypal standard remove it

/* One Page Checkout - BEGIN */
 $sendToFormatted = tep_address_label($customer_id, $sendto, 0, '', "\n");
 if (ONEPAGE_CHECKOUT_ENABLED == 'True'){
     $sendToFormatted = $onePageCheckout->getAddressFormatted('sendto');
 }

 $billToFormatted = tep_address_label($customer_id, $billto, 0, '', "\n");
 if (ONEPAGE_CHECKOUT_ENABLED == 'True'){
     $billToFormatted = $onePageCheckout->getAddressFormatted('billto');
 }
/* One Page Checkout - END */

 

Steve

Link to comment
Share on other sites

Two questions:

 

Firstly, does One Page Checkout work with any of the PayPal IPN modules? If so, which one?

 

Secondly...what are these new files in the One Page Checkout contrib referencing PayPal Express?

 

PayPal Express is an alternative checkout. You put an item in your cart, click on a PayPal Express button located under your cart...and go straight to PayPal. It bypasses any checkout procedure you have installed.

 

Or is this something different that they have chosen to call PayPal Express? Confused.

 

- Andrea

 

one: the paypal_standard that OPC supports does IPN notifications, it is just not called "Paypal IPN" it is the best one created by the OSC team and included in the RC 2.2a http://www.oscommerce.com/community/contributions,5655/category,1/search,paypal+standard

 

two: for those that want to use paypal express with one page checkout, there had to be some changes to the express module since it returns the user to checkout_confirmation.php from the regular 4 step checkout. If you use it then install the express module included with the OPC distribution.

Link to comment
Share on other sites

Yes its the code you added in that file for paypal standard remove it

/* One Page Checkout - BEGIN */
 $sendToFormatted = tep_address_label($customer_id, $sendto, 0, '', "\n");
 if (ONEPAGE_CHECKOUT_ENABLED == 'True'){
     $sendToFormatted = $onePageCheckout->getAddressFormatted('sendto');
 }

 $billToFormatted = tep_address_label($customer_id, $billto, 0, '', "\n");
 if (ONEPAGE_CHECKOUT_ENABLED == 'True'){
     $billToFormatted = $onePageCheckout->getAddressFormatted('billto');
 }
/* One Page Checkout - END */

 

Steve

 

Hi Steve and thanks, paypal page brings me back to the cart as before...I will look into the PayPal settings to see if I can set a different URL there...

 

Meanwhile I just noticed that when placing an order and the cart is correctly displaying the tax amount, if I click on "change address" button and input a new shipping address in a different state, the cart does not delete and update the order total. The tax are still there when instead they should disappear and be subracted from the total...

 

Was this issue addressed in the new release?

Anything you can suggest me?

Link to comment
Share on other sites

Yes its the code you added in that file for paypal standard remove it

/* One Page Checkout - BEGIN */
 $sendToFormatted = tep_address_label($customer_id, $sendto, 0, '', "\n");
 if (ONEPAGE_CHECKOUT_ENABLED == 'True'){
     $sendToFormatted = $onePageCheckout->getAddressFormatted('sendto');
 }

 $billToFormatted = tep_address_label($customer_id, $billto, 0, '', "\n");
 if (ONEPAGE_CHECKOUT_ENABLED == 'True'){
     $billToFormatted = $onePageCheckout->getAddressFormatted('billto');
 }
/* One Page Checkout - END */

 

Steve

 

 

Hi Steve

one more thing

I would like to change this text for the PayPal payment

" PayPal (including Credit Cards and Debit Cards)" and maybe display the paypal credit cards logo there...

can you tell me where I can modify this?

 

payment.jpg

 

I was able to find where to change "SELECT PAYMENT" and the "These are the payment methods available to place your order." text...

I have added a screen capture to be more precise...

thank you...

Link to comment
Share on other sites

Hi Steve

one more thing

I would like to change this text for the PayPal payment

" PayPal (including Credit Cards and Debit Cards)" and maybe display the paypal credit cards logo there...

can you tell me where I can modify this?

 

payment.jpg

 

I was able to find where to change "SELECT PAYMENT" and the "These are the payment methods available to place your order." text...

I have added a screen capture to be more precise...

thank you...

Hi

 

catalog/includes/languages/english/modules/payments/

what ever paypal module you are using

 

Steve

Link to comment
Share on other sites

Hi,

 

I've just installed the one page checkout on my site (however its currently disabled) and its not showing addresses on the site, It's loading up perfectly, and its loading up the billing and shipping address fields, but when I got to change address etc... it only shows up my name (the clients name) and then the company name, not anything to do with address, postcode, city etc...

 

can anyone help ?

 

Mark

Link to comment
Share on other sites

Hi,

 

I've just installed the one page checkout on my site (however its currently disabled) and its not showing addresses on the site, It's loading up perfectly, and its loading up the billing and shipping address fields, but when I got to change address etc... it only shows up my name (the clients name) and then the company name, not anything to do with address, postcode, city etc...

 

can anyone help ?

 

Mark

Hi Mark

 

do you have country state drop down installed?

 

Steve

Link to comment
Share on other sites

Anyone else getting the "There was an error setting payment method, please inform IT Web Experts about this error." when you click the credit card as your payment option? Also I noticed when you click paypal as your payment option the credit card slot where your info goes disappears and when you click the credit card it doesn't pop back up unless you refresh the page.

Link to comment
Share on other sites

 

Issue 2 is abouth coupon code.

I dont have it installed , however it trowes me a error

Table 'xhtmlcatalog.table_coupon_gv_customer' doesn't exist select amount from TABLE_COUPON_GV_CUSTOMER where customer_id = '2' [TEP STOP]

 

I'm using the latest version : One Page Checkout 1.1

 

Thanks in advance

I'm having this problem as well.

Link to comment
Share on other sites

Hello,

 

I've just installed this module and it's mostly functional. It's a great contribution, but I'm experiencing some minor issues:

 

With One Page Checkout enabled:

1. If the customer fills cart and enter all required information, everything goes fine except when they click the continue button they're returned to the checkout page. No order or information is posted in admin.

 

2. The email field remains filled with previous customer's email address. The next customer sees a 'Email address already exists, please login to use a different address' message box.

 

With One Page Checkout disabled: (OPC remains enabled and it seems to work better disabled in admin.)

1. If the customer fills the cart and enter all required information and click the continue button they're taken to the Create Account page. Once all the information is entered and click continue they're taken back to checkout.php the only thing that is pre-filled is the email field.

 

2. The email field remains filled with previous customer's email address. The next customer sees a 'Email address already exists, please login to use a different address' message box.

 

3. The order goes through, customers receive welcome email and all information goes where it should.

 

 

I got the coupon module CCGV working perfectly and I left One Page Checkout disabled in admin so orders can come through.

 

Thanks for any help given.

 

I would like to get this working so the customer can feel safe and have more control over the checkout process.

Edited by discxpress
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
?>

Edited by samie
Link to comment
Share on other sites

Hello @all

 

Good contribution ... but having SO FAR 2 issues.

 

I'm using STS , i managed to get it work with whenever a "Guest" places an order.

But when the user is logged , and try to goto the checkout he see only the header and below is al blank.

In FF webdev add-on ,view source , all data is loaded.

When i disable sts all shows up.

 

I understand it is a sts issue ,ive readed the posts abouth sts but i didnt see this bug in the posts ( i readed them all).

 

Issue 2 is abouth coupon code.

I dont have it installed , however it trowes me a error

Table 'xhtmlcatalog.table_coupon_gv_customer' doesn't exist select amount from TABLE_COUPON_GV_CUSTOMER where customer_id = '2' [TEP STOP]

 

I'm using the latest version : One Page Checkout 1.1

 

Thanks in advance

Hi simpleist solution i have been told is to add the 2 defines in catalog/includes/database_tables.php

ie

define(TABLE_COUPON_GV_CUSTOMER,'');

 

i have not tried this, but is what someone recommended

 

or simply remove the code for KGT_discount

Steve

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...