Jump to content

Archived

This topic is now archived and is closed to further replies.

PupStar

One Page Checkout for osCommerce 2.3.1

Recommended Posts

At a quick glance it looks as though you have not installed it correctly as when going to the checkout it still takes me to the login page.

 

Mark

 

:blink: If you go to http://rasadesign.com/catalog_2_3_1/index.php?cPath=22 and continue from there, you'll end up on OPC. If you clicked from the front page on an image, or "store" then you got sent to http://pbroadwayinc.org. Sorry. I didn't bother to change the hard links when I created the demo version on my site.

 

On the rasadesign version, you get to the OPC. In any case, there are various problems with the page and I may have been just staring at it, too long.

Share this post


Link to post
Share on other sites

:blink: If you go to http://rasadesign.com/catalog_2_3_1/index.php?cPath=22 and continue from there, you'll end up on OPC. If you clicked from the front page on an image, or "store" then you got sent to http://pbroadwayinc.org. Sorry. I didn't bother to change the hard links when I created the demo version on my site.

 

On the rasadesign version, you get to the OPC. In any case, there are various problems with the page and I may have been just staring at it, too long.

 

Have you made the changes in all the files to modify because when I view your page source the javascript that should be in template_top.php seems to be missing.

 

Mark

Share this post


Link to post
Share on other sites

One thing that is obvious is you don't have the jquery css linked. The jquery functions do not work correctly if a correct version of the css is not linked. On one page I know it was there but commented out.


I'm not really a dog.

Share this post


Link to post
Share on other sites

First of all, thanks for all the hard work, by creating this contri!

 

I've got the same problems as Tabula_Rasa.

How can I get the zipcode above the city and the country menu at the bottom?

 

And how do I remove the change adres buttons?

 

Here's an example http://www.wiflex.nl/shop/catalog/

 

Arjan

Share this post


Link to post
Share on other sites

First of all, thanks for all the hard work, by creating this contri!

 

I've got the same problems as Tabula_Rasa.

How can I get the zipcode above the city and the country menu at the bottom?

 

And how do I remove the change adres buttons?

 

Here's an example http://www.wiflex.nl/shop/catalog/

 

Arjan

 

ok to change the layout open catalog/includes/checkout/billing_address_vertical.php (or billing_address_horizontal.php)

 

Find:

 

 <?php
if(ONEPAGE_ZIP_BELOW == 'True'){
?>
 <tr>
     <td class="main"><?php echo ENTRY_POST_CODE ?></td>
     <td class="main"><?php echo tep_draw_input_field('billing_zipcode', (isset($billingAddress) ? $billingAddress['postcode'] : ''), 'class="required" style="width:80%;float:left;"'); ?></td>
 </tr>
<?php
}
?>

 

you can then move this to where ever you need to place it.

 

Regards

 

Mark

Share this post


Link to post
Share on other sites

The double change-adress button.

 

in checkout.php

 


<?php
 if ($onepage['shippingEnabled'] === true){
$header = TABLE_HEADING_SHIPPING_ADDRESS;
ob_start();
include(DIR_WS_INCLUDES . 'checkout/shipping_address.php');
$shippingAddress = ob_get_contents();
ob_end_clean();
	if (!tep_session_is_registered('customer_id')){
$shippingAddress .= '<div style="float:right">'. tep_draw_button(IMAGE_BUTTON_CHANGE_ADDRESS, 'home', tep_href_link(FILENAME_CHECKOUT_SHIPPING_ADDRESS, '', 'SSL')).'</div>';
		$shippingAddress = '<table border="0" width="100%" cellspacing="0" cellpadding="2">
		 <tr>
		  <td class="main">' . TEXT_DIFFERENT_SHIPPING . ' <input type="checkbox" name="diffShipping" id="diffShipping" value="1"></td>
		 </tr>
		</table>' . $shippingAddress;
	}
$shippingAddress .= '<div style="float:right">'. tep_draw_button(IMAGE_BUTTON_CHANGE_ADDRESS, 'home', tep_href_link(FILENAME_CHECKOUT_SHIPPING_ADDRESS, '', 'SSL')).'</div>';
buildInfobox($header, $shippingAddress);
 }
?>
</div>

 

replace with

 


<?php
 if ($onepage['shippingEnabled'] === true){
$header = TABLE_HEADING_SHIPPING_ADDRESS;
ob_start();
include(DIR_WS_INCLUDES . 'checkout/shipping_address.php');
$shippingAddress = ob_get_contents();
ob_end_clean();
		$shippingAddress = '<table border="0" width="100%" cellspacing="0" cellpadding="2">
		 <tr>
		  <td class="main">' . TEXT_DIFFERENT_SHIPPING . ' <input type="checkbox" name="diffShipping" id="diffShipping" value="1"></td>
		 </tr>
		</table>' . $shippingAddress;
$shippingAddress .= '<div style="float:right">'. tep_draw_button(IMAGE_BUTTON_CHANGE_ADDRESS, 'home', tep_href_link(FILENAME_CHECKOUT_SHIPPING_ADDRESS, '', 

'SSL')).'</div>';
buildInfobox($header, $shippingAddress);
 }
?>
</div>

Share this post


Link to post
Share on other sites

John W and Pupstar: Thank you. That worked. I'm now rewriting the whole thing to avoid the infobox tables and limit the layout to label and form field tags. I'll post when I get it cleaned up.

Share this post


Link to post
Share on other sites

ok, it works. That said, there's a LOT of issues and I'd like to contribute. I would need help with a JavaScript issue to make a truly tableless version of this, but even if you're not cool with pure tableless, there's a lot of coding mistakes. For example, html rather than xhtml use of the BR tag, not putting the form ID in quotes, etc.

 

In making the contribution tableless, one issue is that the javascript targets the table after the DIV with the ID, "shippingAddress" .. and I don't know JS enough to untangle it. :D To merely eliminate the table destroys the layout.

 

If anyone is willing to work with me on this, I have a LOT of motivation to make this work...

Share this post


Link to post
Share on other sites

Torgrim,

 

If you are runing on a server using Mod_suphp, and you should be, check your permissions for the files and folders you uploaded. Suphp will error 500 if permissions are too high, so php files must be 600 or lower and folders must be 755 or lower. Just a thought.

 

You can also try setting only one simple payment like COD and a simple shipping.

 

Thanks, for your answer. But I still gets som problems, so there must be some thing more that is wrong.

 

Best regards

Torgrim Andersen

Share this post


Link to post
Share on other sites

Hi

 

I run OsC 2.3.1 with “Credit Class & Gift Voucher” and “One Page Checkout”. My customers have problems with the checkout process.

 

If I am turning “One Page Checkout” off, then my customers gets stuck when they try to press the continue button on the page: checkout_payment.php that triggers the code:

<form name="checkout_payment" action="http://suncare.no/shop/checkout_confirmation.php" method="post" onsubmit="return check_form();"> 

 

I can manually run the file checkout_confirmation.php but when I then press the final button for open the file checkout_process I get a 500 error. (my fileattributes are 644)

