JazZ7 Posted April 1, 2016 Share Posted April 1, 2016 Hello, I'm working on a prestashop module to set the catalog mode ON or OFF if user is unlogged or logged. Works great but got a problem. I don't want unlogged users see prices at all but with this solution, when unlogged user load the page, the catalog mod turn ON, but he can see prices (has to reload to hide prices) So, first load set catalog mode ON and second load display real catalog mode. I found a js script to reload automatically the page to take effect with the new mode but obviously, loading time of the page is two times longer. Here is the function : public function hookHeader() { $logged = $this->context->customer->isLogged(); if (!$logged) { Configuration::updateValue('PS_CATALOG_MODE', true); } else { Configuration::updateValue('PS_CATALOG_MODE', false); } // reload the page once more echo ' <script type="text/javascript"> (function() { if( window.localStorage ) { if( !localStorage.getItem( "firstLoad" ) ) { localStorage[ "firstLoad" ] = true; window.location.reload(); } else { localStorage.removeItem( "firstLoad" ); } } })(); </script> '; } Hope somebody could help me with this. Thank you. Link to comment Share on other sites More sharing options...
El Patron Posted April 1, 2016 Share Posted April 1, 2016 have you considered just not showing prices to 'visitors'? this can be accomplished back office-->customers-->groups-->edit visitor-->set hid prices enabled Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now