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

Purchase without account for 2.3.4 and BS2334

Recommended Posts

@@Mikepo

 

Adding the tick icon to the customers page is a good idea and is sure helpful. The admin could then delete older guest accounts.

The only problem is if I add a product to the cart and continue as guest then leave the shop without placing any order then later that same day I go back to that shop and try to place that order I can't login as guest because of the existing mail address error.

The best way would be something like @@burt explained, delete account data when mail address exist and the customer_guest field is status 1.


When you ask for help/support:

  • Always state your osCommerce version
  • If possible, list up installed add-ons
  • 3rd party templates are not supported in the forum

Latest osC: osCommerce CE (Community Edition aka. v2.3.4.1 Frozen)

 

Share this post


Link to post
Share on other sites

I gave it a try:

In account_pwa.php

under:

    $process = true;

Add:

    $check_query = tep_db_query("select customers_guest from customers where customers_email_address = '" . $_POST['email_address'] . "'");
    $check = tep_db_fetch_array($check_query);
    if ( $check['customers_guest'] == 1) {
      tep_db_query("delete from customers where customers_email_address = '" . $_POST['email_address'] . "'");
    }
Edited by raiwa

Share this post


Link to post
Share on other sites

@@Tsimi @@raiwa

I just checked this out and all seems well on my test server

 

in file account_pwa.php

 

