Customizing OpenCart - How should it be done? - opencart

I'm developing an OpenCart shop using OC 2.1 and I'm struggling to understand what is the best solution for creating custom changes on controller level.
Here's a simplified example to show you what I'm wondering about:
I'd like to modify my header. The graphic design I'm implementing uses different writing for My account link depending on if the user is already logged in or not. This is of course a very simple thing to change, so here are my ideas:
I could just edit my new template's header.tpl file to use:
<?php echo $logged ? $text_account_signed : $text_account; ?>
That requires a change in a language file and that file is outside of the template folder. I'll leave the language issue out for this example to make it less complicated.
But to create a solution that is more MVC I should make that change in the catalog/controller/header.php file, shouldn't I? Unfortunately that file is outside of the template folder so in case of an update, the change will be lost or would require fixing by hand.
I could however create an extension with an extension.ocmod.xml file that would make a change in the controller header.php file and it would be safer (not sure if 100% sage though) for future updates. But the amount of extensions and/or the complexity of creating them would greatly impact my project time, I suppose. And that makes me tempted to just edit the source code of OpenCart and make my future self worry about it later. But I care about this guy and I'm sure he'd hate me for that at some point.
So, my real question is: Is there a way of creating OpenCart modifications on controller level that would not break future updates?

Regarding modifying existing Controller, Models, Languages yes you either need to use vQmod or OCMOD and for template yes you can create your own template according to need. there is no other option.
If you are using vQmod or OCMOD then you don't have to worry about updates because there is less chances of issue (issue may occur only in major updates).
For vQmod there are other easy tools like vQgen and vQmanager available
For Opencart Overall general info

Related

Template with TYPO3 v10

I would like to do a project with TYPO3 v10 I'm new with this CMS and I need to create different templates for different pages but I don't understand which code I need to change.
I already install a sitepackage from this site https://www.sitepackagebuilder.com/
It work well but I need to create my own templates and I want to edit the content of my templates in the back end administration like in the picture.
I hope I'm clear
thanks for help :)
I am not sure if there is a misconception in the question or if I have interpreted incorrectly. In any case, I hope this helps:
It is important to differentiate between content + template in TYPO3:
content
In the screenshot posted in the question, you see the TYPO3 backend, which is a view for editing content, administration etc. There you see the page module is opened in the left column (1), you see the page tree in the middle column (2) and the page layout for editing content on the selected page in the right column (3). Here, you can insert and edit the content, that will be displayed on a page.
Template
In TYPO3, the template is what makes up the automatically generated parts of the page such as header, footer, menu, breadcrumb etc.
It work well but I need to create my own templates and I want to edit the content of my templates in the back end administration like in the picture.
Editing the template in the backend with a Wysiwyg ("what you see is what you get") editor, similarly to editing the content is not really possible in TYPO3 AFAIK - at least not out of the box. For this, you would need a template builder. The only thing I have seen so far that comes close to this is toujou (I am not affiliated with them, just wanted to mention it). They have something which you could call a website builder. But AFAIK, you can't download it, they provide this as a service.
The sitepackage builder - as far as I know - pretty much just creates a sitepackage based on the bootstrap package extension which you would have to further modify by editing the files.
What you can also do is edit the TypoScript in the backend. Just go to the "Template" module in the left column. But, this made more sense in the past, because a lot more was done with TypoScript. Nowadays, you usually use a combination of Fluid and TypoScript and you can't edit the Fluid files in the backend.
While in the past, a lot more was done in the backend or could be done in the backend, everything is moving towards maintaining changes in files and extensions, where the template is maintained in a sitepackage. For some things both is still possible (backend and extension), e.g. backend layouts, TypoScript etc.
Moving the configuration + templates from the backend (and storing them in the database or as files) to a dedicated extension has several advantages:
Every configuration etc. is bundled into one extension, this makes it easier to install in another site, on a testsystem, exchange it etc.
the sitepackage can be put in a version control system (e.g. git) which has a bunch of other advantages such as easy rollback to a previous version, referencing issues etc.
The downside is that you need more technical expertise and there is a learning curve.
see also:
The Anatomy of Sitepackages
Sitepackage Tutorial
I understand that it might be pretty cool to assemble a template in the backend - just like you can do with the content. Maybe someone else knows how to do that with TYPO3.
You can also check out these resources which seem to go in the direction of what you are looking for:
TYPO3 extension mask (documentation)
T3terminal
in the official documentation you can find the structure of folders where the files for your layout are stored.
More details on fluid templating in this document
Now you want a possibility for editors to select between different page layouts. An often used way is to use the possibility to select different backend layouts and select a frontend layout accordingly.
This is shown in the video on this page or in the documents you can find if you uses the searches on that page.

