SUGGESTION : Improvement on generating Guest Customer

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
8 лет назад
Hello Guys,

I Know that b'coz of supporting Guest checkout we have to create new guest customer on every visit so guest customer can place order without registering.

I have one suggestion is instead of creating new guest customer on every new customer visit we can create one System customer like other system customer called like "Built In-GuestCustomer" etc and assign this user as _workContext.currentCustomer on every guest visit.

And when that customer add items in cart for shopping we just create new Guest Customer and set it as current customer and add cart item to current customer so they can checkout as guest as well.

so it will reduce the overhead of guest customer on customer table and may be we don't need schedule task for delete the guest customer as well.


Please suggest your opinion
8 лет назад
Hi Vipul,

thanks a lot for suggestion. please vote for this work item here
8 лет назад
Done!!
thanks for your interest & help
7 лет назад
Hello,

I'm using Web API's to perform some customized stuff in nopCommerce (asset mgmt. of sold goods). The Web API methods receive information from an Android/IoS app. The app has the possibility to create a new user (customer in nop) and therefore I need to do some upfront checking: is the email already in use, does the customer exist,...:

            if (!String.IsNullOrWhiteSpace(email))
            {
                var cust = _customerService.GetCustomerByEmail(email);
                if (cust != null)
                    return EEPC_BadRequest("Email is already registered");
            }

When executing this call, the 'Guest account' is created. I've tried to set the _workContext.CurrentCustomer to the build-in SearchEngine account like so:

            _workContext.CurrentCustomer = _customerService.GetCustomerBySystemName(SystemCustomerNames.SearchEngine);

However I guess that even the GetCustomerBySystemName() call will generate the Guest account.
So I try to set the _workContext.CurrentCustomer variables individually like so:

            _workContext.CurrentCustomer.Active = true;
            _workContext.CurrentCustomer.CustomerGuid = new Guid("0f806806-7a1d-4780-b5a6-320ca123c842");
            _workContext.CurrentCustomer.Id = 2;
            _workContext.CurrentCustomer.Email = "builtin@search_engine_record.com";
            _workContext.CurrentCustomer.IsSystemAccount = true;
            _workContext.CurrentCustomer.PasswordFormatId = 0;
            _workContext.CurrentCustomer.SystemName = SystemCustomerNames.SearchEngine;
            _workContext.CurrentCustomer.Username = null;
            _workContext.CurrentCustomer.VendorId = 0;

and make the call to GetCustomerByEmail(email), still the guest account gets created.

So simple question: How can I avoid the 'Guest' account gets created in my WebAPI method?

tx for the help!
7 лет назад
you have to change code in currentcustomer in workcontext to achieve this goal.
7 лет назад
vipul.dumaniya wrote:
Hello Guys,

I Know that b'coz of supporting Guest checkout we have to create new guest customer on every visit so guest customer can place order without registering.

I have one suggestion is instead of creating new guest customer on every new customer visit we can create one System customer like other system customer called like "Built In-GuestCustomer" etc and assign this user as _workContext.currentCustomer on every guest visit.

And when that customer add items in cart for shopping we just create new Guest Customer and set it as current customer and add cart item to current customer so they can checkout as guest as well.

so it will reduce the overhead of guest customer on customer table and may be we don't need schedule task for delete the guest customer as well.


Please suggest your opinion


Maybe I am not clear, but to set visitors as "Built-in-GuestCustomer", you could only have one customer on your site at a time....because the guest customer's cart contents must be unique to him...
7 лет назад
Has this issue been resolved?

I am looking all over the web to find out if the guest customer creation issue is still happening with nopCommerce 3.70. But cannot find a definite answer.

From what I gathered the creation of guest record for simple page visit does not make sense to me. Why not use cookies for that? Until the user decides to actually purchase something.

Also, on a side note: trying to rely on user agent to filter useless page request is also a bad idea - there are millions of request from all sorts of third party systems with their own user agent. nop will never be able to keep track of them all.

The bottom line is that nop should rely on cookies until the user does something useful on the site. And if cookies is not supported then who cares. I am personally investing a lot of money on nop 3.70 for our business - and I can tell you without a doubt that I have zero business interest in supporting users with browser that do not accept cookies - on the other hand I have a lot of interest in running a system that does not generate tons of useless data.

Hope this helps,

Frederic
7 лет назад
embryo wrote:

Maybe I am not clear, but to set visitors as "Built-in-GuestCustomer", you could only have one customer on your site at a time....because the guest customer's cart contents must be unique to him...


When visitor add item to cart that time we will create new guest customer and assign cart item to that new customer and set that as current customer so each user will have unique cart items.

"Built-in-GuestCustomer" customer is just used for visitors only who don't do any action and just visit the site so only for normal visitor it will not create guest customer records it will use built in guest customer record to visit the sites.
7 лет назад
FredBell wrote:
Has this issue been resolved?

I am looking all over the web to find out if the guest customer creation issue is still happening with nopCommerce 3.70. But cannot find a definite answer.

From what I gathered the creation of guest record for simple page visit does not make sense to me. Why not use cookies for that? Until the user decides to actually purchase something.

Also, on a side note: trying to rely on user agent to filter useless page request is also a bad idea - there are millions of request from all sorts of third party systems with their own user agent. nop will never be able to keep track of them all.

The bottom line is that nop should rely on cookies until the user does something useful on the site. And if cookies is not supported then who cares. I am personally investing a lot of money on nop 3.70 for our business - and I can tell you without a doubt that I have zero business interest in supporting users with browser that do not accept cookies - on the other hand I have a lot of interest in running a system that does not generate tons of useless data.

Hope this helps,

Frederic


I think its not fixed yet but we can try above logic to fix this issue.

i already implement on one of my big client site as on that site it creating tons of guest customer so i have used above logic to prevent creating guest customer for normal visitors
5 лет назад
Hi Vipul,
It is very good logic. Can you give much more specific info. Which file we should edit. Can you share the code block that run the logic.

vipul.dumaniya wrote:
Has this issue been resolved?

I am looking all over the web to find out if the guest customer creation issue is still happening with nopCommerce 3.70. But cannot find a definite answer.

From what I gathered the creation of guest record for simple page visit does not make sense to me. Why not use cookies for that? Until the user decides to actually purchase something.

Also, on a side note: trying to rely on user agent to filter useless page request is also a bad idea - there are millions of request from all sorts of third party systems with their own user agent. nop will never be able to keep track of them all.

The bottom line is that nop should rely on cookies until the user does something useful on the site. And if cookies is not supported then who cares. I am personally investing a lot of money on nop 3.70 for our business - and I can tell you without a doubt that I have zero business interest in supporting users with browser that do not accept cookies - on the other hand I have a lot of interest in running a system that does not generate tons of useless data.

Hope this helps,

Frederic

I think its not fixed yet but we can try above logic to fix this issue.

i already implement on one of my big client site as on that site it creating tons of guest customer so i have used above logic to prevent creating guest customer for normal visitors
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.