JNeuhoff wrote:Not quite a factory class yet. For instance, in index.php you still create the class instances directly:
Or the controller files are instantiated like this in your system/engine/front.php:Code: Select all
.... // Length $registry->set('length', new Length($registry)); // Cart $registry->set('cart', new Cart($registry)); ....
With a real factory class, the factory might also instantiate possible extended classes, where the extended class might have overridden methods to modify some of the core class behavior.Code: Select all
require_once($action->getFile()); $class = $action->getClass(); $controller = new $class($this->registry);
For example, we use this in the Override Engine for library classes:
And this for controller classes instantiated in the system/engine/front.php:Code: Select all
// Factory $factory = new Factory($registry); $registry->set( 'factory', $factory ); .... // Length $registry->set('length', $factory->newLength($registry)); // Cart $registry->set('cart', $factory->newCart($registry)); ....
We leave the business of loading the class file to the factory class. The factory may load the original class file, or a modified original class file (modified e.g. by your new VQmod-style modification class), or another file containing an extended class, in addition to the original class file. Using a factory class is more flexible than PHP's __autoload mechanism, because you can also load and instantiate extended classes from whatever is found from an additional override folder.Code: Select all
$file = $action->getFile(); $class = $action->getClass(); $controller = $this->factory->newController( $file, $class );
P.S.: I just noticed you have started adding some useful new methods to your system/engine/loader.php, such as
public function controller($route, $args = array())
public function model($model)
public function view($template, $data = array())
public function library($library)
public function helper($helper)
public function database
If you were to always use this new Loader class to instantiate all the other classes, then this could easily become the new core factory class with similar functionality! In fact, I could then easily port our Override Engine to using your updated Loader class. For example, a controller class could then be instantiated like this:
Code: Select all
$this->data['header'] = $this->load->controller( 'common/header', array($this->registry) );
I'm reffering to the load class being a factory class.
$this->load->model('test/test');
just because you create a factory class does not mean you use it for everything! its simpler to intiate a class the standard way instead of doing it cover some OOP design pattern for the sake of it.
OpenCart®
Project Owner & Developer.
1. is to add everything into the load class. currently like the loader class in the opencart dev github is now.
2. to use autoloader function. initiate all classes on the fly and set the system up ready for when php 1.5.3+ is used by more hosting company's so we can use $class = new model/account/Class($this->registry);
OpenCart®
Project Owner & Developer.
We have done loads of websites, so have hundreds of other Opencart users, using the Override Engine which is based upon the usage of a factory class. And I can say from experience there are hardly any performance penalties, but the benefits of using a factory class are significant, such as the possible instantiation of extended core classes with overridden methods.
Hence, about the 2 possible routes Opencart can go ( 1. Usage of Loader class, or 2. PHP autoloader), I think the usage of a Loader class (in a role of a factory) is more useful and futureproof.
Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig
The look on the new template is quite good in my opinion.
will345 wrote:anna_raiders wrote:If you add blog module as seen in your opencart website it will help lot of users.
I also second this about adding a blog module similar to whats on this site would be great and i also think a lot of users will appreciate this.
And why do we "need" a blog module?
OpenCart is not PrestaShop (as in: bloated with modules 90% never will use)!
If you want a blog-module then buy one.
Plus I have no clue why you want to ask for this in a topic about a theme?
Norman in 't Veldt
Moderator OpenCart Forums
_________________ READ and Search BEFORE POSTING _________________
Our FREE search: Find your answer FAST!.
[How to] BTW + Verzend + betaal setup.
The front end has Wishlist and Compare buttons more built into the interface. I don't use Wishlist or Compare as they don't apply to my site. Will there be settings for Wishlist (Enable/Disable), Compare (Enable/Disable), etc?
Otherwise this is going to suck for all the people who don't use those feature.
I'd prefer that just about every feature be togglable since everyone wants and doesn't want different features.
This is about an theme, not about OpenCart 2,0!kelemvor wrote:Are you making features toggleable so people don't have to modify the code just to turn off a certain feature?
The front end has Wishlist and Compare buttons more built into the interface. I don't use Wishlist or Compare as they don't apply to my site. Will there be settings for Wishlist (Enable/Disable), Compare (Enable/Disable), etc?
Otherwise this is going to suck for all the people who don't use those feature.
I'd prefer that just about every feature be togglable since everyone wants and doesn't want different features.
Norman in 't Veldt
Moderator OpenCart Forums
_________________ READ and Search BEFORE POSTING _________________
Our FREE search: Find your answer FAST!.
[How to] BTW + Verzend + betaal setup.
Is there any way to get this theme (i mean download it)?
I would really appreciate this...
this is template for 2.0 version, how could you use it with old one? it will be available to download when 2.0 will be released, and as i think, it will be in a few monthesGendelVova wrote:Hello everyone!
Is there any way to get this theme (i mean download it)?
I would really appreciate this...
versu wrote:this is template for 2.0 version, how could you use it with old one? it will be available to download when 2.0 will be released, and as i think, it will be in a few monthesGendelVova wrote:Hello everyone!
Is there any way to get this theme (i mean download it)?
I would really appreciate this...
No it won't, It's a complete new template based on bootstrap so it's not compatible with the previous OC versions. However, if you know how to code/ design templates for OC, you could adapt it; In fact, someone here in the forums already did that.
Regards,
Marvin
You want to thank me for my time! Click here to donate
And Yes, i can understand code of others and try to adapt it to 1.5.x
PS: can you send me a link to that theme, if you remember, please!
Regards,
Marvin M
pprmkr wrote:Realy like this theme and layout.
And I was asking me the same question, so I downloaded the version2 files and started testing.
- Quite a lot of changes, missing indexes and so on.
- All installed modules had to be adjusted
- New common.js. ( attr is replaced by prop )
- colorbox replaced
But: it works so far ... demo 1.5.4.1
You want to thank me for my time! Click here to donate
thanks
Ingat Gadget, Ingat DroidLime https://www.droidlime.com/
the new opencart 2.0 template is fantastic
just feel the display on mobile devices could be bit more simpler and cleaner
as in maybe the header tab is hard to see when reduced so smaller
(wordpress do header image nicely on mobile by responsively taking a percentage of image)
the info in the footer is a lot to scroll thru...maybe drop down menus could be used in mobile display
the other small detail is the drop down menu for categories on mobile is a bit unclear for a lot of mainstream users
maybe a downward pointing triangle would be clearer
cheers david
It uses most of Bootstrap 3's styling and features, still got a few to add but overall its fairly bootstrapped up.
I see now on github that OC v2 theme will be using Bootstrap 3 too, so thats awesome. Good dev base.
OpenCart Theme Options - See All My Extensions - OpenCart Themes and Mods
Users browsing this forum: No registered users and 40 guests