scroll websites with django

I'm currently working on a simple scroll website with nothing really difficult (I could almost use plain html/css/javascript but it's a bit of practicing and I will maybe add a blog). And as it is simple I was wondering how to do it properly with Django.
So here is my question, I have a homepage template that is actually the website and I don't really get how I split my different part in different apps.
For exemple I have a contact form, do I need to split it in another app and then include it in the basic template ? I want to add a galery with image in a database, do I create an app for that ?
And the other question that goes along is how do I code an app that is not returning httpresponse but just html to put it in another template and do I still need views ? I would like to do a bit like a standard form in django where you do :
form.as_p or form.as_table
so maybe:
galery.as_slideshow
So my questions are quite novice and open but someone could give me some reading to get going, I would be really happy !
This is a question a lot of people struggle with and it seems like there are a lot of varying opinions out there.
I've found that the best way to really determine the appropriate answer for each case is to really distill the feature into individual requirements and group them by feature sets while keeping an eye out for additional uses outside of the project actively being worked on.
There is nothing which says you can't build your project to include a single app containing all of the modules you would need. Doing so seems like it would make your development easier initially right? So, the question to ask then is "What if I want to reuse (insert feature set here) in another unrelated project a year from now after I've already forgotten about the weird stuff I did to make it work originally?". Asking yourself that question forces you to think about your features in a much broader context and I think 99% of the time you will realize that a "Contact Form" requirement can actually become quite complex and really should be split up into at least one separate app (i.e. User Creation, Profile Management, Email Subscription, etc...)
Here is a link to a video about this very topic which I found to be useful in figuring out my way through this question:
https://www.youtube.com/watch?v=A-S0tqpPga4
I know this is not really a hard-line answer to your question but I hope it helps point you in the right direction.

Beginning Joomla Development - Templates and Modules?