The button in checkout_confirmation.php is trying to execute the code:

 

<form name="checkout_confirmation" action="http://suncare.no/shop/checkout_process.php" method="post"><input type="hidden" name="gv_redeem_code" />

 

If I turn on “One Page Checkout” I get an error on "invoice" payment method.

 

If I select "PayPal" I will get the following error message on the PayPal page: “The link that you used to go to the PayPal system includes an amount that is incorrectly formatted.”

 

Does any have an idea of how I can fix this problem or know of a working version of OsC 2.3.1 with Credit Class & Gift Voucher and One Page Checkout installed? :-"

 

Best regards

Torgrim Andersen

Norway

Share this post


Link to post
Share on other sites

Authorize.net works for me with OPC 1.4 in OSC 2.2rc2a, AND OPC 1.5 in OSC 2.3.1. None of the existing modules works with OPC, nor do any of the fixes which have been presented in the original support forums.

 

Here is my authorize.net CC module that I'm using with OPC 1.4 in osc 2.2rc2a. If it doesn't work in your version, let me know. My other script is significantly different.

 

OK, so I am using OPC 1.4 and OSC 2.2rc2, and I tried pasting this script in place of the stock authorize.net contribution... for some reason, when I have authorize.net set as the payment option, the CC info form never appears. Am I missing something blindingly obvious, or do I have to start pasting in code? (If the latter, what code would you like to see?)

Share this post


Link to post
Share on other sites

Hello,

 

I have installed one page checkpout in my store 2.3.1

Now i don't know how to get my discount code contri to work withe the one page checkout.

Can anyone help me with this?

 

Thank you

Share this post


Link to post
Share on other sites

Hi guys,

 

I have almost complete the implementation of OPC.

Unfortunately I am still having few issues.

 

My OPC include the add-on UK Postcode Address Finder provided by craftyclicks

 

http://www.oscommerce.com/community/contributions,6322

 

Everything seems work fine but once you search for the address using the postcode and then select the correct one, the fields Street Address and City get filled but OPC does not check them. If I finalize the checkout I get the error message saying that the Billing Addrees has not been inserted.

 

The workaround that I have found require to simply click on the form Street Address and the click on another form.

I suspect that the Javascript that get trigger once you type in, does not get trigger when select the address for UK Postcode Address FInder contribution.

 

Can anyone point me out in where I can find the code that trigger the check and verify if the address inserted is valid?

Any ideas on how to fix this?

 

Thanks in advance for your help.

Kind Regards

JK

Share this post


Link to post
Share on other sites

farbor, please do not double post! :angry:

 

Your question will not get answered any quicker by doing so!

Share this post


Link to post
Share on other sites

Hi,

 

Apology for the inconvinient, did not mean to post twice in order to get a quick answer.

I was not sure where to post it and I thought they were two completely separate threads.

 

My solution is using 2.3.1 version but is not 2.2 OsCommerce so I was not sure in which one of the two forum I should have posted.

 

Everything is working fine, it is just the javascript that check the address and that should choose the payment and the shipping method that do not get triggered, I suspect due to the fact that the code expect an onblur action.

 

I suspect there will be two possible solution (suggested by the Craftclicks team):

 

1. attach an 'on_result_selected' event to our code and try to trigger the relevant OPC onblur events for each address line. This could get messy. Form what I can remember this can lead to lengthy update loops in the JS.

 

2. try to find the places in OPC code where it checks individual fields and tweak it so it doesn't rely on onblur having triggered, but actually looks at the value of the field! This would be the proper fix if you can find the right place in OPC code to make the change.

 

Any idea in which part of the code should I apply those change? Sorry but I am not really good with javascript....

 

Thanks in advance for your help and sorry again for having double quote the problem (not my intention)

 

Kind Regards

JK

Share this post


Link to post
Share on other sites

I had 2.2Rc2a with OPC 1.3 working. But tried to upgrade to OPC 1.5 and have one issue.

 

The payment CC info displays for a second then the inputs disappear. The Label text still displays but I cannot input the cc info.

 

If I change the Billing info and hit confirm, it goes through the recalculation process and when it gets between "Setting Payments" and "Updating Order Totals"

the CC info goes away. The header and Label Text looks fine. The totals calculate fine.

 

By the way, I am using AuthorizeNet_AIM_08-31-10. There appears to issues with Authorize.net as I've seen in the thread.

 

If I turn One page checkout "off" well everything works just fine..

 

Any clues?

Share this post


Link to post
Share on other sites

OK, so I am using OPC 1.4 and OSC 2.2rc2, and I tried pasting this script in place of the stock authorize.net contribution... for some reason, when I have authorize.net set as the payment option, the CC info form never appears. Am I missing something blindingly obvious, or do I have to start pasting in code? (If the latter, what code would you like to see?)

 

 

I have the same problem. I have OSC 2.2rc2a and OCP 1.5. I'm also using their newer AIM CC module.

All works fine when I turn off OCP.

 

There is some code that refreshes the payment info after displaying it initially. It appears for a short while at first , then it gets wiped out.

Share this post


Link to post
Share on other sites

Well, your file didn't work for me but it got me but it kinda got me on the right track and I have it working so I appreciate your help. See process_button below

FYI, you have an error around line 20, it should be

     if ((int)MODULE_PAYMENT_AUTHORIZENET_CC_AIM_ORDER_STATUS_ID > 0) {
       $this->order_status = MODULE_PAYMENT_AUTHORIZENET_CC_AIM_ORDER_STATUS_ID;
     }

 

Here is what needs to be in the stock authorizenet_cc_aim module

   function process_button() {
     // Hidden fields on the checkout confirmation page
     $process_button_string = tep_draw_hidden_field('cc_expires_month', $_POST['cc_expires_month']) .
                              tep_draw_hidden_field('cc_expires_year', $_POST['cc_expires_year'], -2) .
                              tep_draw_hidden_field('cc_number_nh-dns', $this->cc_number_nh-dns) .
                              tep_draw_hidden_field('cc_cvc_nh-dns', $_POST['cc_cvc_nh-dns']);


     return $process_button_string;
   }

Using the process_button code you listed worked for me. Thanks. I was keep on getting the credit card error and after sometimes trying to figure out what the problem is, it seems for some reason it was not picking up the credit card number, expiration date, etc when you click on the confirm button and your code solves this problem.

Share this post


Link to post
Share on other sites

Hey guys, just installed OPC on my oScommerce, however; I came to buy a test product and I input all the correct credit card information but it states that it is unable to process. This was working before with my Authorize.net payment module any clue on what exactly I may be looking for or what I may have done wrong? Thank you

Share this post


Link to post
Share on other sites

Hi guys,

 

Firstly I would like to say thank you for all the hard work put into building this - it is a great modification. I have been working on adding some further modifications to it and I have added a gift wrap hack that works great.

 

i now have a problem with working in the payment module for eway and I cannot find any posts to help me make this opc compatible so I am hoping for any advice! Pretty please!

 

