Redirect to register if Guest checkout is disabled Magento 2 - magento2

From admin (sales/checkout) I set up the option Allow Guest Checkout to no.
When (after I added a product in cart) I click on place order now, the message: Guest checkout is disabled Magento 2 is displayed.
I want to redirect to register page.
Can you please help me?
Thank you.

Steps to achieve this:
Go to Magento Admin -> Stores -> Configuration -> Customers -> Customer Configuration and set Require Emails Confirmation to yes (you will see a pop-up with login/register form).

Related

How to create users in on-boarding or checkout process

I have 3 different use case were i want to create a sysusers, in same model:
in on-boarding process of my customers to the platform my customers
co-workers register to be users on their organization from email
invite my customers customers register a account in the checkout
process.
And I want them to enter their new password i the process. How do I solve this best?
In the latest version the returnUrl is kept even when the user goes through register and that solves the issue. Thanks MDriven for absolutely terrific support!
Even if it is possible to go this route I would suggest that you flip it the other way around. Ask the user to create an account. Once they have an account you promote that account to being coworker and/or customer by setting some state on the already existing sysuser.
... Have a UserInvite object - email the link to a page where the invite is accepted - in the accept page show user link to register or login if they have not done that.
Once you have a CurrentUser and UserInviteObject in scope you can tie it all together and be done think.

Magento 2 how to get best selling products

In magento 2 how can i get best selling products in block ?
And how can we find online visitor in Magento 2
Thanks in advance
Check Below URL for Best Selling Products:
Best way to display bestseller products
For online customer You have to login in Magento Backend And follow the Below Steps
Customer -> Now Online
I solved it.
Go to Report->Bestsellers then click on statistics link and then select "Refresh Lifetime Statistics" -> submit.

Disabling customer login & registration on checkout in Magento

I've been looking for a few days now for a way to disable the automatic customer registration that occurs when a customer finishes an order in the checkout in Magento. What happens is that the user is logged in to his or her account, and two emails are sent. One containing the order confirmation, and another one, welcoming the user as a customer, including his or her account information.
What I'd like to do is to disable the email containing the welcome, and disable the registration/ login of the account.
Like I said, I've been trying to find some leads on where to look for a few days now, but to no avail. I'd appreciate if someone could help me figure out what files to look at, and also what parts of those files.
Also, maybe I should mention that the website is using a One Step Checkout.
Thanks in advance,
Base on your system setting you need to make changes in one of the two files listed below. Copy the templates to your custom theme folder and make the changes as needed to remove the login section and links.
/app/design/frontend/base/default/template/checkout/onepage/login.phtml
/app/design/frontend/base/default/template/persistent/checkout/onepage/login.phtml

Virtuemart 2 Order confirmation before payment

I'm using VM 2.0.6 and Joomla 2.5 and the Multisafepay payment gateway.
Whenever a user puts a product in his cart, and clicks on checkout, the user is send to another page completely (Multisafepay's website, so not VM anymore) where he can select his desired payment option - same thing as paypal for example. But, at that time, Virtuemart is already sending an e-mail to the user confirming his order. That e-mail is saying: Thank you for your order blabla, the status of your order is blank..
So, VM is already sending an e-mail before the user payed.
Does anybode relate to this or knows an answer?
VM 2.0.6 is working like this :
when the order is placed that means any one of the shipping and payment method is selected.
and cart have valid data it will create the order and send an email to the user that mentioned
an order has been placed.
You can change
the sending mail section if you need.
One function name with notifyemail (iam not sure the name but it start with notify) in the path:
administrator/components/com_virtuemart/models/orders.php
you can check all your required things like shipping /payment methods are selected before calling this function.
the function should be initiate from cart.php controller in front end.
You can change the point where an invoice copy is sent to the customer in the Store Configuration. Look for Configuration > check out > Default Order Status to send an invoice and make sure you have the Confirmed status chosen.

How do I disable notification emails in Magento?

How do I disable a particular notification email, for example the welcome email when a user creates an account?
We can disable all email communication in Magento by
Login to Magento backend
Go to the System->Configuration menu.
On the left hand menu under the Advanced tab (at the bottom) select the System menu item.
Select ‘Mail Sending Settings’ from the selection on the right hand side.
Set Disable email communications to
‘Yes’, then no email will send
through Magento.
There is no buit-in ability to disable particular email notifications in Magento. I suggest you to look at the Mage_Core_Model_Email_Template::sendTransactional method. You can overload this class and add check against allowed/disallowed email notifications (based on template name).
Update: you can use extension for disabling specific email notifications in Magento 1.
Also, there is Disable Emails extension for Magento 2.
See:
admin/system_config/edit/section/sales_email/
You can enable/disable all the transaction emails as you want with the exception of the create account email.
I do not suggest that you disable the new account email. This is because it has their login details including password. It is not sent with guest checkout, maybe you need to make your store 'guest checkout only' if that is what you want.
This is a feature in the configuration settings as of Magento ver. 1.9.2.1 (maybe earlier)
System >> Configuration >> Sales Emails >> Enable/disable individual emails.
Magento 2.3:
Stores > Configuration > Advanced (at the bottom of the left vertical menu) > System
Then Mail sending settings > Disable Email Communications: Yes
Also, make sure you clear the cache from System > Cache management
There's another method, using the command line:
php bin/magento config:set system/smtp/disable 1
php bin/magento cache:flush
1 = Disable email sending
0 = Enable email sending
Inspired by #Mage_user 's question I created extension that allows to disable any email notification in Magento. So, #Bizboss you can use it to disable new order email.
In Magento 2.4.2, you can easily navigate to stores > settings > configuration. Then under Sales > Sales emails, you should be able to disable the notifications that you require.