How custom template implement in opencart - php

I am new in Opencart, I have installed Opencart 2.3.0.2 in my xampp server.
I have a custom html template. How I implement it in Opencart ?
can I use the template in same store(opencart default) or another ?
Thanks alot.

Make copies…
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.

Related

I want to change the title-line on an archive-page in Wordpress

An archive-page gives as title: Tag: <tag-title> or Category: <category-title>. That's nice, but I like to have only: <tag-title> or <category-title>.
As far as I can see, the standard title is constructed in ../wp-includes/general-templates.php while /wp-content/languages/nl_NL.mo translates the "Tag:" and "Category:" part into Dutch.
So I tried to reach my goal by translating Tag: %s into %s; that worked, till Wordpress Translations were updated. Translating the child theme's nl_NL.mo didn't work. So I guess this is not something in the theme, but i Wordpress.
I tried to change the code in /wp-includes/general-templates.php and that worked - till WordPress was updated. So what can I do to make the changes of the title-line on my archive-pages sustainable?
You would need to create and activate a child theme, find the php template file in the parent theme which is used for archive pages and which contains the title of the archive pages, copy that file to the child theme and change that copy it to your needs.
Typically, that page would use the archive.php file or the category.php file as a template, in less complex themes it could also just use the index.php file. Depending on the complexity of the parent theme, these files could also contain include functions which use additional template-part files - you'll have to find out yourself.

How do I get my current wordpress theme's header & footer in a PHP file?

The file is manually created by me & not a part of the theme.
I've tried by placing get_header( ) inside my file but it shows a error that get_header( ) is not defined.
Maybe you don't have default header and footer names. Then you need to set additional name.
Includes the header.php template file from your current theme's directory. If a name is specified then a specialised header header-{name}.php will be included.
If the theme contains no header.php file then the header from the
default theme wp-includes/theme-compat/header.php will be included.
Source: https://codex.wordpress.org/get_header
I highly discourage it but you need to include the wp-load.php file that resides in the root of your wordpress installation, in your lone php file. That is how you have access to WP functions and capabilities.
But again I HIGHLY DISCOURAGE IT. Find another way, create a simple plugin and activate it, in which you put that php file's code, or if part of a theme, just create a new page template with a different header, that you can call with get_header('name_of_header_without_php_extension') or a new footer called the same way but with get_footer().
There are alternatives, maybe if you share what you are trying to achieve, we can guide you to a better, safe solution.
Based on theme it's defer.
Same time define as get_header(),get_footer()
But now latest themse assign particular theme name based header & footer function
Ex: Theme Name is "Demo"
So the header function assign as Demo_get_header() or get_header_Demo()
Dashboard ->Appearance ->Editor -> in your Template file or in page.php write
<?php get_header()?>,<?php get_footer()?>
if you want to use different headers on different pages
1. create new file , name it header-example.php
2. you can call this header in any page using code

Unable to override template file in Magento 2

I want to override magento's core order/info.phtml.
I have copied the file from
vendor/magento/module-sales/view/frontend/templates/order/info.phtml
and place it here
app/design/frontend/Magento/luma/Magento_Sales/templates/order/info.phtml
But it is still using the old phtml file instead of new overrided file, please tell me where I did wrong?
I am using magento's default theme Magento/luma
You can't override files from the Luma theme like this. And you shouldn't, because you are attempting to hack the Luma theme, while its files are located elsewhere. Plus, it is a demo theme, not meant to create new production shops with.
Instead, try to create a new theme under app/design/frontend, add a proper theme.xml and registration.php. Next, configure that theme from within your backend. And then try to override files there.
You can override luma theme but you should have your own theme name and you have to set parent theme as luma so their properties can be overridden from your custom theme.
Hope you know how to create custom theme , if not see the below steps try the same.
Create a folder inside app/design/frontend/Vendorname/themename
Example : Create vendor name as Test
Theme name as : mytheme
Now you need to create 3 files
composer.json
registration.php
theme.xml
Inside theme.xml you can set the parent as luma like this
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
<title>Test mytheme</title>
<parent>Magento/luma</parent>
<media>
<preview_image>media/preview.png</preview_image>
</media>
</theme>
Once this is done you need to activate your theme from admin end and here you can override anything inside it.
Once you activate your custom theme copy the sales folder this way
app/design/frontend/Test/mytheme/Magento_Sales/order/info.phtml
and do your changes inside it , you can see your changes in frontend.

Option Tree not passing WordPress Theme Check

I am having a problem uploading my theme to wordpress.org. The initial theme check fails with the below error..
REQUIRED: ot-settings-api.php. Themes should use add_theme_page() for adding admin pages.
Line 99: $theme_check_bs = 'add_menu_page';
REQUIRED: ot-settings-api.php. Themes should use add_theme_page() for adding admin pages.
Line 100: $theme_check_bs2 = 'add_submenu_page';
REQUIRED: ot-cleanup-api.php. Themes should use add_theme_page() for adding admin pages.
Line 82: $theme_check_bs = 'add_menu_page';
I have integrated Option Tree framework into my team. But WordPres.org doesn't accept until the issue is resolved.. The funny thing is i downloaded few other themes from WordPress directory which uses Option Tree, I tested with the Theme Check Plugin and they all didn't pass, so how did they manage to upload their themes to the wordpress.org theme directory? How do i resolve the REQUIRED issue and upload my theme successfully..

Replace Logo Image on Drupal Site

I'm new to Drupal and to PHP, all I need to do is change the image file for the logo in my header. I've found my page.tpl.php, and the line for the link, but I don't understand what $logo is referencing. What file is it pointing to? How to I find it and change the file?
Thanks, in advance.
It's point to your {your_theme}/logo.png.
But if system cannot find that png file on your theme.
It will use default logo, for example: themes/bartik/logo.png.
You should not do that in page.tpl.php. Just login to your site, choose appearance => choose your active theme => settings => upload file => go to your file and click upload => save.
Drupal will automatically set $logo to the place it uploaded your logo (somewhere in your public folder). It is important for your theme to use this variable in order to show it on your website. Since you found the variable in your page.tpl.php file, that should be fine.
If you really want to change the file rather than use the proposed method, do this method once and simply search for the logo file in your public folder. Next time you can overwrite this file. You should not overwrite the default Drupal logo.
An even better way to get it is by opening the source code when looking at your webpage (your browser provides this, you can also use a tool like firebug) and search for the "header" id. On the next lines you should find the relative path to the image file that is currently used.
If you are using default theme, you can change your logo at
[your project folder>themes>your theme>logo.png]
If you are using custom theme, you can change at
[your project folder>sites>all>themes>your themes>logo.png]
$logo is referencing to logo.png on those directories.

Categories