Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Recommended Posts

Posted (edited)

Hi,

 

 

I'm using PayPal_Shopping_Cart_IPN and I got a problem now!

 

The payment status always shows empty now even the payment is received, it was showing either "Pending" or "Completed" but now it always shows empty !!!

 

 

Anyone know what's the problem and how to fix it???

 

Thank you.

Edited by kappa525ny
Posted

Chek whether Your payment status defined do exist or not.

A complete delete of records of its row might result in this.

 

There is an order status table to be cheked.

 

Satish

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Posted
Chek whether Your payment status defined do exist or not.

A complete delete of records of its row might result in this.

 

There is an order status table to be cheked.

 

Satish

 

 

Hi,

 

Yes, there is an order status table as show in the picture below, everything looks fine??

 

paypal_2.JPG

Posted

Now You need to chek what has been set thru admin payment module paypal setting for the Payment status is it blank.

 

Or is it a value from one of the list in the screen shot shown.

 

Satish

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Posted
Now You need to chek what has been set thru admin payment module paypal setting for the Payment status is it blank.

 

Or is it a value from one of the list in the screen shot shown.

 

Satish

 

 

Hi, I checked the paypal module configurations, eveything looks ok (picture shown below)

 

paypal_3.JPG

Posted

It appears to be related with register globals.

 

chek this:

1)Place an order till You reach paypal and leave it incomplete and chek if order status is being shown.

 

If yes then

the update query of IPN code is getting some blank value and so is placing a blank.

 

If its as per case one then just paste Your IPN.php complete code here.

 

Satish

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Posted
It appears to be related with register globals.

 

chek this:

1)Place an order till You reach paypal and leave it incomplete and chek if order status is being shown.

 

If yes then

the update query of IPN code is getting some blank value and so is placing a blank.

 

If its as per case one then just paste Your IPN.php complete code here.

 

Satish

 

 

I did the first and the order status is stil lnot shown so i post the ipn.php below

 

<?php

/*

$Id: ipn.php,v 1.1.1.1 2004/09/22 13:45:11 devosc Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

DevosC, Developing open source Code

http://www.devosc.com

 

Copyright © 2003 osCommerce

Copyright © 2004 DevosC.com

 

Released under the GNU General Public License

*/

 

/*

function debugWriteFile($str,$mode="a") {

$fp = @fopen("ipn.txt",$mode); @flock($fp, LOCK_EX); @fwrite($fp,$str); @flock($fp, LOCK_UN); @fclose($fp);

}

 

$postString = ''; foreach($_POST as $key => $val) $postString .= $key.' = '.$val."\n";

if($postString != '') {

debugWriteFile($postString,"w+");

}

*/

 

require_once('includes/modules/payment/paypal/application_top.inc.php');

require_once(DIR_WS_MODULES . 'payment/paypal/classes/IPN/IPN.class.php');

require_once(DIR_WS_MODULES . 'payment/paypal/classes/Debug/Debug.class.php');

require_once(DIR_WS_MODULES . 'payment/paypal/functions/general.func.php');

paypal_include_lng(DIR_WS_MODULES . 'payment/paypal/languages/', 'english', 'ipn.lng.php');

$debug = new PayPal_Debug(MODULE_PAYMENT_PAYPAL_IPN_DEBUG_EMAIL, MODULE_PAYMENT_PAYPAL_IPN_DEBUG);

$ipn = new PayPal_IPN($_POST);

$ipn->setTestMode(MODULE_PAYMENT_PAYPAL_IPN_TEST_MODE);

unset($_POST);

//post back to PayPal to validate

if(!$ipn->authenticate(MODULE_PAYMENT_PAYPAL_DOMAIN) && $ipn->testMode('Off')) $ipn->dienice('500');

//Check both the receiver_email and business ID fields match

if (!$ipn->validateReceiverEmail(MODULE_PAYMENT_PAYPAL_ID,MODULE_PAYMENT_PAYPAL_BUSINESS

_ID)) $ipn->dienice('500');