FIND:

 

      $messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
    } else {

 

ADD AFTER:

 

      // check to see if guest email address is in DB and whether the flag is set
   $check_email_guest_query = tep_db_query("select customers_guest from " . TABLE_CUSTOMERS ." where customers_email_address = '". tep_db_input($email_address) . "'");
   // if flag set to 1 delete quest details so customer can proceed
   $check_guest = tep_db_fetch_array($check_email_guest_query);
   if ($check_guest['customers_guest'] == 1) {
    //delete the guest details
    tep_db_query("delete from " . TABLE_CUSTOMERS ." where customers_email_address = '". tep_db_input($email_address) . "'");
    }

 

The assumption is the quest flag is only set if the customer uses the PWA process, so no one can try and enter another persons email address to delete the account details without permission.  I think the logic is right?

 

I've got to add postcode formatting to the account_pwa.php file before I go live.  So please check this out before using.

 

Mike

Share this post


Link to post
Share on other sites

@@Mikepo

 

I tried your code but it still gives me the e-mail already exist message.

Raiwas code in post #53 on the other hand did the trick and works fine.

I also tried to use mail addresses of registered customers and it won't delete them as it should be.

Edited by Tsimi

When you ask for help/support:

  • Always state your osCommerce version
  • If possible, list up installed add-ons
  • 3rd party templates are not supported in the forum

Latest osC: osCommerce CE (Community Edition aka. v2.3.4.1 Frozen)

 

Share this post


Link to post
Share on other sites

Not sure if you have done this already but I replaced all FILENAME_ and TABLE_ instances for compatibility with latest EDGE shops.


When you ask for help/support:

  • Always state your osCommerce version
  • If possible, list up installed add-ons
  • 3rd party templates are not supported in the forum

Latest osC: osCommerce CE (Community Edition aka. v2.3.4.1 Frozen)

 

Share this post


Link to post
Share on other sites

The same error can appear if a guest which filled in his info and didn't finish the guest order decides to register a regular account. So the code should be also added to create_account.php.

Maybe it's possible to do by hook to avoid core file change?

 

Another question:

If we arrive to a satisfying solution it maybe should be included in the add-on package. ALso like Lmbros mentioned, the add-on should be updtaed for latest EDGE compatibility.

deDocta isn't any more with us and the package has no public uploads allowed.

Someone may wish to "adopt" it and upload the updated version as a new "reloaded" package. Any volunteer??

 

rgd

Rainer

Share this post


Link to post
Share on other sites

Or a HT Module....

 

I believe (though I am not sure) that I can unlock addons.  What is the exact addon URL ?


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest current code (community-supported responsive 2.3.4.1BS Edge) here

 

Share this post


Link to post
Share on other sites

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


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest current code (community-supported responsive 2.3.4.1BS Edge) here

 

Share this post


Link to post
Share on other sites

The same error can appear if a guest which filled in his info and didn't finish the guest order decides to register a regular account. So the code should be also added to create_account.php.

Maybe it's possible to do by hook to avoid core file change?

 

Another question:

If we arrive to a satisfying solution it maybe should be included in the add-on package. ALso like Lmbros mentioned, the add-on should be updtaed for latest EDGE compatibility.

deDocta isn't any more with us and the package has no public uploads allowed.

Someone may wish to "adopt" it and upload the updated version as a new "reloaded" package. Any volunteer??

 

rgd

Rainer

 

@@raiwa

agreed, the create_account.php also needs this code.  I've checked this to confirm. works OK!

regarding creating a "reloaded" package, I could do this but it would be for BS gold,  and I'm not understanding hooks, so I couldn't create a package without core changes.

 

Mike

Share this post


Link to post
Share on other sites

@@Mikepo, @@Tsimi,

 

 

@@raiwa

 

You have this installed in your shop right?

Do you use PayPal Express?

Yes I use PayPal express and it works well together with PWA.

 

 

@@raiwa

agreed, the create_account.php also needs this code.  I've checked this to confirm. works OK!

regarding creating a "reloaded" package, I could do this but it would be for BS gold,  and I'm not understanding hooks, so I couldn't create a package without core changes.

 

Mike

 

I will give it a try and create a Header Tag module for the code inclusion in create_account.php. I can also de the update to latest EDGE.

Give me just some days, maybe one week and I'll upload first here for you to test and check if all is ok.

 

 

I did a fast check with Mike's code and it seems to work for me. Lambros could you give it a second try. In general I like Mike's solution better. I's more correct placed and using tep_db_input($email_address) seems to be more secure. I'll check again and see.

 

rgds

Rainer

Edited by raiwa

Share this post


Link to post
Share on other sites

Lambros could you give it a second try. In general I like Mike's solution better. I's more correct placed and using tep_db_input($email_address) seems to be more secure. I'll check again and see.

 

Just did and this time it worked not sure why it didn't the first time.


When you ask for help/support:

  • Always state your osCommerce version
  • If possible, list up installed add-ons
  • 3rd party templates are not supported in the forum

Latest osC: osCommerce CE (Community Edition aka. v2.3.4.1 Frozen)

 

Share this post


Link to post
Share on other sites

Hi,

 

Here the ht module to remove guest accounts in create account page.

I had to find a workaround for the following:

Header tags are loaded in template_top.php, this is after the error checks of the create account page.

So the error appeared on first intent because of the account wasn't deleted yet when the mail was checked.

I added a redirect to the create account page itself after the account delete query in the header tag.

It works and I hope it's the correct way. Or anyone has a better idea?

 

Please give it a try.

 

 

 

I'll continue with the EDGE update of all files.

 

rgds

Rainer

Share this post


Link to post
Share on other sites

@@raiwa

 

Hi Rainer

 

Just tested your HT module.

First I created a guest account and logged out so that the guest account data was left in the database.

Then I added a product into the cart and clicked the checkout button.

At the login page I chose create new account and entered the same mail address as I used for the guest account.

After filling out all fields and clicking on the continue button the create account page reloads and the fields are empty.

In the admin and database the guest account has been deleted. But no new account has been created nor does it continue with the checkout.

 

It does what the code inside the HT module says but it should continue with the checkout or redirect to the create account success page right?


When you ask for help/support:

  • Always state your osCommerce version
  • If possible, list up installed add-ons
  • 3rd party templates are not supported in the forum

Latest osC: osCommerce CE (Community Edition aka. v2.3.4.1 Frozen)

 

Share this post


Link to post
Share on other sites

@@Tsimi,

 

I could swear it worked for me this morning. Now I tried again and the same like you say. :-

The html parameters got lost. I tried several things, but the only thing I got to work is with javascript:

Please try this change in ht module:

        if ($check_guest['customers_guest'] == 1) {
          //delete the guest details
          tep_db_query("delete from customers where customers_email_address = '". tep_db_input($email_address) . "' and customers_guest = '1'");
          //reload page to check e-mail after guest account has been deleted
//  				tep_redirect(tep_href_link('create_account.php', tep_get_all_get_params(), 'SSL'));
?>
<script>
location.reload();
</script>
<?php
        }
      }
    }

thanks

Share this post


Link to post
Share on other sites

@@raiwa

 

Now it loads the page and continues to the success page and from there to the checkout process. :thumbsup:

I tested with Chrome and Firefox browsers.

 

With Firefox I get this popup message

 

 

To display this page, Firefox must send information that will repeat any action (such as a search or order confirmation) that was performed earlier

 

With Chrome all is working fine as it suppose to.

Edited by Tsimi

When you ask for help/support:

  • Always state your osCommerce version
  • If possible, list up installed add-ons
  • 3rd party templates are not supported in the forum

Latest osC: osCommerce CE (Community Edition aka. v2.3.4.1 Frozen)

 

Share this post


Link to post
Share on other sites

@@Tsimi,

 

Yes, saw this with Firefox, it also happens with some other add-ons, if I well remember. Anyway, lets say it will not happen too often and better than to be unable to create the account. If anyone has any better idea, very welcome.

 

rgds

Rainer

Share this post


Link to post
Share on other sites

new version updated and ready for testing and suggestions.

 