the code I currently have for eway is :

 

<?php
/*
 $Id: eway.php,v 1.0 Exp $
 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com
 Copyright (c) 2002 osCommerce
 Released under the GNU General Public License
*/
 class eway
{
   var $code;	 // Module identifier
   var $title;	 // Module title
   var $description;    // Module description
   var $enabled;    // Status (1 = enabled, 0 = disabled)

   /* Data asked on form */

   var $cc_owner;   // Name as it appears on CC
   var $cc_number;   // CC number
   var $cc_expires_month;  // CC exp month
   var $cc_expires_year;  // CC exp year

   /* Default Constructor */

   function eway()
   {
   global $HTTP_POST_VARS;
    $this->code = 'eway';
    $this->title = MODULE_PAYMENT_EWAY_TEXT_TITLE;
    $this->description = MODULE_PAYMENT_EWAY_TEXT_DESCRIPTION;
    $this->enabled = MODULE_PAYMENT_EWAY_STATUS;
  $this->cc_owner = tep_db_prepare_input($HTTP_POST_VARS['eway_cc_owner']);
    $this->cc_number = tep_db_prepare_input($HTTP_POST_VARS['eway_cc_number']);
    $this->cc_expires_month = tep_db_prepare_input($HTTP_POST_VARS['eway_cc_expires_month']);
    $this->cc_expires_year = tep_db_prepare_input($HTTP_POST_VARS['eway_cc_expires_year']);
//Define the url to eway_payment.php on secure server
$this->form_action_url= HTTPS_SERVER . DIR_WS_HTTPS_CATALOG . 'eway_payment.php';
   }
// class methods
   function javascript_validation() {
  $js = '  if (payment_value == "' . $this->code . '") {' . "\n" .
	    '    var cc_owner = document.checkout_payment.eway_cc_owner.value;' . "\n" .
	    '    var cc_number = document.checkout_payment.eway_cc_number.value;' . "\n" .
	    '    var cc_cvv = document.checkout_payment.eway_cvn.value;' . "\n" .
	    '    if (cc_owner == "" || cc_owner.length < ' . CC_OWNER_MIN_LENGTH . ') {' . "\n" .
	    '	  error_message = error_message + "' . MODULE_PAYMENT_EWAY_TEXT_JS_CC_OWNER . '";' . "\n" .
	    '	  error = 1;' . "\n" .
	    '    }' . "\n" .
	    '    if (cc_number == "" || cc_number.length < ' . CC_NUMBER_MIN_LENGTH . ') {' . "\n" .
	    '	  error_message = error_message + "' . MODULE_PAYMENT_EWAY_TEXT_JS_CC_NUMBER . '";' . "\n" .
	    '	  error = 1;' . "\n" .
	    '    }' . "\n";
 $js .= '    if (cc_cvv == "" || cc_cvv.length < "3" || cc_cvv.length > "4") {' . "\n".
		   '	  error_message = error_message + "' . MODULE_PAYMENT_EWAY_TEXT_JS_CC_CVV . '";' . "\n" .
		   '	  error = 1;' . "\n" .
		   '    }' . "\n" .
		   '  }' . "\n";
  return $js;
   }
   function selection() {
  global $order;
  for ($i=1; $i<13; $i++) {
    $expires_month[] = array('id' => sprintf('%02d', $i), 'text' => strftime('%B',mktime(0,0,0,$i,1,2000)));
  }
  $today = getdate();
  for ($i=$today['year']; $i < $today['year']+10; $i++) {
    $expires_year[] = array('id' => strftime('%y',mktime(0,0,0,1,1,$i)), 'text' => strftime('%Y',mktime(0,0,0,1,1,$i)));
  }
  $selection = array('id' => $this->code,
					 'module' => $this->title,
					 'fields' => array(array('title' => MODULE_PAYMENT_EWAY_TEXT_CREDIT_CARD_OWNER,
											 'field' => tep_draw_input_field('eway_cc_owner', $order->billing['firstname'] . ' ' . $order->billing['lastname'])),
									   array('title' => MODULE_PAYMENT_EWAY_TEXT_CREDIT_CARD_NUMBER,
											 'field' => tep_draw_input_field('eway_cc_number')),
									   array('title' => MODULE_PAYMENT_EWAY_TEXT_CREDIT_CARD_EXPIRES,
											 'field' => tep_draw_pull_down_menu('eway_cc_expires_month', $expires_month) . ' ' . tep_draw_pull_down_menu('eway_cc_expires_year', $expires_year)),
									   array('title' => MODULE_PAYMENT_EWAY_TEXT_CVV,
											 'field' => tep_draw_input_field('eway_cvn','',"size=4, maxlength=4"))));
  return $selection;
   }
   function pre_confirmation_check() {
   global $HTTP_POST_VARS;
include(DIR_WS_CLASSES . 'cc_validation.php');
  $cc_validation = new cc_validation();
  $result = $cc_validation->validate($HTTP_POST_VARS['eway_cc_number'], $HTTP_POST_VARS['eway_cc_expires_month'], $HTTP_POST_VARS['eway_cc_expires_year']);
  $error = '';
  switch ($result) {
    case -1:
	  $error = sprintf(TEXT_CCVAL_ERROR_UNKNOWN_CARD, substr($cc_validation->eway_cc_number, 0, 4));
	  break;
    case -2:
    case -3:
    case -4:
	  $error = TEXT_CCVAL_ERROR_INVALID_DATE;
	  break;
    case false:
	  $error = TEXT_CCVAL_ERROR_INVALID_NUMBER;
	  break;
  }
  if ( ($result == false) || ($result < 1) ) {
    $payment_error_return = 'payment_error=' . $this->code . '&error=' . urlencode($error) . '&cc_owner=' . urlencode($HTTP_POST_VARS['eway_cc_owner']) . '&cc_expires_month=' . $HTTP_POST_VARS['eway_cc_expires_month'] . '&cc_expires_year=' . $HTTP_POST_VARS['eway_cc_expires_year'];
    tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false));
  }
  $this->cc_card_type = $cc_validation->cc_type;
  $this->cc_card_number = $cc_validation->cc_number;
   }
   function confirmation() {
  global $HTTP_POST_VARS;
	  $confirmation = array('title' => $this->title . ': ' . $this->cc_card_type,
					    'fields' => array(array('title' => MODULE_PAYMENT_EWAY_TEXT_CREDIT_CARD_OWNER,
											    'field' => $HTTP_POST_VARS['eway_cc_owner']),
										  array('title' => MODULE_PAYMENT_EWAY_TEXT_CREDIT_CARD_NUMBER,
											    'field' => substr($HTTP_POST_VARS['eway_cc_number'], 0, 4) . str_repeat('X',(strlen($HTTP_POST_VARS['eway_cc_number']) - 8)) . substr($HTTP_POST_VARS['eway_cc_number'], -4)),
										  array('title' => MODULE_PAYMENT_EWAY_TEXT_CREDIT_CARD_EXPIRES,
											    'field' => strftime('%m, %y', mktime(0,0,0,$HTTP_POST_VARS['eway_cc_expires_month'], 1, '20' . $HTTP_POST_VARS['eway_cc_expires_year']))),
	    array('title' => MODULE_PAYMENT_EWAY_TEXT_CVV,
											    'field' => $HTTP_POST_VARS['eway_cvn'])));

  return $confirmation;    }
   function process_button() {

    global $HTTP_POST_VARS, $HTTP_SERVER_VARS, $CardNumber, $order, $customer_id, $zone_id, $zone_query;
$year = $HTTP_POST_VARS['eway_cc_expires_year'];
$zone_query = tep_db_query("select * from zones where zone_name = '" . $order->delivery['state'] . "'");
	  if (tep_db_num_rows($zone_query) == 1) {
	    $zone_values = tep_db_fetch_array($zone_query);
	    $zone_id = $zone_values['zone_code'];
	  }
   else $zone_id='KA';
$amount = number_format($order->info['total'],2, '.', '');
$amount = $amount * 100;
    $process_button_string = tep_draw_hidden_field('my_customerid', MODULE_PAYMENT_EWAY_CUSTOMER_ID) .
    tep_draw_hidden_field('my_invoice_ref', $customer_id . '-' . date('Ymdhis')) .
    tep_draw_hidden_field('my_totalamount', $amount) .
    tep_draw_hidden_field('my_firstname', $order->customer['firstname']) .
    tep_draw_hidden_field('my_lastname', $order->billing['lastname']) .
    tep_draw_hidden_field('my_address', $order->billing['street_address']) .
    tep_draw_hidden_field('my_postcode', $order->customer['postcode']) .
																	  tep_draw_hidden_field('eWAYURL ', tep_href_link(FILENAME_CHECKOUT_PROCESS,'','SSL',false)) .
																	   tep_draw_hidden_field('eWAYAutoRedirect', '1') .
    tep_draw_hidden_field('my_email', $order->customer['email_address']) .
    tep_draw_hidden_field('my_card_name', $this->cc_owner) .
							 tep_draw_hidden_field('my_card_number', $this->cc_number) .
							 tep_draw_hidden_field('my_card_exp_month', $this->cc_expires_month) .
    tep_draw_hidden_field('my_card_exp_year', $year).
	 tep_draw_hidden_field('my_eway_cvn', $HTTP_POST_VARS['eway_cvn']).
tep_draw_hidden_field('my_ewayOption1', tep_session_id());

tep_draw_hidden_field('my_invoice_description', tep_session_id());


return $process_button_string;
   }