if($ipn->uniqueTxnID() && $ipn->isReversal() && strlen($ipn->key['parent_txn_id']) == 17) {

//parent_txn_id is the txn_id of the original transaction

$txn = $ipn->queryTxnID($ipn->key['parent_txn_id']);

if(!empty($txn)) {

$ipn->insert($txn['paypal_id']);

// update the order's status

switch ($ipn->reversalType()) {

case 'Canceled_Reversal':

$order_status = MODULE_PAYMENT_PAYPAL_ORDER_STATUS_ID;

break;

case 'Reversed':

$order_status = MODULE_PAYMENT_PAYPAL_ORDER_CANCELED_STATUS_ID;

break;

case 'Refunded':

$order_status = MODULE_PAYMENT_PAYPAL_ORDER_REFUNDED_STATUS_ID;

break;

}

$ipn->updateOrderStatus($txn['paypal_id'],$order_status);

}

} elseif ($ipn->isCartPayment() && !empty($PayPal_osC_Order->orderID)) {

//actually not essential since 'orders_status_name' is not required

$languages_id = $PayPal_osC_Order->languageID;

include(DIR_WS_CLASSES . 'order.php');

$order = new order($PayPal_osC_Order->orderID);

//Check that txn_id has not been previously processed

if ($ipn->uniqueTxnID()) { //Payment is either Completed, Pending or Failed

$ipn->insert();

$PayPal_osC_Order->setOrderPaymentID($ipn->ID());

$PayPal_osC_Order->removeCustomersBasket($order->customer['id']);

switch ($ipn->paymentStatus()) {

case 'Completed':

if ($ipn->validPayment($PayPal_osC_Order->payment_amount,$PayPal_osC_Order->payment_currency)) {

include(DIR_WS_MODULES . 'payment/paypal/catalog/checkout_update.inc.php');

} else {

$ipn->updateOrderStatus($ipn->ID(),MODULE_PAYMENT_PAYPAL_ORDER_ONHOLD_STATUS_ID);

}

break;

case 'Failed':

$ipn->updateOrderStatus($ipn->ID(),MODULE_PAYMENT_PAYPAL_ORDER_CANCELED_STATUS_ID);

break;

case 'Pending':

//Assumed to do nothing since the order is initially in a Pending ORDER Status

break;

}//end switch

} else { // not a unique transaction => Pending Payment

//Assumes there is only one previous IPN transaction

$pendingTxn = $ipn->queryPendingStatus($ipn->txnID());

if ($pendingTxn['payment_status'] === 'Pending') {

$ipn->updateStatus($pendingTxn['paypal_id']);

switch ($ipn->paymentStatus()) {

case 'Completed':

if ($ipn->validPayment($PayPal_osC_Order->payment_amount,$PayPal_osC_Order->payment_currency)) {

include(DIR_WS_MODULES . 'payment/paypal/catalog/checkout_update.inc.php');

} else {

$ipn->updateOrderStatus($pendingTxn['paypal_id'],MODULE_PAYMENT_PAYPAL_ORDER_ONHOLD_STATUS_ID);

}

break;

case 'Denied':

$ipn->updateOrderStatus($pendingTxn['paypal_id'],MODULE_PAYMENT_PAYPAL_ORDER_CANCELED_STATUS_ID);

break;

}//end switch

}//end if Pending Payment

}

} elseif ($ipn->isAuction()) {

if ($ipn->uniqueTxnID()) $ipn->insert();

if ($debug->enabled) $debug->add(PAYPAL_AUCTION,sprintf(PAYPAL_AUCTION_MSG));

} elseif ($ipn->txnType('send_money')) {

if ($ipn->uniqueTxnID()) $ipn->insert();

if ($debug->enabled) $debug->add(PAYMENT_SEND_MONEY_DESCRIPTION,sprintf(PAYMENT_SEND_MONEY_DESCRIPTION_MSG

,number_format($ipn->key['mc_gross'],2),$ipn->key['mc_currency']));

} elseif ($debug->enabled && $ipn->testMode('On')) {

$debug->raiseError(TEST_INCOMPLETE,sprintf(TEST_INCOMPLETE_MSG),true);

}

