Magento - best practices for making modifications to a theme - magento

I'm using Magento 1.9 and have installed a theme made by Trego. What is the best way of making updates to a Trego template while preserving the vendor's source code? Specifically, I need to modify the following template:
/app/design/frontend/default/trego/template/catalog/product/view/options/type/text.phtml
For testing purposes, this is what I've done (following Suman's solution below):
/app/design/frontend/default/trego/template/catalog/product/view/options/type/text.phtml
original file
/app/design/frontend/default/tregonew/template/catalog/product/view/options/type/text.phtml
modified file
In the admin panel, under System => Configuration => Design, I've opened the Package Tab and Themes Tab. Here are my settings:
Current Package Name: rwd
Translations: (blank)
Templates: tregonew
Skin: tregonew
Layout: tregonew
Default: trego
Unfortunately, my system is still rendering "original file" instead of "modified file". What am I missing?
UPDATE:
Please see Suman's answer below. It worked like a charm. A few notes in case somebody else is struggling with this topic:
Make sure you don't have a design change in effect (System => Design) which would override the solution depicted here. Note that the design change I'm referring to is different that selecting packages and themes as instructed in Suman's solution (System => Configuration => Designs). Suman's solution wasn't working for me in the beginning because I had a design change (System => Design) that Magento was overriding the my settings in System => Configuration => Designs.
Specific to Suman's answer below, I think he meant to say that you can make edits to:
"/app/design/frontend/default/tregonew/template/catalog/product/view/options/type/text.phtml"
which will be reflected in the output instead of the file:
"/app/design/frontend/default/trego/template/catalog/product/view/options/type/text.phtml"
as referenced in his answer.
Magento 1.9 has a new theme hierarchy system which uses the theme.xml file to refer to a parent theme. I haven't tried it yet but in case somebody finds it useful, see this article by Alan Storm.

Please follow below steps:
Create a new folder tregonew into the default
/app/design/frontend/default/tregonew
create template and layout folder
/app/design/frontend/default/tregonew/template
/app/design/frontend/default/tregonew/layout
Than copy your modules which you want to modify like
/app/design/frontend/default/trego/template/catalog
to
/app/design/frontend/default/tregonew/template/catalog
also copy the skin files to new folder
/skin/frontend/default/trego
to
/skin/frontend/default/tregonew
Now you can change the below file, it will reflects the output.
/app/design/frontend/default/trego/template/catalog/product/view/options/type/text.phtml
In admin area
system => configuration =>Designs tab on left side
Set your Package => Current Package Name = default
Themes => Templates = tregonew
Themes => Skin (Images / CSS) = tregonew
Themes => Layout = tregonew
Themes => Default = trego

Copy the entire template folder Trego to new Folder Tregonew and modify the theme.

Related

Why is OpenCart 2.3 custom theme not showing?

