candypalace Merchant Van United Kingdom Lid sinds apr. 2023 candypalace 5 okt. 2023 11:24 I am working on a new front end template but I was wondering if there was a setting somewhere so only the admin could see the new template on the front end.
dodo Moderator Van Lithuania Lid sinds mrt. 2016 dodo 5 okt. 2023 11:59 No, you can only turn shop into development mode. One way of doing this is to create a development environment while you work on the template and only transfer when it's done. This addon is extremely good: [url=https://www.litecart.net/en/addons/33/develop-and-deploy]https://www.litecart.net/en/addons/33/develop-and-deploy[/url] It allows not only template, but any kind of modifications to be done in dev shop and then transferred in a single click. Another way is to make template on your local computer and then transfer when it's done.
tim Founder Van Sweden Lid sinds mei 2013 tim 5 okt. 2023 13:50 You could produce an if condition. document::$template = 'new.catalog'; }``` But for these reasons it's better to set up a development platform where you can experiment freely. 1. Setup a new domain dev.domain.com 2. Copy the production database to a new database. 3. Copy all the files to the dev domain. 4. Adjust some configs https://wiki.litecart.net/how_to_move_the_platform 5. Go to Admin -> Settings -> Listing and enable Development Mode 6. Don't underestimate the power of this addon. https://www.litecart.net/en/addons/33/develop-and-deploy
candypalace Merchant Van United Kingdom Lid sinds apr. 2023 candypalace 5 okt. 2023 17:56 Thanks for the replies guys. I’ll take your advice and setup a development site. Cheers
candypalace Merchant Van United Kingdom Lid sinds apr. 2023 candypalace 6 okt. 2023 00:51 Hi Tim I have setup a development site to work on my template but I would also like to explore your previous suggestion: You could produce an if condition. if (!empty(user::$data['id'])) { document::$template = 'new.catalog'; } Could you please tell me which file I would put this code. Thanks
candypalace Merchant Van United Kingdom Lid sinds apr. 2023 candypalace 6 okt. 2023 01:09 Actually I have just put that code at the top of index.php and it works a charm when I sign in to the admin backend then browse to the front end the new template appears. I then browsed to the site from other devices and the old original appears. perfect. Thank you Tim. I put your code under: require_once('includes/app_header.inc.php'); if (!empty(user::$data['id'])) { document::$template = 'pos.catalog'; }
tim Founder Van Sweden Lid sinds mei 2013 tim 6 okt. 2023 01:33 Indeed the code works from anywhere :)
candypalace Merchant Van United Kingdom Lid sinds apr. 2023 candypalace 6 okt. 2023 14:30 If anyone try's to use Tim's suggestion of using: if (!empty(user::$data['id'])) { document::$template = 'pos.catalog'; } I found that I needed to clear the cache in litecart settings because the new template didn't load the css. I've got no idea why, probably something simple i overlooked or maybe because i placed the code in index.php. But clearing the cache solved the problem.
candypalace Merchant Van United Kingdom Lid sinds apr. 2023 candypalace 9 okt. 2023 14:20 Hi Tim. Sorry if this is a silly question (I'm Learning). but I would like to try and understand your code better. document::$template = 'new.catalog'; } Am I right in saying this code snippet should work for the admin only or any logged in user?
tim Founder Van Sweden Lid sinds mei 2013 tim 9 okt. 2023 18:18 The user node holds the backend user ID if the user is logged in. So by producing this condition checking if it's not empty you are making sure the backend user is logged in or not. document::$template holds the setting of the current template. To do the same for customers it's the following: if (!empty(customer::$data['id']) {