if ($ipn->testMode('On') && $ipn->validDigest()) {

include(DIR_WS_MODULES . 'payment/paypal/classes/Page/Page.class.php');

$page = new PayPal_Page();

$page->setBaseDirectory(DIR_WS_MODULES . 'payment/paypal/');

$page->setBaseURL(DIR_WS_MODULES . 'payment/paypal/');

$page->includeLanguageFile('admin/languages','english','paypal.lng.php');

$page->setTitle(HEADING_ITP_RESULTS_TITLE);

$page->setContentFile(DIR_WS_MODULES . 'payment/paypal/admin/TestPanel/Results.inc.php');

$page->addCSS($page->baseURL . 'templates/css/general.css');

$page->addCSS($page->baseURL . 'templates/css/stylesheet.css');

$page->setTemplate('default');

include($page->template());

}

require(DIR_WS_MODULES . 'payment/paypal/application_bottom.inc.php');

?>

Posted

Just place a php.ini and set register globals to on in this folder and chek.

If its an issue of register globals will get solved.

 

Also chek by just making an order but once You reach do not pay at paypal is there some order status for this order.

 

For fixing IPN bugs the following are some steps recommended:

1)Is IPN really coming.:For this place a file write code and collect whats being posted.

 

2)Chek the flow of code in IPN file by place some file write code to make out thru what all lines it goes.This will help YOu analyse the code.

 

3)You can set the values so as to get a log of all the mysql queries logged into a file.Here YOu would be able to makeout if some queries are being fired with blank values and thus resulting in a blank status.

 

This will lead You to solution.

 

Satish

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Posted
Just place a php.ini and set register globals to on in this folder and chek.

If its an issue of register globals will get solved.

 

Also chek by just making an order but once You reach do not pay at paypal is there some order status for this order.

 

For fixing IPN bugs the following are some steps recommended:

1)Is IPN really coming.:For this place a file write code and collect whats being posted.

 

2)Chek the flow of code in IPN file by place some file write code to make out thru what all lines it goes.This will help YOu analyse the code.

 

3)You can set the values so as to get a log of all the mysql queries logged into a file.Here YOu would be able to makeout if some queries are being fired with blank values and thus resulting in a blank status.

 

This will lead You to solution.

 

Satish

 

Hi, i try to set to register global on but it will appear error message whey try to go admin page, i think the web server don't allow to turn register global on.

 

 

I don't how to do to write code to do to fix IPN bugs.. I don't know php that much ... I even try to install other paypal module like paypal payment standard and still got the same result

 

i'm using PayPal_Shopping_Cart_IPN v. 3.1.5

Posted

paste Your IPN file code.

 

Satish

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Posted
paste Your IPN file code.

 

Satish

 

below is the ipn.php file in my catalog folder.

 

/*

$Id: ipn.php,v 1.1.1.1 2004/09/22 13:45:11 devosc Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

DevosC, Developing open source Code

http://www.devosc.com

 

Copyright © 2003 osCommerce

Copyright © 2004 DevosC.com

 

Released under the GNU General Public License

*/

 

/*

function debugWriteFile($str,$mode="a") {

$fp = @fopen("ipn.txt",$mode); @flock($fp, LOCK_EX); @fwrite($fp,$str); @flock($fp, LOCK_UN); @fclose($fp);

}

 

$postString = ''; foreach($_POST as $key => $val) $postString .= $key.' = '.$val."\n";

if($postString != '') {

debugWriteFile($postString,"w+");

}

*/

 

require_once('includes/modules/payment/paypal/application_top.inc.php');

require_once(DIR_WS_MODULES . 'payment/paypal/classes/IPN/IPN.class.php');

require_once(DIR_WS_MODULES . 'payment/paypal/classes/Debug/Debug.class.php');

require_once(DIR_WS_MODULES . 'payment/paypal/functions/general.func.php');

paypal_include_lng(DIR_WS_MODULES . 'payment/paypal/languages/', 'english', 'ipn.lng.php');

$debug = new PayPal_Debug(MODULE_PAYMENT_PAYPAL_IPN_DEBUG_EMAIL, MODULE_PAYMENT_PAYPAL_IPN_DEBUG);

$ipn = new PayPal_IPN($_POST);

