registration/login on checkout and on website - authentication

I'm creating a webshop.
On index.php, I have a link that goes to registration and loginform.
When I add a product to my shopping cart, I check if the user is already logged in. If not, the user has to register.
How can I use the same registration form, and check if the user comes from the page shopping cart, or from the index (or another page)?

You can use cookies for that. You need to store cookies and then restore it when login page is revisited.

Related

Manually approving the account in shopify after registration

Whenever the user register on my Shopify website i want that account to be disabled until admin enable it from back-end panel. Currently when user is registered, his account is enabled by default.
Have searched various forums even tried Shopify support but still no luck.
There are two options. why you are not putting "request membership" sign up form instead of sign in form (disable from here)? You could use the contact page for that if you wanted. Then you get an email when they fill that out. You would create the account (just copy and paste the info) and email them an invitation. They click the link in the invite to make the password. (I think it will be a tedious task for you)
Otherwise, let them create the account, but hide the pages with the Locksmith app. Then after you approve them you would apply a "tag" to the customer account so they can see the pages and products locked with Locksmith.

Make user stay on product view after clicking on "Add to Cart"

I'm using Hotcakes Commerce DNN modules and I'd like to know how I can allow the user to stay on the product page after the "Add to Cart" button is clicked. The default behaviour is to redirect the user to the cart page whenever the a product is added to the cart.
The easiest way to make this happen is to modify your viewset to change how the add to cart buttons work. Here's a summary of the required steps:
Add and begin modifying your viewset if you haven't started already.
Modify your \VIEWSETNAME\Views\Products_ProductDetails.cshtml file to change the add to cart action from a post, to an AJAX link. This will allow you to add products to cart directly using a link, but keep you on the page.
If you're using the Mini Cart, refresh the page using JS so that it updates appropriately.
Please note that this option won't work well if your products have choices. If this is the case, you should instead allow your customers to be directed to the cart page, and use a parameter there to determine whether or not you redirect back to the product page.

Prestashop logout user programmatically

I am developing a module in Prestashop. I want to know how to logout user programmatically, and how can I redirect a user to custom url?
You can use
$customer->logout();
Or
$customer->mylogout();
The first one is a complete logout, the second one will leave affiliate information in customer's cookies.
Both methods fire actionCustomerLogoutBefore and actionCustomerLogoutAfter hooks, so you can attach to them for your redirect.
Speaking of redirect - it depends on what page you want to redirect your customers to, if it's an internal page, you can use either:
$redirect_link = Context::getContext()->link->getPageLink(...); // or "getModuleLink", etc., see classes/Link.php for details.
Or
$redirect_link = $this->context->link->getPageLink(...);
You would then use either redirect, redirectLink or redirectAdmin (probably the other two, as redirectAdmin only makes sense if you're in Back Office) of Tools class to redirect to that link.

Plone make login mandatory on every page but main page

A customer wants to have its Plone site behave like this:
the main page can be seen by anonymous users
you have to be registered and authenticated to see any other page
the site is open for registration, so the forms to authenticate and register should also be made visible by anonymous
How one can approach this?
Is there a way to hook a python script/class/method/function to any request made by the user? Overriding the main_template.pt and adding a TAL call to a method that does these checks would be enough?
The tricky part is that even if the anonymous can only visit the main page, the main page in itself is made up of other content types which should be only viewed by authenticated users (by their restrictions, not because of workflow).
I ruled out, maybe a mistake?, workflow because then everything should be made private but still the global_nav is made out of folders which, if the workflow approach was taken, should be private/non-viewable by anonymous.
Cheers,
Try this:
add a state internally published to your workflow
copy permissions configuration from the "public" state into the new state and than remove the "View" permission from the Anonymous User (maintain the 'Access content information', that's the key). Then add all needed transitions.
put your home page in "public" state
put everything else in 'internally published' state
This should work because if you link content's information in the homepage, this will work, but if someone try to access a content he will miss the "view" permission and will be redirected to the login.

Joomla mod_login vs com_user

I'm having a very weird issue with user logins.
I'm building a site where all the content/menus are only available after you login.
I made a 'login' through the Modules and assign it the "userlogin" position.
Now when I go to the home page or any page, the login box comes up, but there's also a second login form. It seems to be coming from com_user.
This com_user login form doesn't work. I can't login using any credentials. If it was working I can simply remove my login module.
Is there a way I can either:
get com_user to work with normal user logins
or
disable this and so I can only see the Module login.
I can hide it from CSS, but I want to know where it's coming from.
Check the menu link which you have created should be public.
If these are not public then whenever user clicks it, he/she will be asked for login. Thats why the second login option is coming up.