function get_error() {
  global $HTTP_GET_VARS;
  $error = array('title' => MODULE_PAYMENT_EWAY_TEXT_ERROR,
				 'error' => stripslashes(urldecode($HTTP_GET_VARS['error'])));
  return $error;
   }
   function before_process()
   {
  global $HTTP_GET_VARS;
   if ((!isset($HTTP_GET_VARS['authcode'])) || ($HTTP_GET_VARS['authcode'] == "") || ($HTTP_GET_VARS['status'] == "False") || ($HTTP_GET_VARS['order_id'] == '') || (!isset($HTTP_GET_VARS['order_id']))) {
   tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(MODULE_PAYMENT_EWAY_TEXT_ERROR), 'SSL', true, false));
  }
   }
   function after_process()
   {
    global $insert_id, $HTTP_GET_VARS;
$ewayid=$HTTP_GET_VARS['order_id'];
tep_db_query("UPDATE ".TABLE_ORDERS." SET eway_id = '".$ewayid."'  WHERE orders_id = '".$insert_id."'");
return false;
	 }   
   // Output error message if an error occurs with the process, or for failed
   // transactions with Payment Gateway

   function output_error()
   {
    global $HTTP_GET_VARS;
 }
   function check() {
  if (!isset($this->_check)) {
    $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_EWAY_STATUS'");
    $this->_check = tep_db_num_rows($check_query);
  }
  return $this->_check;
   }
   // Install the module (Admin Page)

   function install()
   {
    tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Enable eWay Module', 'MODULE_PAYMENT_EWAY_STATUS', '1', 'Do you want to authorize payments through eWay?<br>1 = Yes, 0 = No', '6', '0', now())");
    tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('EWAY Customer ID', 'MODULE_PAYMENT_EWAY_CUSTOMER_ID', '', 'your unique eWAY customer ID assigned to you when you join eWAY.', '6', '0', now())");
    tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_EWAY_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '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, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_EWAY_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
   }
   // Remove the module (Admin Page)

   function remove() {
   tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
   }
   // Retrieve the modules configuration keys (Admin Page)

   function keys()
   {
    $keys = array('MODULE_PAYMENT_EWAY_STATUS', 'MODULE_PAYMENT_EWAY_CUSTOMER_ID', 'MODULE_PAYMENT_EWAY_ORDER_STATUS_ID','MODULE_PAYMENT_EWAY_SORT_ORDER');
    return $keys;
   }
}
?>

 

and it is giving me an error that the payment module cannot be set, I have been working with this along side the current cc module and I think I am looking in the right direction that it the code needs to be something like this:

  for ($i=1; $i<13; $i++) {
    $expires_month[] = array('id' => sprintf('%02d', $i), 'text' => strftime('%B',mktime(0,0,0,$i,1,2000)));
  }
  $today = getdate();
  for ($i=$today['year']; $i < $today['year']+10; $i++) {
    $expires_year[] = array('id' => strftime('%y',mktime(0,0,0,1,1,$i)), 'text' => strftime('%Y',mktime(0,0,0,1,1,$i)));
  }
  $func_name = "set_" . $this->code . "()";
  $func_def = '<script language="javascript"><!--
function ' . $func_name . ' {
 for (var i=0; i<document.checkout_payment.payment.length; i++) {
   if (document.checkout_payment.payment[i].value == "' . $this->code . '") {
  document.checkout_payment.payment[i].checked = true;
   }
 }
}//--></script>';
  $oc = 'onchange="' . $func_name . '"';
	    if (MODULE_PAYMENT_EWAY == 'True') {
    $selection = array('id' => $this->code,
					 'module' => $this->title,
					 'fields' => array(array('title' => MODULE_PAYMENT_EWAY_TEXT_CREDIT_CARD_OWNER,
											 'field' => tep_draw_input_field('eway_cc_owner', $order->billing['firstname'] . ' ' . $order->billing['lastname'])),
									   array('title' => MODULE_PAYMENT_EWAY_TEXT_CREDIT_CARD_NUMBER,
											 'field' => tep_draw_input_field('eway_cc_number')),
									   array('title' => MODULE_PAYMENT_EWAY_TEXT_CREDIT_CARD_EXPIRES,
											 'field' => tep_draw_pull_down_menu('eway_cc_expires_month', $expires_month) . ' ' . tep_draw_pull_down_menu('eway_cc_expires_year', $expires_year)),
									   array('title' => MODULE_PAYMENT_EWAY_TEXT_CVV,
											 'field' => tep_draw_input_field('eway_cvn','',"size=4, maxlength=4"))));
  return $selection;
   }

 

