I am going to be utilizing magento for a B2B order management. There are a couple changes I need, and I would appreciate some direction on .
1) The site should not be browsable unless you are logged in. What I would like to do is have every page (including homepage) display the ‘login’ screen if they are not logged in. I have looked at “Mage::getSingleton(’customer/session’)->isLoggedIn()” but don’t know where to place it.
2) I need to remove payment processing from checkout. Basically, I need to remove the “Shipping” and “Payment” steps of the checkout process.
Any help, hints, suggestions will be GREATLY appreciated, as I’m still trying to figure out how this framework works.
Ok, so I still would like some input on this. I found a way to get it working, but it isn’t very pretty, and i’m pretty certain there is a better way. The following is what the try block of the ‘run’ function in mage.php contains:
It works, but I don’t like that I have to have hard-coded the path to the login page (/ordernet/customer/account/login). Is there any way to get the install directory of magento, so I can do something like $installDir . ‘/customer/account/login/’ ??
Any other comments about this setup would be much appreciated
...and this is why I think there has got to be a better way. The code is getting more and more ugly, as I am finding new URL’s that need special cases.
1. Posting the login form goes to a separate url
2. Admin login page shouldn’t require you to be logged in as member
3. all admin pages are under ‘index.php/admin’ instead of just ‘/admin’ like the login page.
Adding these values introduced a small security threat. Under this scenario it is possible to see the site using a querystring variable which contains a white-listed admin url. (For example, appending ‘?/ordernet/admin’ to any page). So now I need to perform additional checks on the url (perhaps removing the querystring before the strpos check, or checking that the result of strpos is zero [so the substring is at the beginning])
Wow, thanks for the above code. I’ve implemented this in my application and it does seem to work, although it is a bit sloppy as you mention in your post.
One thing I do not like about this is that it requires the editing of a core file (Mage.php). Is there any way to check if a customer is logged in directly in the index.php file?
For my application, I am building two storefronts, one for retail and one for wholesale. I’ve created a second store with a code of “wholesale” so I modified your above code snippets by putting an if ($code == ‘wholesale’) around your code and leaving the original code in for the else statement (corresponding to my if). This way anyone can use the retail store but you must login to see the wholesale store.
If something similar to this could be done in the index.php to check for a login that would be a much smoother solution so as to not edit core files. Any ideas?
I am a Magento user with Zero experience in PHP or any other code language. and i have read in this post that is possible to hide the Price on storefront, or make the users to loggin the site before they are able to see the products and the information associated with that product.
My business its B2B and its extremely important that the prices doesn’t appear on guest users. Theres anyone that can help me doing that. I have the lastest version of Magento with the default theme.
I think that it is possible to hide the price by changing the theme, or changing the code in a php file in the theme. I know that isn’t the best solution for security purposes but for me thats enough.
thanks for you help and support. Lets enlarge the magento comunity rapidly.
@alistek,
1) thats only price block, not the content.
2) now that magento is 1.X you dont want to be fooling with the Mage Core.(Template Files / Layout files)
He should be altering the Template Files to check to see if the user isloggedin.
JpSP unfortunately, its going to take some time to get what you want accomplished.
One possibility would be to override the core/url_rewrite model, extend Mage_Core_Model_Rewrite and put your code in the overridden rewrite() method. Hackish, but might work. Would be better if Magento had a pair of events surrounding routing.