Post by SXGuy » Wed Feb 10, 2010 7:12 am

Im currently looking for a module that can change the template being shown on the front end, either the whole template or just the colour themes, has this already been done?

If not, could any one be so kind as to hint to the correct location where i can do a little mod to bring the theme selection fron the back end to the front.

Im looking to mod versions 1.3.2 and 1.4.0 but 1 or the other is all i require to get an understanding of how its done :)

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by iloveopencart » Wed Feb 10, 2010 2:44 pm

I don't think anyone has released a module for this. I know JNeuhoff was working on something a while back: http://forum.opencart.com/viewtopic.php ... her#p20124

User avatar
Global Moderator

Posts

Joined
Thu Mar 05, 2009 11:15 pm
Location - Phoenix, AZ

Post by fido-x » Wed Feb 10, 2010 2:55 pm

I did a front-end template switcher way back for 0.7.9 (still available on my site -- http://www.fido-x.net/index.php?route=p ... duct_id=14). I did update it for my own use for version 1.3.2 (see http://demostore.fido-x.net). I suppose it could be updated for 1.4.0.

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by SXGuy » Wed Feb 10, 2010 3:50 pm

Thanks for your comments guys, much apreciated. Will take a look, cheers.

EDIT: ok i moved everything to the correct folders for the relivent opencart versions.

Followed the instructions to set it up in the backend, thats all fine.

Followed the instructions to add the module to the layout.tpl's

I now get this error

"Fatal error: Class 'Controllermodulemodulecatalogselecta' not found in /home/www/moonlite-solutions.co.uk/cart/132/system/engine/front.php on line 39"

Any ideas?

I have double checked that every file is in place, and double checked they are all in the correct folders, so im abit stumped

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by Qphoria » Wed Feb 10, 2010 9:04 pm

I was also inspired a while back and never got around to it. I have it working now tho. I can release it today (freebie)

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by SXGuy » Thu Feb 11, 2010 2:21 am

Qphoria wrote:I was also inspired a while back and never got around to it. I have it working now tho. I can release it today (freebie)
That would be very good of you if you could!

I realise what the error is now, it seems because the files were written for a pre 1.3.2 release some of the locations it searches for are different.

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by SXGuy » Thu Feb 11, 2010 7:50 am

Works perfectly!

One thing i noticed though, the visible template name on the front end module doesnt always reflect the template being shown initially.

For example, say you have default template set in the backend, but you have a few other templates that are called something which begins with a letter lower than D (for default), when you load the front end, default template is loaded but the first option in the drop down list could be another template.

But apart from all that, thank you very much :)

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by Qphoria » Thu Feb 11, 2010 8:52 pm

hmm i'll try the naming thing. It should be using the exact name as that is what I match on. I try with more D names

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by SXGuy » Fri Feb 12, 2010 1:03 am

Hope i made sense in my previous post.

What i was refering to was that the theme switcher drop down tab's first option should reflect the default template set in the backend, otherwise people may confuse the current theme with the one being listed in the drop down.

One easy work around would be to set a default template in the backend of the cart which has a folder name that begins first alphabetically out of the list of templates.

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by Qphoria » Fri Feb 12, 2010 1:15 am

oh ok.. i see what you mean.. but I don't see how it matters. As long as it shows the current theme who cares where it is?

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by SXGuy » Fri Feb 12, 2010 4:59 am

but it wouldnt be showing the current theme?

Take this example, two themes, one called Default, another called Brown.

Default is the theme marked as the default template in the backend.

When you load the frontend page, the theme will be default, but the theme displayed on the drop down tab is Brown.

Maybe im nit picking, just thought some people may get confused with theme names if for example you use the drop down to show off different themes you are perhaps selling.

EDIT: obviously once you navigate away from the first instance then the drop down will match the current theme, its only an initial problem.

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by Qphoria » Fri Feb 12, 2010 6:33 am

SXGuy wrote: Maybe im nit picking, just thought some people may get confused with theme names if for example you use the drop down to show off different themes you are perhaps selling.
But that isn't what happens. Look at my demo. I have "default" set as my default theme. And on the catalog site, it shows "Default" which is the second option. I don't know how you are getting it to show the wrong template in the dropdown. The code will select the "current" theme for the dropdown.

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by pstreet » Fri Feb 12, 2010 7:11 am

Q's right, it should be showing your current selected theme. So you've got something odd going on (made any changes in that section of code recently?).

Currently unavailable for freelance work and consulting.


User avatar
New member

Posts

Joined
Tue Nov 03, 2009 2:00 pm
Location - New South Wales, Australia

Post by SXGuy » Fri Feb 12, 2010 7:17 am

my apologies then, perhaps i modified a file somewhere without realising.

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by SXGuy » Wed Feb 17, 2010 7:58 am

Slight mod to the theme_switcher.tpl file if anyone is interested.

What i have done is re-wrote it, so it previews a little thumbnail of each template in the module position using the drop down, and added a button to switch to the selected template.

makes it looks abit nicer i think.

All you have to do, is make sure your template folder names are all lower case

Thumbnail previews should all be called "ss.png" and should be placed in each template_name/image folder.

ex. Catalog/view/theme/theme_name/image/ss.png

Edit line 24 to include your own website url

You can take a look at the example here -> http://www.moonlite-solutions.co.uk/cart/132

Should anyone wish to tidy up my code, please feel free, i would be very greatful, as im not the best scripter in the world (quite novice)

Anyway here is the file, obviously, please make a backup of your old file just incase.

Attachments

theme_switcher.tpl (modified)


Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am
Who is online

Users browsing this forum: No registered users and 15 guests