Jump to content
Latest News: (loading..)
ArtcoInc

Purchase without account for 2.3.4 and BS2334

Recommended Posts

I've been using PWA on my live site for over a year. A significant number of customers make their purchase as Guests, even returning customers. If that's what they want to do, give them what they want, right?

 

Anyway, this thread got me to look at my customer table. I have a number of customers that are flagged as Guests. I also see several orders linked to them, so I don't think I want to delete them from the customers table.

 

This also got me looking at my orders table. I'm seeing (for example) two orders to two different customers, but both have the same customer_id. Clearly, this is wrong! The customer information (name, address, email address, etc) is correct, but the customers_id is wrong. And, from just a quick look, it looks like one of the orders is to a Guest. I'm going to have to look deeper into this ...

 

If anyone else has a live site and is using PWA, can you check your orders table to see if you see this too, or if this is just something I've done?

 

Thanks!

 

Malcolm


If you are running the "official" osC 2.3.4 or 2.3.4.1 download, your installation is obsolete! Get the latest community-supported responsive "Frozen" release here

Share this post


Link to post
Share on other sites

@@ArtcoInc,

 

The new version will help to keep the database clean.

Guest customers in the customer table are left over because they have not been deleted on checkout for whatever reason. Maybe they didn't return from PayPal or another external payment service. Anyway only guest orders should be maintained in the database, not guest customers. This could even prevent returning guest customers to use guest checkout again like explained in this thread.

In the new version this issue is also corrected.

Share this post


Link to post
Share on other sites

New version finished.

 

Changes:

- added guest flag to admin/customers. thanks to @@Tsimi for the idea
- replaced checkout_success_pwa.php page by "cm_cs_pwa_products_purchased.php" checkout_success module and modified product_notifications and download modules. thanks@@marcello for the module base
- compatibility with paypal_standard and other external payment services including for virtual (downloadable) products
- added option to exclude guest checkout for virtual(downloadable) orders.
- added option to select payment modules to be hidden for virtual(downloadable) orders.
- added ht module to check for existing guest account with the same e-mail for create_account.php and session unregister if download enabled and coming from checkout_success.php to another page.

- added advise for virtual orders to order mail and checkout success download module. Contact store owner if any difficulties to download product.

- added alert to pwa login module if ht module is not installed

 

To update form previous version, uninstall all modules, upload and replace all files. Follow the update instructions.

Modified core files included. Based on latest EDGE, but should work for all 2.3.4BS versions.

ONly english language files updated for now!!

 

Please try!

 

 

rgds

Rainer

Edited by raiwa

Share this post


Link to post
Share on other sites

@@raiwa

 

PWA 2.0 looks good here.

The only thing I can't confirm is the e-mail layout and contents. I only can test on local XAMPP server at the moment.

Share this post


Link to post
Share on other sites

@@Tsimi,

 

Thanks, found a minor fault in the instructions just for order e-mail confirmation in checkout_process.php.

Should be:

// lets start with the email confirmation
  $email_order = STORE_NAME . "\n" . 
                 EMAIL_SEPARATOR . "\n" . 
// PWA guest checkout BEGIN
                 EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n";
                
  if(!tep_session_is_registered('customer_is_guest')) {         
    $email_order .= EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link('account_history_info.php', 'order_id=' . $insert_id, 'SSL', false) . "\n";
  }
  
  if(tep_session_is_registered('customer_is_guest')) {         
    $email_order .= constant('MODULE_CONTENT_PWA_EMAIL_WARNING_' . strtoupper($language)) . "\n\n" . 
                    EMAIL_SEPARATOR . "\n"; 
    if($order->content_type != 'physical') {         
      $email_order .= constant('MODULE_CONTENT_PWA_DOWNLOAD_' . strtoupper($language)) . "\n" . 
                      EMAIL_SEPARATOR . "\n";
    }
  }
// PWA guest checkout END

  $email_order .= EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
  if ($order->info['comments']) {
    $email_order .= tep_db_output($order->info['comments']) . "\n\n";
  }

the last 4 lines were missing in the replace by code

 

 

There is a great mail testing tool I'm using together with xampp:

https://github.com/ChangemakerStudios/Papercut

It was recommended in some thread here by HpdL

 

rgds

Rainer

Share this post


Link to post
Share on other sites

Uploaded new version:

Purchase without account BS reloaded

 

Start up a new one.  Once done I'll put a note on this one telling people so.