$ipn->setTestMode(MODULE_PAYMENT_PAYPAL_IPN_TEST_MODE);

unset($_POST);

//post back to PayPal to validate

if(!$ipn->authenticate(MODULE_PAYMENT_PAYPAL_DOMAIN) && $ipn->testMode('Off')) $ipn->dienice('500');

//Check both the receiver_email and business ID fields match

if (!$ipn->validateReceiverEmail(MODULE_PAYMENT_PAYPAL_ID,MODULE_PAYMENT_PAYPAL_BUSINESS

_ID)) $ipn->dienice('500');

if($ipn->uniqueTxnID() && $ipn->isReversal() && strlen($ipn->key['parent_txn_id']) == 17) {

//parent_txn_id is the txn_id of the original transaction

$txn = $ipn->queryTxnID($ipn->key['parent_txn_id']);

if(!empty($txn)) {

$ipn->insert($txn['paypal_id']);

// update the order's status

switch ($ipn->reversalType()) {

case 'Canceled_Reversal':

$order_status = MODULE_PAYMENT_PAYPAL_ORDER_STATUS_ID;

break;

case 'Reversed':

$order_status = MODULE_PAYMENT_PAYPAL_ORDER_CANCELED_STATUS_ID;

break;

case 'Refunded':

$order_status = MODULE_PAYMENT_PAYPAL_ORDER_REFUNDED_STATUS_ID;

break;

}

$ipn->updateOrderStatus($txn['paypal_id'],$order_status);

}

} elseif ($ipn->isCartPayment() && !empty($PayPal_osC_Order->orderID)) {

//actually not essential since 'orders_status_name' is not required

$languages_id = $PayPal_osC_Order->languageID;

include(DIR_WS_CLASSES . 'order.php');

$order = new order($PayPal_osC_Order->orderID);

//Check that txn_id has not been previously processed

if ($ipn->uniqueTxnID()) { //Payment is either Completed, Pending or Failed

$ipn->insert();

$PayPal_osC_Order->setOrderPaymentID($ipn->ID());

$PayPal_osC_Order->removeCustomersBasket($order->customer['id']);

switch ($ipn->paymentStatus()) {

case 'Completed':

if ($ipn->validPayment($PayPal_osC_Order->payment_amount,$PayPal_osC_Order->payment_currency)) {

include(DIR_WS_MODULES . 'payment/paypal/catalog/checkout_update.inc.php');

} else {

$ipn->updateOrderStatus($ipn->ID(),MODULE_PAYMENT_PAYPAL_ORDER_ONHOLD_STATUS_ID);

}

break;

case 'Failed':

$ipn->updateOrderStatus($ipn->ID(),MODULE_PAYMENT_PAYPAL_ORDER_CANCELED_STATUS_ID);

break;

case 'Pending':

//Assumed to do nothing since the order is initially in a Pending ORDER Status

break;

}//end switch

} else { // not a unique transaction => Pending Payment

//Assumes there is only one previous IPN transaction

$pendingTxn = $ipn->queryPendingStatus($ipn->txnID());

if ($pendingTxn['payment_status'] === 'Pending') {

$ipn->updateStatus($pendingTxn['paypal_id']);

switch ($ipn->paymentStatus()) {

case 'Completed':

if ($ipn->validPayment($PayPal_osC_Order->payment_amount,$PayPal_osC_Order->payment_currency)) {

include(DIR_WS_MODULES . 'payment/paypal/catalog/checkout_update.inc.php');

} else {

$ipn->updateOrderStatus($pendingTxn['paypal_id'],MODULE_PAYMENT_PAYPAL_ORDER_ONHOLD_STATUS_ID);

}

break;

case 'Denied':

$ipn->updateOrderStatus($pendingTxn['paypal_id'],MODULE_PAYMENT_PAYPAL_ORDER_CANCELED_STATUS_ID);

break;

}//end switch

}//end if Pending Payment

}

} elseif ($ipn->isAuction()) {

if ($ipn->uniqueTxnID()) $ipn->insert();

if ($debug->enabled) $debug->add(PAYPAL_AUCTION,sprintf(PAYPAL_AUCTION_MSG));

} elseif ($ipn->txnType('send_money')) {

if ($ipn->uniqueTxnID()) $ipn->insert();

if ($debug->enabled) $debug->add(PAYMENT_SEND_MONEY_DESCRIPTION,sprintf(PAYMENT_SEND_MONEY_DESCRIPTION_MSG

,number_format($ipn->key['mc_gross'],2),$ipn->key['mc_currency']));

} elseif ($debug->enabled && $ipn->testMode('On')) {

$debug->raiseError(TEST_INCOMPLETE,sprintf(TEST_INCOMPLETE_MSG),true);

}