Changes Version. 2.0
- update for EDGE compatibility: hardcoded filenames, database table names, paths. Superglobals. fa icons
- removed check_account.js.php
- added check for existing guest account with the same e-mail in account_pwa.php
- added ht module to check for existing guest account with the same e-mail for create_account.php
- moved language definitions to module
- made remove database guest column in orders table optional when module is uninstalled to keep guest orders flagged.
- added comments to all core file changes
- instructions rewritten
- update instructions added
 

 

I modified the guest account check and delete script in account_pwa.php and ht_pwa_delete_account.php to check for customer_id where customers_email_address = '". tep_db_input($email_address) . "' and customers_guest = '1'

 

then the entries in customer and also address_book tables are deleted by customer_id:

      $check_guest_query = tep_db_query("select customers_id from customers where customers_email_address = '". tep_db_input($email_address) . "' and customers_guest = '1'");
      $check_guest = tep_db_fetch_array($check_guest_query);
      if ( tep_not_null($check_guest) ) {
        tep_db_query("delete from customers where customers_id = '". $check_guest['customers_id'] . "' and customers_guest = '1'");
        tep_db_query("delete from address_book where customers_id = '". $check_guest['customers_id'] . "' and customers_guest = '1'");

I added and customers_guest = '1' to all queries to make sure that only guest entries are deleted. Even it shouldn't be needed in the delete queries, but it also doesn't make harm.

 

Please give it a try and let me know if there are any errors or if you have any suggestions.

 

 

 

Thanks and best regards

Rainer

Edited by raiwa

Share this post


Link to post
Share on other sites

@@raiwa

I noticed last night the text

EMAIL_WARNING

is not defined in the email sent to the "guest" customer after the order is confirmed.

Defining this in the appropriate language file fixes the problem.

 

I used the following text

Note: This email address was used to purchase products from our web store.  If you did not intend to or not aware of this online purchase please send an email to admim@store.com

 

I'll test the package later

Mike

Share this post


Link to post
Share on other sites

@@Mikepo, this is moved from the checkout_process language file to the login module. Check in this package please.

 

You'll need to uninstall and reinstall the module and change the code in checkout_process.php. See update instructions.

Edited by raiwa

Share this post


Link to post
Share on other sites

@@raiwa

 

Hi Rainer

 

I just installed your PWA for BS 2.0.zip package.

All looks good here.

 

I only found this typo;

 

Inside the install manual Step 2.2 the FIND query has no TABLE_ definitions and can therefore not be found.

Your thinking is the correct, future proof way, Gary will replace those TABLE_ instances in the future but till then they are there.

That step could be changed to something like

Find:
        $check_status_query = tep_db_query("select customers_name, customers_email_address, orders_status, date_purchased from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'");
 
 or
 
        $check_status_query = tep_db_query("select customers_name, customers_email_address, orders_status, date_purchased from orders where orders_id = '" . (int)$oID . "'");

then further below the same thing with this piece here

<?php
    if (isset($HTTP_GET_VARS['cID'])) {
      $cID = tep_db_prepare_input($HTTP_GET_VARS['cID']);
      $orders_query_raw = "select o.orders_id, o.customers_name, o.customers_id, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, ot.text as order_total from orders o left join orders_total ot on (o.orders_id = ot.orders_id), orders_status s where o.customers_id = '" . (int)$cID . "' and o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and ot.class = 'ot_total' order by orders_id DESC";
    } elseif (isset($HTTP_GET_VARS['status']) && is_numeric($HTTP_GET_VARS['status']) && ($HTTP_GET_VARS['status'] > 0)) {
      $status = tep_db_prepare_input($HTTP_GET_VARS['status']);
      $orders_query_raw = "select o.orders_id, o.customers_name, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, ot.text as order_total from orders o left join orders_total ot on (o.orders_id = ot.orders_id), orders_status s where o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and s.orders_status_id = '" . (int)$status . "' and ot.class = 'ot_total' order by o.orders_id DESC";
    } else {
      $orders_query_raw = "select o.orders_id, o.customers_name, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, ot.text as order_total from orders o left join orders_total ot on (o.orders_id = ot.orders_id), orders_status s where o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and ot.class = 'ot_total' order by o.orders_id DESC";
    }

Another thing that we/you could add is Mikepos code for the admin/customer.php file to show the guest tick icon there too just in case a guest doesn't intend to continue his shopping for...eternity. Then the admin can delete the account manually after a certain time.

Edited by Tsimi

When you ask for help/support:

  • Always state your osCommerce version
  • If possible, list up installed add-ons
  • 3rd party templates are not supported in the forum

Latest osC: osCommerce CE (Community Edition aka. v2.3.4.1 Frozen)

 

Share this post


Link to post
Share on other sites

@@Tsimi,

 

Yes, thank you for these points. For the table constants, maybe I'll include both versions in the "Find:" code. Like this it is already prepared when the TABLE_ 's will be replaced and no new version will be needed.

The "tick"s in customer.php will be added, makes sense.

I'll re-read the thread if there are more issues to be included.

 

Best regards

Rainer

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

×