I am planning to begin my Joomla development adventures, so I have been digging up some resources on Joomla beginner such as:
Joomla 2.5 Beginner Guide
I think I have grasped the fundamental concept, though I have a doubt that if anyone doesn't mind clearing up for me.
If I have my own template ( I am planning to use my own Twitter Bootstrap template ), and I am planning to convert it to Joomla, and inside that template there are already samples for some modules such as front page slider, testimonials, partner links, etc, from what I understood these have to go as modules, since Joomla allows one component, and many modules in a page (hence a index page might have Welcome message as component, and sliding banner, testimonials as modules).
So my question is do I have to write these testimonials, page slider modules on my own? Since I already have the samples (css and html) and I know how they will be positioned. Wouldn't it be a bit of overkill to write modules for each? What if at later stage I am making another website, and I have another template?
Also, from examples I have seen, Joomla template have only one html template (index.php) which defines all the positions. If I want to define two possible layout for one template, is that possible? Or it has to go in different templates, and I assign them separately in my Template Manager.
Ok firstly, as for the Joomla version, you have 2 choices.
Joomla 2.5 as it's the recommended long term version.
Joomla 3.0, the new short term release which is completely based on Bootstrap, therefore it might be easier to adapt it to make it look like your template.
usually I would recommend Joomla 2.5 but in your case I think Joomla 3.0 might be the best way to go.
As for the modules, you don't necessarily have to write them yourself. You can download all these sort of things from the Joomla Extensions Directory. If you are worried about positioning of modules, then simply ensure that the template has the module positions in the correct place. Using the Joomla 3.0 template and adapting it to look like your template will be much easier when it comes to modules, as it already has a lot or pre-defined positions. If you feel the need to add more, you can do so. See links below:
Adding you own module positions in Joomla 1.5/2.5
Adding you own module positions in Joomla 3.0
I hope this helps you a little bit on your Joomla adventure and good luck.
Almost forgot, please also make sure you keep your Joomla version up to date unlike a lot of the people that post questions on here :) I posted an answer as to why it's important here
You absolutely right about Joomla allowing 1 component and many modules! Your also fine to convert your template into a Joomla template. Although note as Joomla 3.0 uses bootstrap (but is still very new and having many new features added to it - even though its technically stable) and thus it might be easier for you to use that. You can easily include bootstrap etc through that framework as well. Link here for how to do that
See the link here about module and module positions in templates. Whilst the numbers at the top say this is for 1.0,1.5 and 2.5. The bit under the 2.5 header also applies to Joomla 3.0!
In terms of different layouts for the template generally its good practice to have two separate templates if the layout changes are significant. However if the layouts differences are small, there is nothing wrong with adding in a Form Field and creating two template styles in the backend and just choosing the layout with a form field for each style!
If you want to use your customized modules I'm afraid yes you do have to do this. However there are module and component writers out there which can make the basics up for you so you can almost copy and paste your code straight into one file (with a few changes here and there). You can also use the Joomla Extension directory though - you may even find something you like more!
In terms of using the modules/components on another site this is actually much easier. Once created you can just go into the Joomla backend and install your extension again and tweak it how you want after that with either FormFields or in template overrides!
Any more questions feel free to ask!

Better Templating for Grails

For all the things I love about Grails I do have one small issue and this isn't really even a Grails specific problem. GSP changes require redeployments of the entire web application. I'm not talking about adding new dynamic data or major changes. These generally requires server side changes as well anyway.
But I'm talking about smaller changes like flipping the position of a couple of elements or modifying some simple static text on the page. So my question is, what are some patterns used or plugins, etc that allow minor changes to GSP's without redeploying the entire application? How can I make Grails template/GSP's more like templates and less requiring compiling?
I'm also possibly looking for something more designer friendly.
grails.gsp.view.dir, I think.
A trick to remember: add trailing slash and remember that grails-app/views will be added to it.
There is a Grails Plugin for using FreeMarker templates as views (I have not used this plugin myself). It is not listed as SpringSource supported, but I think the author is one the core grails devs and the plugin is based on a relatively new version of FreeMarker.

Module overriding in Joomla 1.6

I am new to Joomla, started learning it just a day ago and didn't manage to find an answer to my question in the docs (which suck real bad compared to Drupal).
So what I want to do is override the whole module in a template. The documentation only suggests I can override the markup of a module by placing corresponding files in the html folder, but I have to make some corrections to the actual logic. Is copying the module, changing and then installing it as a separate entity the only way to go? I mean it makes sense that "template" folder is for "views" but with the kind of application I have to develop it is gonna be annoying...
Yeah, you can only override views.
If you want to override logic, you have 2 options:
Change the actual logic in-place, which leads to problems on updating etc
Duplicate the module and change the logic, as you suggested
One other way to consider is to replicate or fix the logic in the template. While this is not a very slick way of doing it, it is faster, especially than duplicating a whole component.
Note that you can also add your own libraries to the Joomla libraries folder to centralize your own code.
Further, if you manage your code with (for example) svn, you should not have any problems on upgrades with creating new views that may include their own logic.