@@burt, would you like to add the note to the old add-on:

http://addons.oscommerce.com/info/9142

 

Thanks to all for suggestions, snippets and testing

 

rgds

Rainer

Share this post


Link to post
Share on other sites

Update with some small fixes uploaded:

 

Changes Version. 2.1
- modified checkout success thank_you.php template module to hide account text and link for guests.
- changed contact text in downloads module from store e-mail to button link to contact page
- screenshots added

Share this post


Link to post
Share on other sites

I've not tested the latest version of this addon, I'm running the previous one with the additions as listed in this topic.

 

All seems ok except I noticed a customer had placed on order and the guest tick wasn't present in the order list.  However the guest tick was present in the customer table.  I thought this couldn't happen, but I was wrong.

 

When a customer attempts to purchase using the PWA method the customer can logoff as the option appears on the navbar.

 

If this is done the customer can request a new password, and then login and make the purchase in the normal way.

 

Doing this the customer table will have the guest tick and the order table won't be ticked.

(perhaps the request for a new password should be restricted  if the customer table is ticked)

 

This is the only way I found to reproduce the scenario, however looking at the logs the customer didn't follow this process. So I'm still confused way the customer table is ticked and the order table isn't

 

Any thoughts?


osC BS gold live - osC CE in development (awesome)

Share this post


Link to post
Share on other sites

@@Mikepo,

 

I tried, but couldn't recreate what you explain. I always get the order and customer list correct flagged. Maybe there is a scenario, but we should find out when exact this can happen.

 

When a customer attempts to purchase using the PWA method the customer can logoff as the option appears on the navbar.
If this is done the customer can request a new password, and then login and make the purchase in the normal way.

 

Do you think a real guest customer will do this?? I believe it would be overengineered to take care for this situation.

Share this post


Link to post
Share on other sites

@@raiwa

Just done more testing, and it appears that when the customer pays with PayPal the issues araises

 

When the customer is returned to the shop from paypay, the order table it not ticked and the customer is still logged in. ( the logout option appears in the navbar)

 

So it would suggest that the session doesn't recognise that the customert is a guest.

 

I also have an option for the customer to pay on collection, and that process works.  So Paypal is causing the issue!

 

have you tested this with paypal or another payment provider?


osC BS gold live - osC CE in development (awesome)

Share this post


Link to post
Share on other sites

@@raiwa,

I'm using the latest PayPal app v4.039,  is that what you have tested this addon with?


osC BS gold live - osC CE in development (awesome)

Share this post


Link to post
Share on other sites

@@Mikepo,

 

If you are using paypal standard, it is possible that the order doesn't get flagged if they do not return to the store and do not arrive to checkout_success.php

This is an old flaw of paypal standard and there is no way to 100% fix it.

The orders get flagged in checkout_success.php:

        tep_db_query("update orders set customers_guest = '1' where customers_id = '" . (int)$customer_id . "'");

At least activate "auto return to shop" in your PayPal account.

Better use paypal express. There it works always.

 

Another possibility would be to set the guest flag already in checkout_process, but it would be an additional core change. OOhps, we could do it in the header tag. I'll have a look on this.

 

rgds

Rainer

Edited by raiwa

Share this post


Link to post
Share on other sites

@@raiwa

I'm using the paypal standard, from the app, and the return url is set to checkout_success.php

auto return to shop is also set in paypal.

 the problem is when paypal is used, the customer is not deleted from the customer table, and the order is not flagged(ticked) in the order table and the customer is not logged out at the end of the process

 

I'll have to investigate further


osC BS gold live - osC CE in development (awesome)

Share this post


Link to post
Share on other sites

@@Mikepo, as I said, this happens only if they do not return to checkout success and it's logical that happens what you say. Both is done in checkout success. Guest customer delete and guest order flagged. Even auto return is enabled, there is a 10 sec wait period, if they just close the browser tab or open another page before return to store, it happens.

Share this post


Link to post
Share on other sites

@@raiwa

as the customer is returned to checkout_success.php from PayPal, how does the PWA process get to checkout_success_pwa.php?

 

I can see why the issue I have  is happening now.

 

looking at checkout_process the code is

  tep_session_is_registered('customer_is_guest') ? tep_redirect(tep_href_link('checkout_success_pwa.php', '', 'SSL')) : tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL'));
 

so should I set PayPal to return to checkout_process.php instead of checkout_success.php ?


osC BS gold live - osC CE in development (awesome)