I've read through some guides and watched a YouTube video on how to create a custom theme for OpenCart. After trying various things it still doesn't seem to be working right.
If I go to 'Extensions > Themes > Edit Store' I can switch the theme directory but this doesn't seem right. The question bubble there says changing the theme directory here is only for legacy support of older themes. Current themes should be available through 'System > Settings > Edit Store > General Tab (Select Theme Dropdown).
Why doesn't this seem to work? The new version is supposed to fall back on the default theme if something isn't available but it can't if I change the theme directory. I've even tried simply copying the whole default folder and renaming it.
Opencart 2.3.0 :
Go to Extestions >> Extestions >> Choose the extension type >> Select Themes >> Edit Your themes >> change default theme. See screenshots:
1 : https://postimg.cc/image/ds02xcmbp/
2 : https://postimg.cc/image/bre4q9fk5/
In file <Your project name>/catalog/controller/event/theme.php
replace row 16 from:
$theme = $this->config->get('config_theme');
to:
$theme = $this->config->get($this->config->get('config_theme') . '_directory');
I know it's bit late to answer but it can be helpful to others.
In OpenCart 2.3.0.2 creating a custom theme is little complex , finally i found this doc here which helped me a lot http://undefined.gr/site/2016/10/09/custom-opencart-2-3-0-2-theme/
To start with copy the default folder found in
upload/catalog/view/theme/default
to a new folder in the same directory. Name it “mytheme“.
Then copy the theme_default.php file in
upload/admin/controller/extension/theme
and place it in same directory. Name it “mytheme.php“.
Rename the class to (line 2):
ControllerExtensionThemeMyTheme
+ Replace all “theme_default” text to “mytheme“. Yes there are a lot (197).
Copy the theme_default.tpl in
upload/admin/view/template/extension/theme
and place it in the same directory. Name it “mytheme.tpl“.
Replace all “theme_default” text to “mytheme“. (48)
Copy theme_default.php in
upload/admin/language/en-gb/extension/theme
and place it in the same directory. Name it “mytheme.php“.
Set the new theme’s title in heading_title (line 3) to “My Theme”.
Finally for the thumnail image to show correctly in store settings rename default.png to mytheme.png in
upload/catalog/view/theme/mytheme/image
Now go into your Administration > Extensions > Extensions and select Themes in “Choose the extension type”. You should be seeing your new theme. Install it with the green (+) button and edit it to enable it. Also ensure you set the correct theme directory whilst editing the theme!
Then in System > Settings edit your store to use your new theme.
That should do it. You can now go ahead and start chopping and changing the default theme

Magento loading base theme instead of downloaded theme

Im trying to install a theme on magento 1.9. Have copied all files into the correct places.
Under System -> Configuration -> Design -> Themes I have set templates, skin, layout and default all to the theme name.
The problem I think i am having is 'Current package name' It was originally set to 'rwd' and when it is set to this it loads the default 1.9 magento theme. However when i change this to 'default' it loads the magento base theme. If i set the package name to the name of the theme it also loads the base package.
Skin Directory Structure
Design Directory Structure
Did you check your custom design? Access: System > Design
just cross check following configuration with your configuration.
Then clear cache and check.

Qooxdoo - how do i create a new theme and use it in the application?