but I am getting an error with this - any help would be greatly appreciated as this is one of the most popular australian payment modules.

 

Thank you in advance,

Emma

Share this post


Link to post
Share on other sites

Hello! I love this contrib. and I'am almost happy with the result - exept I did not get the same as shown on the image on the first page of this threat.

 

I miss the little buttons for changing the number of articles (+ and-) and I also miss the login button for people who already have an account.

Can anyone give me a hint where I go wrong?

Thanks!

Share this post


Link to post
Share on other sites

I remember in older versions of One Page Checkout, Registration was optional (a.k.a. Purchase Without Account) and the username/password was at the bottom for people who DID want to create an account. In the admin, the configuration settings were Optional, Mandatory, No Accounts.

 

In the name of making the purchase and checkout system truly OPC, the optional registration allowed buyers to skip the "create account" page and get right into shipping and billing information.

 

Anyone willing to help me merge PWA with OPC for 2.3.1?

Share this post


Link to post
Share on other sites

hi guys,

I really need you're help, I have combined qtpro to work with the one page checkout - for most payment modules this is working perfectly unfortunately when using paypal standard I am getting this error:

The link you have used to enter the PayPal system contains an incorrectly formatted item amount.

 

this is the code that I have for Paypal standard, this works with using the regular checkout but I cannot see where the process code changes for OPC and where I need to be editing - I think I have been staring at this for far too long.....

 

This module is fantastic and I am hoping that there is someway to integrate both of these features, any help or advice you can offer me would be greatly appreciated.

 

Thank in advance,

Emma

 