Share this post


Link to post
Share on other sites

Hello Mike @@Mikepo,

Sorry, I was wrong, paypal standard creates the order in the payment module before going to paypal and returns to checkout_process.php.

So the only way to flag the order as a guest order before going to PayPal is to modify the paypal_standard payment module itself.

Please give this a try:
in: includes/modules/payment/paypal_standard.php
find:

                                  'currency_value' => $order->info['currency_value']);

          tep_db_perform(TABLE_ORDERS, $sql_data_array);

and replace by:

                                  'currency_value' => $order->info['currency_value']);

          if (tep_session_is_registered('customer_is_guest') )
            $sql_data_array = array_merge(array('customers_guest' => 1), $sql_data_array);
          
          tep_db_perform(TABLE_ORDERS, $sql_data_array);

please confirm and I'll include it in the next update.

 

rgds

Rainer

Share this post


Link to post
Share on other sites


 

@@raiwa
as the customer is returned to checkout_success.php from PayPal, how does the PWA process get to checkout_success_pwa.php?
 
I can see why the issue I have  is happening now.
 
looking at checkout_process the code is
  tep_session_is_registered('customer_is_guest') ? tep_redirect(tep_href_link('checkout_success_pwa.php', '', 'SSL')) : tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL'));
 
so should I set PayPal to return to checkout_process.php instead of checkout_success.php ?

 you do not need to change the redirect in the new version. You should revert this change for the new PWA 2.1 or 2.0 version.
checkout_success_pwa.php doesn't exist any more, standard checkout_success.php is used instead.
Did you follow the update instructions for PWA2.0:
 4.2 checkout_process.php;
Revert changes of previous version.


You should have this in checkout_process.php:

  tep_redirect(tep_href_link('checkout_success.php', '', 'SSL'));
Edited by raiwa

Share this post


Link to post
Share on other sites

as the customer is returned to checkout_success.php from PayPal, how does the PWA process get to checkout_success_pwa.php?

 

No, paypal standard redirects to checkout_process.php first:

                          'return' => tep_href_link('checkout_process.php', '', 'SSL'),

Share this post


Link to post
Share on other sites

@@raiwa

I've not upgraded to the latest reloaded version of PWA, which I think I should now, as all these discussions are getting confusing.

 

I'll upgrade tonight, and add the following code as you suggest.

 

in: includes/modules/payment/paypal_standard.php

find:

'currency_value' => $order->info['currency_value']);

 

tep_db_perform(TABLE_ORDERS, $sql_data_array);

 

 

 

 

and replace by:

'currency_value' => $order->info['currency_value']);

 

if (tep_session_is_registered('customer_is_guest') )

$sql_data_array = array_merge(array('customers_guest' => 1), $sql_data_array);

 

tep_db_perform(TABLE_ORDERS, $sql_data_array);

 

 

I'll post my findings later


osC BS gold live - osC CE in development (awesome)

Share this post


Link to post
Share on other sites

@@raiwa, I tried to follow the instructions to upgrade, but it was easier to uninstall the module, and remove the old code.  So I'm now ready to do a fresh install of version 2.1.  I'll post back when done and tested.


osC BS gold live - osC CE in development (awesome)

Share this post


Link to post
Share on other sites

@@raiwa

just trying to install version 2.1 on a test server

 

your installation.txt file, point 2.3.b. tells me to edit /includes/modules/content/checkout_success/cm_cs_product_notifications.php

should this be /includes/modules/content/checkout_success/templates/thank_you.php  ???

 

installing the header_tag, description is PWA Guest Account, should this be "Delete PWA Guest Account"?

​All seems to be working OK: COD shipping works, click and collect shipping works, just need to test PayPal.

 

I'll post an update later


osC BS gold live - osC CE in development (awesome)

Share this post


Link to post
Share on other sites

Hello @@Mikepo,

 

Yes, you are right Point 2.3.b in Installation  and 3.b in Update is a typo. Thank You.

 

I changed "Delete PWA Guest Account" to "PWA Guest Account" because the ht module includes now also the code to unregister "customer_is_guest" and "customer id" (logout) session variables if download is enabled. I didn't change the module name itself to avoid more confusion with the develop versions.

So at least the displayed title is more correct. Maybe I created more confusion now, sorry.

 

I revised all instructions and have already prepared the new version with your correction and the PayPal Standard modification.

Just waiting your confirmation (no panic) and I'll upload the update.

 

Thank You

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×