I am quite new to qooxdoo and I need help in creating a custom theme for my application.
I copied the native Modern theme and modified some of its features, now my question is how do I add it as new theme to qooxdoo and how can I use it in my application?
any help or guidance would be greatly appreciated.
You don't need to copy it over, simply extending the theme would be good. If you created your app with the qooxdoo desktop skeleton using the create-application.py helper, you should already have a custom theme in place running and extending the modern theme. If not, you simply have to edit the config.json file which should be in your root project folder and search for a key named QXTHEME. The value of that key is a classname which specifies your theme. Change that to your custom theme class and rebuild the app to see the result.
Here are some further resources on how to work with themes: http://manual.qooxdoo.org/current/pages/desktop/ui_custom_themes.html
To add a bit to Martin's answer: You don't copy and modify theme code, you extend and override, much as with class code.
If you create an application skeleton with create-application.py, the default code structure under source/class already contains custom theme classes (under source/class//theme/*). The thing is those theme classes extend from the Modern theme without actually overriding anything, so you effectively get the Modern look and feel.
But you can then go ahead and flesh out those custom theme classes, with properties that suite your taste, thereby creating your own theme.
i found it very difficult to create a custom theme by extending one of the existing native themes (classic, modern... etc) without looking at the source code, also i don't want to mess up the original API's files by modifying them, so i did the following:
1- replaced files in my application's directory: myapplication/source/class/myapplication/theme/ with the files in /qooxdoo-directory/framework/source/class/qx/theme/modern/. replaced four files in total (Appearance.js, Decoration.js, Color.js and Font.js).
2- copied decoration directory from /qooxdoo-directory/framework/source/resource/qx/decoration/Modern to my application's directory: myapplication/source/recourse/myapplication/decoration.
3- copied icons directory from qooxdoo-directory/framework/source/resource/qx/icon/Tango to my application's directory myapplication/source/resource/myapplication/icon.
4- copied Tango.js from qooxdoo-directory/framework/source/class/qx/theme/icon/Tango.js to my application's directory myapplication/source/class/myapplication/theme/icon/Icon.js.
5- edited the meta file Themes.js and changed it to:
qx.Theme.define("myapplication.theme.Theme",
{
meta :
{
color : myapplication.theme.Color,
decoration : myapplication.theme.Decoration,
font : myapplication.theme.Font,
icon : myapplication.theme.icon.Icon,
appearance : myapplication.theme.Appearance
}
});
6- edited Icon.js file (which i copied from Tango.js in step 4) and changed it to:
qx.Theme.define("myapplication.theme.icon.Icon",
{
title : "myIcons",
aliases : {
"icon" : "myapplication/icon"
}
});
7- edited Decoration.js, Appearance.js, Color.js and Font.js in my application's theme directory and changed the classes' namespaces from:
qx.Theme.define("qx.theme.modern.<file's name>",
to
qx.Theme.define("myapplication.theme.<file's name>",
8- corrected assets paths in Decoration.js and Appearance.js from the original path qx/decoration/Modern or qx/icon/Tango to the one relevant to my appliaction myapplication/decoration and myapplication/icon, for example:
#asset(qx/decoration/Modern/toolbar/toolbar-part.gif)
changed to
#asset(myapplication/decoration/toolbar/toolbar-part.gif)
ps: the relative path in an application is application-name/source/resource, so you can refer to any directory in this folder by application-name/folder-name.
9- likewise in step 8 i changed aliases in decoration.js to:
aliases : {
decoration : "myapplication/decoration"
},
10 - ran generate.py file in myapplication/source.
and done, now i can change anything i want without crashing the API :)

New custom theme without copying all the default files

I search how to configure a custom theme in Magento Enterprise ver. 1.12.0.2 without doing a copy of all the base/default files.
The only way I can make it is to create my_theme folder in /var/www/magento/app/design/frontend/enterprise/my_theme and then in system>configuration>design to let enterprise as "Current Package Name" and my_theme as "default" in "themes".
But I'm afraid it's not the ideal way in case of upgrading Magento.
Is anyone have an idea ?
Thanks
You're on the right track. What I typically do is create a new Package and Theme. It will still fallback to base/default so you don't have to copy all of the default files into your package. Leave default empty in the Admin -> General -> Design section. Set the Package Name to your package and the other theme settings except for default to your theme name. You'll only need to copy template and layout files that you plan on customizing, so there's no need to copy everything into your theme.
I've tried already but it didn't worked....
I found why in
http://www.magentocommerce.com/knowledge-base/entry/magentos-theme-hierarchy
"2nd Exception to Rule 6: Enterprise customers for now DO need to copy the files from enterprise/default into their custom package as a starting point. In a future release, the Enterprise files will be folded into the base/default directories but they are not in EEv1.8."

How to call our design css and js for Magento

I am new in Magento. I am trying to implement a theme according to our design. But for my new theme css and images not call; I don't understand what the issue here?
I have copied the modern folder and after that renamed this folder with our theme name Brace
Location:/app/design/frontend/defaul/Brace
For css and Js
I have copied the modern folder and after that renamed this folder with our theme name Brace
Location:/skin/frontend/defaul/Brace
After that I have copied my all images in /skin/frontend/defaul/Brace/images folder. And then copy my stylesheet in /skin/frontend/defaul/Brace/css/style.css.
When I change theme name from admin it not reflect css and images on frontend.
I have searched from net but all solution different that confusing me.
It's probably 'default' instead of 'defaul'?
Are you sure about the design settings of your store? (System -> Configuration -> Design)
In your case the 'Package -> Current Package Name' should be 'default' and the 'Themes -> default' should be 'Brace'.
Also be sure that the configuration scope is set correctly in the sidebar: this should be 'default configuration' or 'the name of your store'.
Sometimes you also need to clear (all) the cache to see results :) (System -> Cache Management).
In the end you could try to use the template hint option as mentioned by Clockworkgeek
Good luck!

Resources