[SOLVED] OC3x Template chooser for core modules.
Posted: Sun Nov 12, 2017 12:20 am
I'm new here so Hello World!
I'm using OpenCart for a few months now and it is great, but I miss one feature which is the ability to chose a template for a module.
I'm not sure if I use right world but in extensions, there are "modules" which you can "clone" Banner, Best sellers, Carousel, Featured, Html Content, Slideshow, Special. Apart from those, there is one called Category which you cannot "clone".
I'm able to add functionality for those you can clone where there is a template selector.
The plan:
1. Add modifications to admin controllers and forms - template setting + chooser(I'm not sure if it will be select or just plain text field for tpl name)
2. Add dirs in ...theme/default/template/extension/module/ ie theme/default/template/extension/module/banner/(banner templates)
3. Add modification to front-end controllers so if there is a template set in module settings and it exists load template or fallback to default.
I have done tests and it does work.
The problems are:
1. Categories are not cloneable.
2. The preferred way to achieve it.
So Ad 1. I can either modify category module to be "cloneable" - but I do not know how it will behave for already assigned layout-cat module or I can add new Category module where there is already everything in place.
Ad 2 I can modify current modules or create a duplicate for each module like categories(this is worst idea I think) or create one module which will cover all of those.
Reason for all of this is because I need a separate template for modules on home page and probably in other parts as well.
Any ideas?
I'm using OpenCart for a few months now and it is great, but I miss one feature which is the ability to chose a template for a module.
I'm not sure if I use right world but in extensions, there are "modules" which you can "clone" Banner, Best sellers, Carousel, Featured, Html Content, Slideshow, Special. Apart from those, there is one called Category which you cannot "clone".
I'm able to add functionality for those you can clone where there is a template selector.
The plan:
1. Add modifications to admin controllers and forms - template setting + chooser(I'm not sure if it will be select or just plain text field for tpl name)
2. Add dirs in ...theme/default/template/extension/module/ ie theme/default/template/extension/module/banner/(banner templates)
3. Add modification to front-end controllers so if there is a template set in module settings and it exists load template or fallback to default.
I have done tests and it does work.
The problems are:
1. Categories are not cloneable.
2. The preferred way to achieve it.
So Ad 1. I can either modify category module to be "cloneable" - but I do not know how it will behave for already assigned layout-cat module or I can add new Category module where there is already everything in place.
Ad 2 I can modify current modules or create a duplicate for each module like categories(this is worst idea I think) or create one module which will cover all of those.
Reason for all of this is because I need a separate template for modules on home page and probably in other parts as well.
Any ideas?