if ($ipn->testMode('On') && $ipn->validDigest()) {

include(DIR_WS_MODULES . 'payment/paypal/classes/Page/Page.class.php');

$page = new PayPal_Page();

$page->setBaseDirectory(DIR_WS_MODULES . 'payment/paypal/');

$page->setBaseURL(DIR_WS_MODULES . 'payment/paypal/');

$page->includeLanguageFile('admin/languages','english','paypal.lng.php');

$page->setTitle(HEADING_ITP_RESULTS_TITLE);

$page->setContentFile(DIR_WS_MODULES . 'payment/paypal/admin/TestPanel/Results.inc.php');

$page->addCSS($page->baseURL . 'templates/css/general.css');

$page->addCSS($page->baseURL . 'templates/css/stylesheet.css');

$page->setTemplate('default');

include($page->template());

}

require(DIR_WS_MODULES . 'payment/paypal/application_bottom.inc.php');

?>

Posted

/*

function debugWriteFile($str,$mode="a") {

$fp = @fopen("ipn.txt",$mode); @flock($fp, LOCK_EX); @fwrite($fp,$str); @flock($fp, LOCK_UN); @fclose($fp);

}

 

$postString = ''; foreach($_POST as $key => $val) $postString .= $key.' = '.$val."\n";

if($postString != '') {

debugWriteFile($postString,"w+");

}

*/

 

open this code.

It will paste the post variables in ipn.txt

 

Paste the ipn.txt file.

 

Satish

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Posted

or set debug enabled to true.

elseif ($debug->enabled && $ipn->testMode('On')) {

$debug->raiseError(TEST_INCOMPLETE,sprintf(TEST_INCOMPLETE_MSG),true);

}

 

As You can see and the code will geenrate some content that will lead You towards the bug.

 

Satish

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Posted
or set debug enabled to true.

elseif ($debug->enabled && $ipn->testMode('On')) {

$debug->raiseError(TEST_INCOMPLETE,sprintf(TEST_INCOMPLETE_MSG),true);

}

 

As You can see and the code will geenrate some content that will lead You towards the bug.

 

Satish

 

Hi,

 

I tried the first one to open the code but can find the ipn.txt file after trying to place a order ? what fold shoudl i look for?

 

then I tried the second method, I enableed the debug in the paypal configuration in admin and placed a order and checked the email but didn't receive any debug info email!!

waht should I do??

Posted

ipn.txt will be at the level at which all chekout pages are.

 

Create one ipn.txt and give write permission so a code can append to it.

 

You need to pinch Your ipn.php file directly to chek if ipn.txt got some content added.This will chek that the write code will work.Then if an IPN comes You will find things in.

 

 

Satish

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Posted
ipn.txt will be at the level at which all chekout pages are.

 

Create one ipn.txt and give write permission so a code can append to it.

 

You need to pinch Your ipn.php file directly to chek if ipn.txt got some content added.This will chek that the write code will work.Then if an IPN comes You will find things in.

 

 

Satish

 

 

Hi,

 

I did but the ipn.txt did got anythings in it!!. First I create an ipn.txt in the folder where all the checkout pages(i think you mean the checkout_processing.php checkout_success.php and ..) are and give write permission (666) and open the code in ipn.php and then try to make an order until the paypal paypal page but

when i check the ipn.txt theres nothing inside!!?? Please help

Posted

If You can not make out How to write to a file then its difficult to assist.

 

As its a minor issue but You need to chek path,permission etc.

 

If You are some how able to write let Me know what You have and I will comment further.

 

Satish

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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