Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Return from paypal losing cart products


offie

Recommended Posts

I am proceeding with buying an item from my store and select "Checkout with Paypal".

 

Once transferred to the paypal system I decide to Cancel and return to my site and click the appropriate link on the page which says "Cancel and return to Affordable Mobility"

 

Upon doing so I return to my site ok but the cart now says "Your Shopping Cart is empty!"

 

However as soon as I click any other link or product the items in my cart appear again. It has somehow initially lost the products during the transfer back but must know they are

there somewhere as they re-appear as soon as something else is clicked.

 

I have Auto return on in paypal with the return address as checkout_success.php but this should not matter as the customer has not got that far yet and is cancelling before paying.

 

Someone else must have had this problem so please do let us know a way round this problem.

 

Thank you

 

Michael

Link to comment
Share on other sites

Michael,

 

 

The return URL from PayPal should be to /checkout_process.php as landing at checkout_success.php ends the session.

 

 

 

 

 

Chris

Link to comment
Share on other sites

The checkout success does not end a session, and if it did then there would be no cart restore upon subsequent link clinking.

 

As far as i am aware the return URL is used for a successful payment,otherwise it should return the client to the checkout_payment.php if all is set up correctly.

 

 

 

<?php
/*
 $Id$

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2010 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

// if the customer is not logged on, redirect them to the shopping cart page
 if (!tep_session_is_registered('customer_id')) {
tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
 }

 if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'update')) {
$notify_string = '';

if (isset($HTTP_POST_VARS['notify']) && !empty($HTTP_POST_VARS['notify'])) {
 	$notify = $HTTP_POST_VARS['notify'];

 	if (!is_array($notify)) {
   	$notify = array($notify);
 	}

 	for ($i=0, $n=sizeof($notify); $i<$n; $i++) {
   	if (is_numeric($notify[$i])) {
     	$notify_string .= 'notify[]=' . $notify[$i] . '&';
   	}
 	}

 	if (!empty($notify_string)) {
   	$notify_string = 'action=notify&' . substr($notify_string, 0, -1);
 	}
}

tep_redirect(tep_href_link(FILENAME_DEFAULT, $notify_string));
 }

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_SUCCESS);

 $breadcrumb->add(NAVBAR_TITLE_1);
 $breadcrumb->add(NAVBAR_TITLE_2);

 $global_query = tep_db_query("select global_product_notifications from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . (int)$customer_id . "'");
 $global = tep_db_fetch_array($global_query);

 if ($global['global_product_notifications'] != '1') {
$orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where customers_id = '" . (int)$customer_id . "' order by date_purchased desc limit 1");
$orders = tep_db_fetch_array($orders_query);

$products_array = array();
$products_query = tep_db_query("select products_id, products_name from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$orders['orders_id'] . "' order by products_name");
while ($products = tep_db_fetch_array($products_query)) {
 	$products_array[] = array('id' => $products['products_id'],
                           	'text' => $products['products_name']);
}
 }

 require(DIR_WS_INCLUDES . 'template_top.php');
?>

<h1><?php echo HEADING_TITLE; ?></h1>

<?php echo tep_draw_form('order', tep_href_link(FILENAME_CHECKOUT_SUCCESS, 'action=update', 'SSL')); ?>

<div class="contentContainer">
 <div class="contentText">
<?php echo TEXT_SUCCESS; ?>
 </div>

 <div class="contentText">

<?php
 if ($global['global_product_notifications'] != '1') {
echo TEXT_NOTIFY_PRODUCTS . '<br /><p class="productsNotifications">';

$products_displayed = array();
for ($i=0, $n=sizeof($products_array); $i<$n; $i++) {
 	if (!in_array($products_array[$i]['id'], $products_displayed)) {
   	echo tep_draw_checkbox_field('notify[]', $products_array[$i]['id']) . ' ' . $products_array[$i]['text'] . '<br />';
   	$products_displayed[] = $products_array[$i]['id'];
 	}
}

echo '</p>';
 }

 echo TEXT_SEE_ORDERS . '<br /><br />' . TEXT_CONTACT_STORE_OWNER;
?>

 </div>

 <div class="contentText">
<h3><?php echo TEXT_THANKS_FOR_SHOPPING; ?></h3>
 </div>

<?php
 if (DOWNLOAD_ENABLED == 'true') {
include(DIR_WS_MODULES . 'downloads.php');
 }
?>

 <div class="buttonSet">
<span class="buttonAction"><?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'triangle-1-e', null, 'primary'); ?></span>
 </div>
</div>

</form>

<?php
 require(DIR_WS_INCLUDES . 'template_bottom.php');
 require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

 

Your cart should only empty on a successful checkout / return from PayPal.

Depending on your settings in admin for sessions and the configure.php cookie settings i would say that there is something not set up properly.

 

If you have a dedicated SSL then you will be better off choosing to force cookies rather than rely on sessions this is a more secure way as it also greatly reduces session hacking.

Sometimes you're the dog and sometimes the lamp post

[/url]

My Contributions

Link to comment
Share on other sites

FIMBLE

 

The checkout success does not end a session, and if it did then there would be no cart restore upon subsequent link clinking.

 

As far as i am aware the return URL is used for a successful payment,otherwise it should return the client to the checkout_payment.php if all is set up correctly.

 

Your cart should only empty on a successful checkout / return from PayPal.

Depending on your settings in admin for sessions and the configure.php cookie settings i would say that there is something not set up properly.

 

If you have a dedicated SSL then you will be better off choosing to force cookies rather than rely on sessions this is a more secure way as it also greatly reduces session hacking.

 

 

Hi and thank you for your reply.

 

I have compared the code you listed against my code in checkout_success.php and they are the same.

 

here are my sessions settings, do you think there is something wrong here?

 

Session Directory /tmp

Force Cookie Use False

Check SSL Session ID False

Check User Agent True

Check IP Address False

Prevent Spider Sessions True

Recreate Session True

 

Thank you

 

Michael

Link to comment
Share on other sites

Hi Michael

Try

 

Session Directory /tmp

Force Cookie Use False

Check SSL Session ID False

Check User Agent False

Check IP Address False

Prevent Spider Sessions True

Recreate Session False

 

if this does not do it then

 

Session Directory /tmp

Force Cookie Use False

Check SSL Session ID False

Check User Agent Fasle

Check IP Address False

Prevent Spider Sessions True

Recreate Session True

 

Other that this problem do the sesions work OK on the site?

Nic

Sometimes you're the dog and sometimes the lamp post

[/url]

My Contributions

Link to comment
Share on other sites

Hi Michael

Try

 

Session Directory /tmp

Force Cookie Use False

Check SSL Session ID False

Check User Agent False

Check IP Address False

Prevent Spider Sessions True

Recreate Session False

 

if this does not do it then

 

Session Directory /tmp

Force Cookie Use False

Check SSL Session ID False

Check User Agent Fasle

Check IP Address False

Prevent Spider Sessions True

Recreate Session True

 

Other that this problem do the sesions work OK on the site?

Nic

 

Hi Nic and thanks for the super fast reply.

 

I tried both sets of settings above and unfortunately when I still click the link cancel and

return to site I arrive back at the cart page with the cart stating that it is empty and as soon as I click on

anything else in the store the cart is back to showing the items again.

 

I am not sure how to tell if other parts of sessions are ok or not?

 

What could I try? Sorry for sounding a bit thick.

 

Thanks again

 

Michael

Link to comment
Share on other sites

Hi Michael

don’t worry you are not thick!

Which of the PayPal modules do you use, also which version of osC are you using?

For the Return URL from PayPal it should read http (better https if you have it)//:www.yoursite.co.uk/checkout_success.php although I do not think this is the issue as the problem happens when the client cancel and returns

If you are using the standard PayPal in your cart, it would be beneficial to use the PayPal IPN add on in its place.

Nic

 

 

Sometimes you're the dog and sometimes the lamp post

[/url]

My Contributions

Link to comment
Share on other sites

 

Hi Michael don’t worry you are not thick!

 

Which of the PayPal modules do you use, also which version of osC are you using?

For the Return URL from PayPal it should read http (better https if you have it)//:www.yoursite.co.uk/checkout_success.php although I do not think this is the issue as the problem happens when the client cancel and returns

If you are using the standard PayPal in your cart, it would be beneficial to use the PayPal IPN add on in its place.<br />Nic<br /><br /><br />

 

Hi again, thanks for the reply.

 

I am using the new version of Osc V2.3.1.

 

I am using the paypal module which was already there in payment options and is PayPal Express Checkout.

 

In my auto return I do have http at the beginning of the url but to be honest I do not think this is the problem because my problem

is happening before checkout is complete. The customer,(me), has not logged into paypal yet, what I am doing is deciding not to

complete my purchase or log into paypal but instead click the link that says "cancel and return to site"

 

So you think Paypal IPN would be better then instead of the PayPal Express Checkout which is already loaded for me with all the relevant buttons

on my pages already to go?

 

Thanks again for all your help

 

Michael

Link to comment
Share on other sites

PayPal express works differently to standard PayPal.

Can you instead, post your catalog / includes / configure.php file here DONOT include the passwords or usernames for the database.

Also replace your server username with xxxx as this is not needed

Also who is your host?

Nic

 

 

Sometimes you're the dog and sometimes the lamp post

[/url]

My Contributions

Link to comment
Share on other sites

PayPal express works differently to standard PayPal.

Can you instead, post your catalog / includes / configure.php file here DONOT include the passwords or usernames for the database.

Also replace your server username with xxxx as this is not needed

Also who is your host?

Nic

 

 

 

Hi Nic, Please find my config file here. let me know what you think. Thanks again.

 

<?php

define('HTTP_SERVER', 'http://affordablemobility.co.uk');

define('HTTPS_SERVER', 'https://web77.secure-secure.co.uk/affordablemobility.co.uk');

define('ENABLE_SSL', 'true');

define('HTTP_COOKIE_DOMAIN', 'affordablemobility.co.uk');

define('HTTPS_COOKIE_DOMAIN', 'https://web77.secure-secure.co.uk/affordablemobility.co.uk');

define('HTTP_COOKIE_PATH', '/mystore/');

define('HTTPS_COOKIE_PATH', '/mystore/');

define('DIR_WS_HTTP_CATALOG', '/mystore/');

define('DIR_WS_HTTPS_CATALOG', '/mystore/');

define('DIR_WS_IMAGES', 'images/');

define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/');

define('DIR_WS_INCLUDES', 'includes/');

define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'boxes/');

define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');

define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');

define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');

define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');

 

define('DIR_WS_DOWNLOAD_PUBLIC', 'pub/');

define('DIR_FS_CATALOG', '/home/sites/affordablemobility.co.uk/public_html/mystore/');

define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');

define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');

 

define('DB_SERVER', 'localhost');

define('DB_SERVER_USERNAME', 'xxxx');

define('DB_SERVER_PASSWORD', 'xxxx');

define('DB_DATABASE', 'xxxx');

define('USE_PCONNECT', 'false');

define('STORE_SESSIONS', 'mysql');

?>

 

I think I have deleted everything I needed to.

 

Michael

Link to comment
Share on other sites

could be something to do with the shared SSL you have.

Have you tried the PayPal standard (also in the base 2.3.1 package).

There is also a topic on here about SSL and sessions / cookies by Germ, you would need to search as i do not know its URL anymore.

I would say about adding a "." to the HTTP_COOKIE etc.. so it looks

define('HTTP_COOKIE_DOMAIN', '.affordablemobility.co.uk'); but as the return should be https. which incidentally unless you have

https://web77.secure-secure.co.uk/affordablemobility.co.uk/checkout_success.php as the return URL is also wrong

 

Nic

Sometimes you're the dog and sometimes the lamp post

[/url]

My Contributions

Link to comment
Share on other sites

could be something to do with the shared SSL you have.

Have you tried the PayPal standard (also in the base 2.3.1 package).

There is also a topic on here about SSL and sessions / cookies by Germ, you would need to search as i do not know its URL anymore.

I would say about adding a "." to the HTTP_COOKIE etc.. so it looks

define('HTTP_COOKIE_DOMAIN', '.affordablemobility.co.uk'); but as the return should be https. which incidentally unless you have

https://web77.secure...out_success.php as the return URL is also wrong

 

Nic

 

OK Nic, I have been doing some testing.

 

I installed the Paypal Website Payments Standard onto the site and when I go through the same senario with that payment module and click the

cancel and return to site link I get taken back to the "Payment Information" page which is linked to the checkout_payment.php file.

 

However when I do the same thing via Paypal Express Checkout and then go back to my site via the same link I land on the "Whats in my Cart" page which is

under shopping_cart.php file.

 

So each paypal module is taking me back to a different landing page and the one that takes me to the "Whats in my Cart" page (Paypal Express) is the one which shows no items in my cart, then

once I click a link the items are back again. When I land on the Payment Information page via the Paypal website payment Stadard return link the items are still in my cart first time.

 

So the problem is obviously how I land back on my site by cancelling the transaction. Where would I amend the call to action so that both modules land me on the Payment Information page?

Would I need to look in shopping_cart.php or can you think of something else?

 

Thinking about it, I do not get as far as the payment information page using the Paypal Express Checkout because the buttons for those are on the item description page. Once the paypal express

button link is pressed it diverts straight to paypal. This is where the trouble, bug or whatever you want to call it is. If the customer does not want to cancel the transaction then I guess it will not be a problem

its only when they cancel it will arise. I will have to check that theory next.

 

Thank you again for all your help

 

Michael

Link to comment
Share on other sites

I am looking at this add-on now, and the default redirect action is shopping cart for a cancelled order, the reason for this i expect is that the cart has not been enabled as yet, i.e. checkout_shipping.php has not been reached unlike the other PayPal where you need to go first through the shipping then payment to confirmation.

When the user is returned to your site the ppe_token (PayPal express) is indeed unregistered, but the item should remain in your cart still.

As this is intended action i am hesitant to alter its code; it’s there for a good reason.

 

 

Sometimes you're the dog and sometimes the lamp post

[/url]

My Contributions

Link to comment
Share on other sites

I am looking at this add-on now, and the default redirect action is shopping cart for a cancelled order, the reason for this i expect is that the cart has not been enabled as yet, i.e. checkout_shipping.php has not been reached unlike the other PayPal where you need to go first through the shipping then payment to confirmation.

When the user is returned to your site the ppe_token (PayPal express) is indeed unregistered, but the item should remain in your cart still.

As this is intended action i am hesitant to alter its code; it’s there for a good reason.

 

 

 

Thanks Nic for looking at that for me.

 

I can see what you are saying as I dont need to create an account and logon with the paypal express button, it takes me straight to paypal.

 

I think I need to test this further because if a customer does buy and pay for goods this way I will not know if their details are stored back at my site and if not I would need to log onto paypal to find out what is happening as regards orders and addresses etc. Perhaps Paypal IPN might be a better option with either Purchase without an account or one page checkout contributions installed. What do you think?

 

Thanks again

 

Michael

Link to comment
Share on other sites

I am looking at this add-on now, and the default redirect action is shopping cart for a cancelled order, the reason for this i expect is that the cart has not been enabled as yet, i.e. checkout_shipping.php has not been reached unlike the other PayPal where you need to go first through the shipping then payment to confirmation.

When the user is returned to your site the ppe_token (PayPal express) is indeed unregistered, but the item should remain in your cart still.

As this is intended action i am hesitant to alter its code; it’s there for a good reason.

 

 

 

Hi again, hope you are well.

 

I have now done some testing and the results although not good are consistent.

 

I have gone through the buying process and opted to pay via Paypal payments standard, this involved either creating an account on my site or logging into my site.

The payment went through ok and I got all the relevant emails about the order and I was returned to the checkout success page on my site.

 

I then logged out of my website and bought the same item again but this time I just clicked the express checkout button. I was taken again to the paypal website but

did not create an account with paypal. I paid using my credit card and entered all my details. I was then taken to a confirm page on paypal. I pressed the confirm

button and was immediately taken back to "Whats in my cart" page on my website with the cart showing as empty. As soon as I click any link the items appear in the cart again.

I have not had any emails to say the order was made and nothing is in the paypal account.

 

Somehow its getting lost between checkout and coming back?

 

Do you think this is a paypal issue or my settings?

 

Thank you again

 

Michael

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...