Currently i am working on a ecommerce project in php.
I face a problem.
I want to restrict users from accessing add cart page before login.
so if the users is not logged in when user clicked on add to cart , he will redirect to login page.
Here the problem comes. after login i want users to redirect to cart page. not the dashboard page. and if he login from default way[means not from cart page] he will go to dashboard.
so how can i redirect users to cart page when he entered login page from cart page and also if he is not accessing login page from cart page he will go to dashboard.