<?php
/*
 $Id: paypal_standard.php 1803 2008-01-11 18:16:37Z hpdl $
 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com  Copyright (c) 2008 osCommerce
 Released under the GNU General Public License
*/  class paypal_standard {
   var $code, $title, $description, $enabled;
// class constructor
   function paypal_standard() {
  global $order;	  $this->signature = 'paypal|paypal_standard|1.0|2.2';
  $this->code = 'paypal_standard';
  $this->title = MODULE_PAYMENT_PAYPAL_STANDARD_TEXT_TITLE;
  $this->public_title = MODULE_PAYMENT_PAYPAL_STANDARD_TEXT_PUBLIC_TITLE;
  $this->description = MODULE_PAYMENT_PAYPAL_STANDARD_TEXT_DESCRIPTION;
  $this->sort_order = MODULE_PAYMENT_PAYPAL_STANDARD_SORT_ORDER;
  $this->enabled = ((MODULE_PAYMENT_PAYPAL_STANDARD_STATUS == 'True') ? true : false);	  if ((int)MODULE_PAYMENT_PAYPAL_STANDARD_PREPARE_ORDER_STATUS_ID > 0) {
    $this->order_status = MODULE_PAYMENT_PAYPAL_STANDARD_PREPARE_ORDER_STATUS_ID;
  }
  if (is_object($order)) $this->update_status();	  if (MODULE_PAYMENT_PAYPAL_STANDARD_GATEWAY_SERVER == 'Live') {
    $this->form_action_url = 'https://www.paypal.com/cgi-bin/webscr';
  } else {
    $this->form_action_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
  }
   }
// class methods
   function update_status() {
  global $order;	  if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_PAYPAL_STANDARD_ZONE > 0) ) {
    $check_flag = false;
    $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_PAYPAL_STANDARD_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() {
  global $cart_PayPal_Standard_ID;	  if (tep_session_is_registered('cart_PayPal_Standard_ID')) {
    $order_id = substr($cart_PayPal_Standard_ID, strpos($cart_PayPal_Standard_ID, '-')+1);
    $check_query = tep_db_query('select orders_id from ' . TABLE_ORDERS_STATUS_HISTORY . ' where orders_id = "' . (int)$order_id . '" limit 1');	    if (tep_db_num_rows($check_query) < 1) {
	  tep_db_query('delete from ' . TABLE_ORDERS . ' where orders_id = "' . (int)$order_id . '"');
	  tep_db_query('delete from ' . TABLE_ORDERS_TOTAL . ' where orders_id = "' . (int)$order_id . '"');
	  tep_db_query('delete from ' . TABLE_ORDERS_STATUS_HISTORY . ' where orders_id = "' . (int)$order_id . '"');
	  tep_db_query('delete from ' . TABLE_ORDERS_PRODUCTS . ' where orders_id = "' . (int)$order_id . '"');
	  tep_db_query('delete from ' . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . ' where orders_id = "' . (int)$order_id . '"');
	  tep_db_query('delete from ' . TABLE_ORDERS_PRODUCTS_DOWNLOAD . ' where orders_id = "' . (int)$order_id . '"');
	  tep_session_unregister('cart_PayPal_Standard_ID');
    }
  }	  return array('id' => $this->code,
			   'module' => $this->public_title);
   }
   function pre_confirmation_check() {
  global $cartID, $cart;	  if (empty($cart->cartID)) {
    $cartID = $cart->cartID = $cart->generate_cart_id();
  }
  if (!tep_session_is_registered('cartID')) {
    tep_session_register('cartID');
  }
   }    function confirmation() {
  global $cartID, $cart_PayPal_Standard_ID, $customer_id, $languages_id, $order, $order_total_modules;
  if (tep_session_is_registered('cartID')) {
    $insert_order = false;	    if (tep_session_is_registered('cart_PayPal_Standard_ID')) {
	  $order_id = substr($cart_PayPal_Standard_ID, strpos($cart_PayPal_Standard_ID, '-')+1);
	  $curr_check = tep_db_query("select currency from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'");
	  $curr = tep_db_fetch_array($curr_check);		  if ( ($curr['currency'] != $order->info['currency']) || ($cartID != substr($cart_PayPal_Standard_ID, 0, strlen($cartID))) ) {
	    $check_query = tep_db_query('select orders_id from ' . TABLE_ORDERS_STATUS_HISTORY . ' where orders_id = "' . (int)$order_id . '" limit 1');
	    if (tep_db_num_rows($check_query) < 1) {
		  tep_db_query('delete from ' . TABLE_ORDERS . ' where orders_id = "' . (int)$order_id . '"');
		  tep_db_query('delete from ' . TABLE_ORDERS_TOTAL . ' where orders_id = "' . (int)$order_id . '"');
		  tep_db_query('delete from ' . TABLE_ORDERS_STATUS_HISTORY . ' where orders_id = "' . (int)$order_id . '"');
		  tep_db_query('delete from ' . TABLE_ORDERS_PRODUCTS . ' where orders_id = "' . (int)$order_id . '"');
		  tep_db_query('delete from ' . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . ' where orders_id = "' . (int)$order_id . '"');
		  tep_db_query('delete from ' . TABLE_ORDERS_PRODUCTS_DOWNLOAD . ' where orders_id = "' . (int)$order_id . '"');
	    }		    $insert_order = true;
	  }
    } else {
	  $insert_order = true;
    }
    if ($insert_order == true) {
	  $order_totals = array();
	  if (is_array($order_total_modules->modules)) {
	    reset($order_total_modules->modules);
	    while (list(, $value) = each($order_total_modules->modules)) {
		  $class = substr($value, 0, strrpos($value, '.'));
		  if ($GLOBALS[$class]->enabled) {
		    for ($i=0, $n=sizeof($GLOBALS[$class]->output); $i<$n; $i++) {
			  if (tep_not_null($GLOBALS[$class]->output[$i]['title']) && tep_not_null($GLOBALS[$class]->output[$i]['text'])) {
			    $order_totals[] = 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);
			  }
		    }
		  }
	    }
	  }		  $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);
	  }
	  for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
	    $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();		    $attributes_exist = '0';
	    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);
		    }
		  }
	    }
	  }
	  $cart_PayPal_Standard_ID = $cartID . '-' . $insert_id;
	  tep_session_register('cart_PayPal_Standard_ID');
    }
  }	  return false;
   }
   function process_button() {
  global $customer_id, $order, $sendto, $currency, $cart_PayPal_Standard_ID, $shipping;	  $process_button_string = '';
  $parameters = array('cmd' => '_xclick',
					  'item_name' => STORE_NAME,
					  'shipping' => $this->format_raw($order->info['shipping_cost']),
					  'tax' => $this->format_raw($order->info['tax']),
					  'business' => MODULE_PAYMENT_PAYPAL_STANDARD_ID,
					  'amount' => $this->format_raw($order->info['total'] - $order->info['shipping_cost'] - $order->info['tax']),
					  'currency_code' => $currency,
					  'invoice' => substr($cart_PayPal_Standard_ID, strpos($cart_PayPal_Standard_ID, '-')+1),
					  'custom' => $customer_id,
					  'no_note' => '1',
					  'notify_url' => tep_href_link('ext/modules/payment/paypal/standard_ipn.php', '', 'SSL', false, false),
					  'return' => tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL'),
					  'cancel_return' => tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'),
					  'bn' => 'osCommerce22_Default_ST',
					  'paymentaction' => ((MODULE_PAYMENT_PAYPAL_STANDARD_TRANSACTION_METHOD == 'Sale') ? 'sale' : 'authorization'));
  if (is_numeric($sendto) && ($sendto > 0)) {
    $parameters['address_override'] = '1';
    $parameters['first_name'] = $order->delivery['firstname'];
    $parameters['last_name'] = $order->delivery['lastname'];
    $parameters['address1'] = $order->delivery['street_address'];
    $parameters['city'] = $order->delivery['city'];
    $parameters['state'] = tep_get_zone_code($order->delivery['country']['id'], $order->delivery['zone_id'], $order->delivery['state']);
    $parameters['zip'] = $order->delivery['postcode'];
    $parameters['country'] = $order->delivery['country']['iso_code_2'];
  } else {
    $parameters['no_shipping'] = '1';
    $parameters['first_name'] = $order->billing['firstname'];
    $parameters['last_name'] = $order->billing['lastname'];
    $parameters['address1'] = $order->billing['street_address'];
    $parameters['city'] = $order->billing['city'];
    $parameters['state'] = tep_get_zone_code($order->billing['country']['id'], $order->billing['zone_id'], $order->billing['state']);
    $parameters['zip'] = $order->billing['postcode'];
    $parameters['country'] = $order->billing['country']['iso_code_2'];
  }	  if (tep_not_null(MODULE_PAYMENT_PAYPAL_STANDARD_PAGE_STYLE)) {
    $parameters['page_style'] = MODULE_PAYMENT_PAYPAL_STANDARD_PAGE_STYLE;
  }
  if (MODULE_PAYMENT_PAYPAL_STANDARD_EWP_STATUS == 'True') {
    $parameters['cert_id'] = MODULE_PAYMENT_PAYPAL_STANDARD_EWP_CERT_ID;	    $random_string = rand(100000, 999999) . '-' . $customer_id . '-';
    $data = '';
    reset($parameters);
    while (list($key, $value) = each($parameters)) {
	  $data .= $key . '=' . $value . "\n";
    }	    $fp = fopen(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'data.txt', 'w');
    fwrite($fp, $data);
    fclose($fp);
    unset($data);	    if (function_exists('openssl_pkcs7_sign') && function_exists('openssl_pkcs7_encrypt')) {
	  openssl_pkcs7_sign(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'data.txt', MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt', file_get_contents(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PUBLIC_KEY), file_get_contents(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PRIVATE_KEY), array('From' => MODULE_PAYMENT_PAYPAL_STANDARD_ID), PKCS7_BINARY);
	  unlink(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'data.txt');// remove headers from the signature
	  $signed = file_get_contents(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt');
	  $signed = explode("\n\n", $signed);
	  $signed = base64_decode($signed[1]);
	  $fp = fopen(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt', 'w');
	  fwrite($fp, $signed);
	  fclose($fp);		  unset($signed);
	  openssl_pkcs7_encrypt(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt', MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt', file_get_contents(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PAYPAL_KEY), array('From' => MODULE_PAYMENT_PAYPAL_STANDARD_ID), PKCS7_BINARY);		  unlink(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt');
// remove headers from the encrypted result
	  $data = file_get_contents(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt');
	  $data = explode("\n\n", $data);
	  $data = '-----BEGIN PKCS7-----' . "\n" . $data[1] . "\n" . '-----END PKCS7-----';		  unlink(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt');
    } else {
	  exec(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_OPENSSL . ' smime -sign -in ' . MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'data.txt -signer ' . MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PUBLIC_KEY . ' -inkey ' . MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PRIVATE_KEY . ' -outform der -nodetach -binary > ' . MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt');
	  unlink(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'data.txt');
	  exec(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_OPENSSL . ' smime -encrypt -des3 -binary -outform pem ' . MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PAYPAL_KEY . ' < ' . MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt > ' . MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt');
	  unlink(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt');		  $fh = fopen(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt', 'rb');
	  $data = fread($fh, filesize(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt'));
	  fclose($fh);
	  unlink(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt');
    }	    $process_button_string = tep_draw_hidden_field('cmd', '_s-xclick') .
							 tep_draw_hidden_field('encrypted', $data);
    unset($data);
  } else {
    reset($parameters);
    while (list($key, $value) = each($parameters)) {
	  $process_button_string .= tep_draw_hidden_field($key, $value);
    }
  }	  return $process_button_string;
   }
   function before_process() {
/* One Page Checkout - BEGIN */
global $onePageCheckout;
/* One Page Checkout - END */
    global $customer_id, $order, $order_totals, $sendto, $billto, $languages_id, $payment, $currencies, $cart, $cart_PayPal_Standard_ID;
  global $$payment;	  $order_id = substr($cart_PayPal_Standard_ID, strpos($cart_PayPal_Standard_ID, '-')+1);
  $check_query = tep_db_query("select orders_status from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'");
  if (tep_db_num_rows($check_query)) {
    $check = tep_db_fetch_array($check_query);	    if ($check['orders_status'] == MODULE_PAYMENT_PAYPAL_STANDARD_PREPARE_ORDER_STATUS_ID) {
	  $sql_data_array = array('orders_id' => $order_id,
							  'orders_status_id' => MODULE_PAYMENT_PAYPAL_STANDARD_PREPARE_ORDER_STATUS_ID,
							  'date_added' => 'now()',
							  'customer_notified' => '0',
							  'comments' => '');
	  tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
    }
  }	  tep_db_query("update " . TABLE_ORDERS . " set orders_status = '" . (MODULE_PAYMENT_PAYPAL_STANDARD_ORDER_STATUS_ID > 0 ? (int)MODULE_PAYMENT_PAYPAL_STANDARD_ORDER_STATUS_ID : (int)DEFAULT_ORDERS_STATUS_ID) . "', last_modified = now() where orders_id = '" . (int)$order_id . "'");
  $sql_data_array = array('orders_id' => $order_id,
						  'orders_status_id' => (MODULE_PAYMENT_PAYPAL_STANDARD_ORDER_STATUS_ID > 0 ? (int)MODULE_PAYMENT_PAYPAL_STANDARD_ORDER_STATUS_ID : (int)DEFAULT_ORDERS_STATUS_ID),
						  'date_added' => 'now()',
						  'customer_notified' => (SEND_EMAILS == 'true') ? '1' : '0',
						  '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
//++++ QT Pro: Begin Changed code
   $products_stock_attributes=null;
   if (STOCK_LIMITED == 'true') {
    $products_attributes = $order->products[$i]['attributes'];
//	  if (DOWNLOAD_ENABLED == 'true')
//++++ QT Pro: End Changed Code
	    $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
//++++ QT Pro: Begin Changed code
//	  $products_attributes = $order->products[$i]['attributes'];
//++++ QT Pro: End Changed Code
	    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);
//++++ QT Pro: Begin Changed code
    $actual_stock_bought = $order->products[$i]['qty'];
    $download_selected = false;
    if ((DOWNLOAD_ENABLED == 'true') && isset($stock_values['products_attributes_filename']) && tep_not_null($stock_values['products_attributes_filename'])) {
	  $download_selected = true;
	  $products_stock_attributes='$$DOWNLOAD$$';
    }
// If not downloadable and attributes present, adjust attribute stock
    if (!$download_selected && is_array($products_attributes)) {
	  $all_nonstocked = true;
	  $products_stock_attributes_array = array();
	  foreach ($products_attributes as $attribute) {
	    if ($attribute['track_stock'] == 1) {
		  $products_stock_attributes_array[] = $attribute['option_id'] . "-" . $attribute['value_id'];
		  $all_nonstocked = false;
	    }
	  }
	  if ($all_nonstocked) {
	    $actual_stock_bought = $order->products[$i]['qty'];
	  }  else {
	    asort($products_stock_attributes_array, SORT_NUMERIC);
	    $products_stock_attributes = implode(",", $products_stock_attributes_array);
	    $attributes_stock_query = tep_db_query("select products_stock_quantity from " . TABLE_PRODUCTS_STOCK . " where products_stock_attributes = '$products_stock_attributes' AND products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
	    if (tep_db_num_rows($attributes_stock_query) > 0) {
		  $attributes_stock_values = tep_db_fetch_array($attributes_stock_query);
		  $attributes_stock_left = $attributes_stock_values['products_stock_quantity'] - $order->products[$i]['qty'];
		  tep_db_query("update " . TABLE_PRODUCTS_STOCK . " set products_stock_quantity = '" . $attributes_stock_left . "' where products_stock_attributes = '$products_stock_attributes' AND products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
		  $actual_stock_bought = ($attributes_stock_left < 1) ? $attributes_stock_values['products_stock_quantity'] : $order->products[$i]['qty'];
	    } else {
		  $attributes_stock_left = 0 - $order->products[$i]['qty'];
		  tep_db_query("insert into " . TABLE_PRODUCTS_STOCK . " (products_id, products_stock_attributes, products_stock_quantity) values ('" . tep_get_prid($order->products[$i]['id']) . "', '" . $products_stock_attributes . "', '" . $attributes_stock_left . "')");
		  $actual_stock_bought = 0;
	    }
	  }
    }
//	    $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_selected) {
	  $stock_left = $stock_values['products_quantity'] - $actual_stock_bought;
	  tep_db_query("UPDATE " . TABLE_PRODUCTS . "
				    SET products_quantity = products_quantity - '" . $actual_stock_bought . "'
				    WHERE products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
//++++ QT Pro: End Changed Code
	    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']) . "'");
//++++ QT Pro: Begin Changed code
   if (!isset($products_stock_attributes)) $products_stock_attributes=null;
   $sql_data_array = array('products_quantity' => $order->products[$i]['qty'],
					    'products_stock_attributes' => $products_stock_attributes);
   tep_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array, 'update', "orders_id='".$order_id."' and products_id='".tep_get_prid($order->products[$i]['id'])."'");
//++++ QT Pro: End Changed Code//------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);
	    $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 . ' ' . $order_id . "\n" .
				 EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $order_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";
 /* 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 */
  }	  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";
  $sendToFormatted . "\n";
	  }
  $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .
				  EMAIL_SEPARATOR . "\n" .
//					  tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";
  $billToFormatted . "\n";	  if (is_object($$payment)) {
    $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" .
				    EMAIL_SEPARATOR . "\n";
    $payment_class = $$payment;
    $email_order .= $payment_class->title . "\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
  $this->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('cart_PayPal_Standard_ID');
  tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL'));
   }    function after_process() {
  return false;
   }
   function output_error() {
  return false;
   }    function check() {
  if (!isset($this->_check)) {
    $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_PAYPAL_STANDARD_STATUS'");
    $this->_check = tep_db_num_rows($check_query);
  }
  return $this->_check;
   }
   function install() {
  $check_query = tep_db_query("select orders_status_id from " . TABLE_ORDERS_STATUS . " where orders_status_name = 'Preparing [PayPal Standard]' 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();
    foreach ($languages as $lang) {
	  tep_db_query("insert into " . TABLE_ORDERS_STATUS . " (orders_status_id, language_id, orders_status_name) values ('" . $status_id . "', '" . $lang['id'] . "', 'Preparing [PayPal Standard]')");
    }	    $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 = 0 and downloads_flag = 0 where orders_status_id = '" . $status_id . "'");
    }
  } else {
    $check = tep_db_fetch_array($check_query);
    $status_id = $check['orders_status_id'];
  }	  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable PayPal Website Payments Standard', 'MODULE_PAYMENT_PAYPAL_STANDARD_STATUS', 'False', 'Do you want to accept PayPal Website Payments Standard payments?', '6', '3', '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 ('E-Mail Address', 'MODULE_PAYMENT_PAYPAL_STANDARD_ID', '', 'The PayPal seller e-mail address to accept payments for', '6', '4', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_PAYPAL_STANDARD_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_PAYPAL_STANDARD_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Preparing Order Status', 'MODULE_PAYMENT_PAYPAL_STANDARD_PREPARE_ORDER_STATUS_ID', '" . $status_id . "', 'Set the status of prepared orders made with this payment module to this value', '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 PayPal Acknowledged Order Status', 'MODULE_PAYMENT_PAYPAL_STANDARD_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '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, date_added) values ('Gateway Server', 'MODULE_PAYMENT_PAYPAL_STANDARD_GATEWAY_SERVER', 'Live', 'Use the testing (sandbox) or live gateway server for transactions?', '6', '6', 'tep_cfg_select_option(array(\'Live\', \'Sandbox\'), ', 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 ('Transaction Method', 'MODULE_PAYMENT_PAYPAL_STANDARD_TRANSACTION_METHOD', 'Sale', 'The processing method to use for each transaction.', '6', '0', 'tep_cfg_select_option(array(\'Authorization\', \'Sale\'), ', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Page Style', 'MODULE_PAYMENT_PAYPAL_STANDARD_PAGE_STYLE', '', 'The page style to use for the transaction procedure (defined at your PayPal Profile page)', '6', '4', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Debug E-Mail Address', 'MODULE_PAYMENT_PAYPAL_STANDARD_DEBUG_EMAIL', '', 'All parameters of an Invalid IPN notification will be sent to this email address if one is entered.', '6', '4', 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 ('Enable Encrypted Web Payments', 'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_STATUS', 'False', 'Do you want to enable Encrypted Web Payments?', '6', '3', '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 ('Your Private Key', 'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PRIVATE_KEY', '', 'The location of your Private Key to use for signing the data. (*.pem)', '6', '4', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Your Public Certificate', 'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PUBLIC_KEY', '', 'The location of your Public Certificate to use for signing the data. (*.pem)', '6', '4', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('PayPals Public Certificate', 'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PAYPAL_KEY', '', 'The location of the PayPal Public Certificate for encrypting the data.', '6', '4', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Your PayPal Public Certificate ID', 'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_CERT_ID', '', 'The Certificate ID to use from your PayPal Encrypted Payment Settings Profile.', '6', '4', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Working Directory', 'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY', '', 'The working directory to use for temporary files. (trailing slash needed)', '6', '4', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('OpenSSL Location', 'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_OPENSSL', '/usr/bin/openssl', 'The location of the openssl binary file.', '6', '4', now())");
   }
   function remove() {
  tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
   }    function keys() {
  return array('MODULE_PAYMENT_PAYPAL_STANDARD_STATUS', 'MODULE_PAYMENT_PAYPAL_STANDARD_ID', 'MODULE_PAYMENT_PAYPAL_STANDARD_ZONE', 'MODULE_PAYMENT_PAYPAL_STANDARD_PREPARE_ORDER_STATUS_ID', 'MODULE_PAYMENT_PAYPAL_STANDARD_ORDER_STATUS_ID', 'MODULE_PAYMENT_PAYPAL_STANDARD_GATEWAY_SERVER', 'MODULE_PAYMENT_PAYPAL_STANDARD_TRANSACTION_METHOD', 'MODULE_PAYMENT_PAYPAL_STANDARD_PAGE_STYLE', 'MODULE_PAYMENT_PAYPAL_STANDARD_DEBUG_EMAIL', 'MODULE_PAYMENT_PAYPAL_STANDARD_SORT_ORDER', 'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_STATUS', 'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PRIVATE_KEY', 'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PUBLIC_KEY', 'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PAYPAL_KEY', 'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_CERT_ID', 'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY', 'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_OPENSSL');
   }
// format prices without currency formatting
   function format_raw($number, $currency_code = '', $currency_value = '') {
  global $currencies, $currency;	  if (empty($currency_code) || !$this->is_set($currency_code)) {
    $currency_code = $currency;
  }
  if (empty($currency_value) || !is_numeric($currency_value)) {
    $currency_value = $currencies->currencies[$currency_code]['value'];
  }	  return number_format(tep_round($number * $currency_value, $currencies->currencies[$currency_code]['decimal_places']), $currencies->currencies[$currency_code]['decimal_places'], '.', '');
   }
 }
?>

Share this post


Link to post
Share on other sites

I added the One Page Checkout for 2.3.1 (2) (1) (1)

but now get the folloing


Shopping Cart




Warning: include(includes/checkout/cart.php) [function.include]: failed to open stream: No such file or directory in C:\Program Files\EasyPHP-5.3.8.0\www\checkout.php on line 313

Warning: include() [function.include]: Failed opening 'includes/checkout/cart.php' for inclusion (include_path='.;C:\php\pear') in C:\Program Files\EasyPHP-5.3.8.0\www\checkout.php on line 313


Sub-Total:
3.00฿
Total:
3.00฿





Billing Address





Warning: include(includes/checkout/billing_address.php) [function.include]: failed to open stream: No such file or directory in C:\Program Files\EasyPHP-5.3.8.0\www\checkout.php on line 353

Warning: include() [function.include]: Failed opening 'includes/checkout/billing_address.php' for inclusion (include_path='.;C:\php\pear') in C:\Program Files\EasyPHP-5.3.8.0\www\checkout.php on line 353

Change Address



Shipping Address




Warning: include(includes/checkout/shipping_address.php) [function.include]: failed to open stream: No such file or directory in C:\Program Files\EasyPHP-5.3.8.0\www\checkout.php on line 377

Warning: include() [function.include]: Failed opening 'includes/checkout/shipping_address.php' for inclusion (include_path='.;C:\php\pear') in C:\Program Files\EasyPHP-5.3.8.0\www\checkout.php on line 377

Change Address



Payment Method




Warning: include(includes/checkout/payment_method.php) [function.include]: failed to open stream: No such file or directory in C:\Program Files\EasyPHP-5.3.8.0\www\checkout.php on line 400

Warning: include() [function.include]: Failed opening 'includes/checkout/payment_method.php' for inclusion (include_path='.;C:\php\pear') in C:\Program Files\EasyPHP-5.3.8.0\www\checkout.php on line 400



Shipping Method




Warning: include(includes/checkout/shipping_method.php) [function.include]: failed to open stream: No such file or directory in C:\Program Files\EasyPHP-5.3.8.0\www\checkout.php on line 416

Warning: include() [function.include]: Failed opening 'includes/checkout/shipping_method.php' for inclusion (include_path='.;C:\php\pear') in C:\Program Files\EasyPHP-5.3.8.0\www\checkout.php on line 416



Add Comments About Your Order




Warning: include(includes/checkout/comments.php) [function.include]: failed to open stream: No such file or directory in C:\Program Files\EasyPHP-5.3.8.0\www\checkout.php on line 430

Warning: include() [function.include]: Failed opening 'includes/checkout/comments.php' for inclusion (include_path='.;C:\php\pear') in C:\Program Files\EasyPHP-5.3.8.0\www\checkout.php on line 430

Share this post


Link to post
Share on other sites

×