زکات علم

زَکاةُ العِلمِ أن تُعَلِّمَهُ عِبادَ اللّه‏ِ امام باقر (ع)
زکات علم

مطالبی در زمینه کامپیوتر و علاقه مندی های شخصی من مطالب این وبلاگ غالبا مطالبی ست که در جای جای اینترنت کتاب یا دانشته های شخصی خودم می باشد که به عنوان مرجعی برای رجوع دوباره در اینجا جمع آوری شده اند .
ehsunitd.ir personal website

پیوندها

۲۹ مطلب با موضوع «آموزش کاربردی» ثبت شده است

1. Add constant to wp-confing.php

define('WP_ADMIN_DIR', 'secret-folder');
define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . WP_ADMIN_DIR);

2. Add below filter to functions.php

add_filter('site_url',  'wpadmin_filter', 10, 3);
 function wpadmin_filter( $url, $path, $orig_scheme ) {
  $old  = array( "/(wp-admin)/");
  $admin_dir = WP_ADMIN_DIR;
  $new  = array($admin_dir);
  return preg_replace( $old, $new, $url, 1);
 }

3. Add below line to .htaccess file
RewriteRule ^secret-folder/(.*) wp-admin/$1?%{QUERY_STRING} [L]

Done...!!!

Now your admin URL will be like: http://www.yourdomain.com/secret-folder/

  • ehsan gholami

Child Theme

A child theme is a theme that inherits the functionality and styling of another theme, called the parent theme. Child themes are the recommended way of modifying an existing theme.


There are a few reasons why you would want to use a child theme:Why use a Child Theme?

  • If you modify a theme directly and it is updated, then your modifications may be lost. By using a child theme you will ensure that your modifications are preserved.
  • Using a child theme can speed up development time.
  • Using a child theme is a great way to to learn about WordPress theme development.

How to Create a Child Theme

Child Theme directory structure

A child theme consists of at least one directory (the child theme directory) and two files (style.css and functions.php), which you will need to create:

  • The child theme directory
  • style.css
  • functions.php

The first step in creating a child theme is to create the child theme directory, which will be placed inwp-content/themes. It is recommended (though not required, especially if you're creating a theme for public use) that the name of your child theme directory is appended with '-child'. You will also want to make sure that there are no spaces in your child theme directory name, which may result in errors. In the screenshot above we have called our child theme 'twentyfifteen-child', indicating that the parent theme is the Twenty Fifteen theme.

The next step is to create your child theme's stylesheet (style.css). The stylesheet must begin with the following (the stylesheet header):

/*
 Theme Name:   Twenty Fifteen Child
 Theme URI:    http://example.com/twenty-fifteen-child/
 Description:  Twenty Fifteen Child Theme
 Author:       John Doe
 Author URI:   http://example.com
 Template:     twentyfifteen
 Version:      1.0.0
 License:      GNU General Public License v2 or later
 License URI:  http://www.gnu.org/licenses/gpl-2.0.html
 Tags:         light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
 Text Domain:  twenty-fifteen-child
*/

A couple things to note:

  • You will need to replace the example text with the details relevant to your theme.
  • The Template line corresponds to the directory name of the parent theme. The parent theme in our example is the Twenty Fifteen theme, so the Template will be twentyfifteen. You may be working with a different theme, so adjust accordingly.
  • The only required child theme file is style.css, but functions.php is necessary to enqueue styles correctly (below).

The final step is to enqueue the parent and child theme stylesheets. Note that the previous method was to import the parent theme stylesheet using @import: this is no longer best practice. The correct method of enqueuing the parent theme stylesheet is to usewp_enqueue_script() in your child theme's functions.php. You will therefore need to create a functions.php in your child theme directory. The first line of your child theme's functions.php will be an opening PHP tag (<?php), after which you can enqueue your parent and child theme stylesheets. The following example function will only work if your Parent Theme uses only one main style.css to hold all of the css. If your theme has more than one .css file (eg. ie.css, style.css, main.css) then you will have to make sure to maintain all of the Parent Theme dependencies. Setting 'parent-style' as a dependency will ensure that the child theme stylesheet loads after it. See here a more detailed discussion :

add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );

}

Your child theme is now ready for activation. Log in to your site's administration panel, and go to Administration Panels >Appearance > Themes. You should see your child theme listed and ready for activation. (If your WordPress installation is multi-site enabled, then you may need to switch to your network administration panel to enable the theme (within the Network Admin Themes Screen tab). You can then switch back to your site-specific WordPress administration panel to activate your child theme.)

Note: You may need to re-save your menu (Appearance > Menus, or Appearance > Customize > Menus) and theme options (including background and header images) after activating the child theme.

Template Files

If you want to change more than just the stylesheet, your child theme can override any file in the parent theme: simply include a file of the same name in the child theme directory, and it will override the equivalent file in the parent theme directory when your site loads. For instance, if you want to change the PHP code for the site header, you can include a header.php in your child theme's directory, and that file will be used instead of the parent theme's header.php.

You can also include files in the child theme that are not included in the parent theme. For instance, you might want to create a more specific template than is found in your parent theme, such as a template for a specific page or category archive. See the Template Hierarchy for more information about how WordPress decides what template to use.

Using functions.php

Unlike style.css, the functions.php of a child theme does not override its counterpart from the parent. Instead, it is loaded in addition to the parent’s functions.php. (Specifically, it is loaded right before the parent’s file.)

In that way, the functions.php of a child theme provides a smart, trouble-free method of modifying the functionality of a parent theme. Say that you want to add a PHP function to your theme. The fastest way would be to open its functions.php file and put the function there. But that’s not smart: The next time your theme is updated, your function will disappear. But there is an alternative way which is the smart way: you can create a child theme, add a functions.php file in it, and add your function to that file. The function will do the exact same job from there too, with the advantage that it will not be affected by future updates of the parent theme. Do not copy the full content of functions.php of the parent theme into functions.php in the child theme.

The structure of functions.php is simple: An opening PHP tag at the top, and below it, your bits of PHP. In it you can put as many or as few functions as you wish. The example below shows an elementary functions.php file that does one simple thing: Adds a favicon link to the head element of HTML pages.

<?php // Opening PHP tag - nothing should be before this, not even whitespace

// Custom Function to Include
function favicon_link() {
    echo '<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />' . "\n";
}
add_action( 'wp_head', 'favicon_link' );

TIP FOR THEME DEVELOPERS. The fact that a child theme’s functions.php is loaded first means that you can make the user functions of your theme pluggable —that is, replaceable by a child theme— by declaring them conditionally. E.g.:

if ( ! function_exists( 'theme_special_nav' ) ) {
    function theme_special_nav() {
        //  Do something.
    }
}

In that way, a child theme can replace a PHP function of the parent by simply declaring it beforehand.

Referencing / Including Files in Your Child Theme

When you need to include files that reside within your child theme's directory structure, you will use get_stylesheet_directory(). Because the parent template's style.css is replaced by your child theme's style.css, and your style.css resides in the root of your child theme's subdirectory, get_stylesheet_directory() points to your child theme's directory (not the parent theme's directory).

Here's an example, using require_once, that shows how you can use get_stylesheet_directory when referencing a file stored within your child theme's directory structure.

require_once( get_stylesheet_directory() . '/my_included_file.php' );

Other Useful Information

Using Post Formats

A child theme inherits post formats as defined by the parent theme. When creating child themes, be aware that usingadd_theme_support('post-formats') will override the formats defined by the parent theme, not add to it.

RTL support

To support RTL languages, add rtl.css file to your child theme, containing:

/*
Theme Name: Twenty Fourteen Child
Template: twentyfourteen
*/

rtl.css is only loaded by WordPress if is_rtl() returns true.

It's recommended to add the rtl.css file to your child theme even if the parent theme has no rtl.css file.

Internationalization

Child themes, much like other extensions, may be translated into other languages by using gettext functions. For an overview, please see Translating WordPress & I18n for WordPress Developers.

To internationalize a child theme follow these steps:

  • Add a languages directory.
    • Something like my-theme/languages/.
  • Add language files.
    • Your filenames have to be he_IL.po & he_IL.mo (depending on your language), unlike plugin files which are domain-he_IL.xx.
  • Load a textdomain.
    • Use load_child_theme_textdomain() in functions.php during the after_setup_theme action.
    • The text domain defined in load_child_theme_textdomain() should be used to translate all strings in the child theme.
  • Use GetText functions to add i18n support for your strings.

Example: textdomain

<?php
/**
 * Setup My Child Theme's textdomain.
 *
 * Declare textdomain for this child theme.
 * Translations can be filed in the /languages/ directory.
 */
function my_child_theme_setup() {
    load_child_theme_textdomain( 'my-child-theme', get_stylesheet_directory() . '/languages' );
}
add_action( 'after_setup_theme', 'my_child_theme_setup' );
?>

Example: gettext functions

<?php
_e( 'Code is Poetry', 'my-child-theme' );
?>


To sum up, all strings that use "my-child-theme" textdomain will be translatable. The translation files must reside in "/languages/" directory.

Resources

Be aware that some of these resources recommend using @import from your child theme's stylesheet as the method of importing the parent theme stylesheet. Please use the wp_enqueue_script() method described above.

  • ehsan gholami

10 Elements of Good Product Label Design

 

There are no hard and fast rules that you can follow in order to create a well crafted product label design. However, most of us recognize an appealing design when we see one. Why? Because there are certain elements that will make a product label design attractive and compelling. This article will guide you through the main design elements of a product label design and provide tips on how to use these elements to your advantage.

 

1. Color

To grab the attention of someone who is casually walking the aisles of the supermarket you need to use color well. The color you choose for your label is dependent on a number of things. What color is your container? If you are using a clear container, then what color is the product? You need to make sure that the colors you choose for the label don’t clash in a negative way to lessen the visual appeal of the entire package. Luckily there are tools to help you choose colors that will work well together. Adobe Kuler (kuler.adobe.com), ColourLovers (www.colourlovers.com) and ColorBlender (www.colorblender.com) are tools that you can use to help choose attractive color combinations for your labels.

 

 

2. Graphics

An eye catching graphic will also help draw attention to your product. With stock photography and illustrations so inexpensive these days you can find a graphic for your labels at places like iStockphoto.com or Photos.com for just a few dollars. You can then use these images on your product labels, just be sure to check the license agreement. In the case of iStockphoto you can use most images for up to 500,000 product labels without buying an extended license. A picture really can be worth 1,000 words on a product label as a compelling graphic draws the eye to your product.

 

 

3. Readability

Speaking of type, your choice of fonts is a critical decision and deserves just as much attention as choosing color and graphics. Don’t choose one of the standard Windows fonts such as Times New Roman or Arial, and also avoid overused fonts such as Papyrus or Monotype Corsiva. Don’t be afraid to try something new and different – there are thousands of unique fonts available online – just go to fonts.com or 1001freefonts.com. The important point to remember is that you want good looking type that is easy to read.

 

 

4. Fonts

Speaking of type, your choice of fonts is a critical decision and deserves just as much attention as choosing color and graphics. Don’t choose one of the standard Windows fonts such as Times New Roman or Arial, and also avoid overused fonts such as Papyrus or Monotype Corsiva. Don’t be afraid to try something new and different – there are thousands of unique fonts available online – just go to fonts.com or 1001freefonts.com. The important point to remember is that you want good looking type that is easy to read.

 

5. Material

Before you even begin the design process you need to consider the label material. Your design needs to "fit" the material. Common material choices include white, clear, or a cream textured paper. Clear material allows for a "no label look" that can be very striking if you have a colored container or product. Take a look at Palmolive original dish soap – this is a product that uses a clear label very well. A simple design with white ink, it really shows off the striking green liquid inside. White material gives you the most flexibility with design, because you can make white into any color you like, or you can just use the white background. For an old world look, a textured cream paper can be very effective and is popular with wineries where you want to convey a handcrafted image.

 

 

6. Label Finish

Whether you choose a glossy or matte finish to your labels is a judgment call depending on the kind of image you want to convey. A matte laminate can provide a more classic look that is very easy to read, whereas gloss will add some impact to the colors on the label and provide a shiny, reflective look. A good example of the matte look is the Honest Tea brand of bottled teas. In the highly competitive beverage market they have a more subdued look with a simple product label design that works really well with the matte finish. If you can’t decided between matte and glossy then do a small order of both and test it – see what people find most attractive.

 

 

7. Label Size

If you are using a round container then you most likely have a choice – do you want one large label or separate front and back labels? Front and back labels allow you to elegantly separate the front branding information from the ingredient and regulatory information but they can be more expensive than a large wrap around label. If you go with a wraparound label then it is important to keep a front "panel" with the vital branding information because that is what the consumers will see as they are browsing the aisles.

 

 

8. Shapes

You can really draw attention to your label by using an unusual shape. This will require the initial investment of a new die which can cost several hundred dollars depending on the size and complexity of your design. Heinz ketchup is one example of an unusual shape done well – the keystone label shape has become part of their brand after more than 130 years. Here is one trick that can save you the money of buying a special die. Use a clear label and simulate an unusual shape by using white ink to create your desired shape, so it will appear that your label has a unique shape even if it is a simple rectangle label.

 

 

9. A Theme for Different Flavors

With multiple flavors of the same product it is important to keep major design elements of your label consistent. Whether someone is looking at the peach, orange or lime flavor they should be able to recognize instantly that it is all the same company and brand. A company that does an excellent job of keeping a consistent yet different look between flavors is Nantucket Nectars. Each flavor has a simple illustration encompassing the flavor with a similar scene from Nantucket Island in the background.

 

 

10. Contact Information

In the 21st century every company should have contact information on their product labels. This is obviously not about making your label design more appealing, but rather having your label be more than just a passive selling and marketing tool. An 800 number, a web site and a physical address can all be easily included on the label. You could provide a special web site on your label for customers to sign up for an email list, so you can gather information and start to interact with your good customers.

 

When designing your label it is important to take into account what your competition is doing. If most companies in your space have very colorful and glossy labels, then maybe a more plain and subdued look will allow you to stand out on the supermarket shelf. Take many of the elements mentioned here and differentiate yourself from the competition. Providing a new and interesting look invites customers to pick up your product.

As we said in the beginning of this article there are no hard and fast rules for good product label design, but if you stroll the grocery store aisles and look at the labels of products that have been successful you will see that they have many elements in common. Of course, most of these successful products have labels that were created by professional graphic designers, so if you can afford one I firmly believe that is money well spent. But if you don’t have the budget or prefer to do it yourself then consider these ten elements when creating your product label.

(Peter Renton)

  • ehsan gholami

Backup & Recovery in Windows

Subscribe to Backup & Recovery in Windows 8 post(s), 4 voice(s)

 

Avatarsyed

16 post(s)

What is the best possible way to “backup redmine” in Windows OS.
Please help.

Thanks & Best Regards,
Syed

 

AvatarBeltrán Rueda

Administrator

3,714 post(s)

You can create a backup using several methods. I will comment two of them.

1. If you want to create a backup of the database only.

Go to the “use_redmine” shortcut and type the follwing in the command prompt:

> mysqldump -u root -p bitnami_redmine > backup.sql

The password is the same than your administrator password in Redmine application or the same that you write during the installation. You should also copy the files that you have uploaded to the application, which are into the /apps/redmine folder.

2. If you want to backup the whole Stack.

This method is very quick and let you move your Redmine application to another Windows machine easily.

IMPORTANT: Stop the servers. You can stop the servers using the shortcut or you can stop the services in the Windows service panel ( you can type in a command prompt “services.msc”). The name of the services are redmineApache, redmineMySQL and redmineMongrel. It is possible that you have more than one Mongrel.

- Once you have stopped the services, copy your installation directory in a USB, CD or to the other machine directly. It is important that the installation directory is the same in the new machine. For example if you have installed the Stack in C:\Program FIles\BitNami Redmine Stack, this is the same location where you should copy the backup in the new machine.

- Install the services in the new machine. Go to a command prompt and type:

> cd “C:\Program Files\BitNami Redmine Stack”
> servicesinstall.bat INSTALL

That’s all, I hope it helps.

 

Avatarsyed

16 post(s)

Dear Beltran,

I prefer the second solution..and it is working without any problem.
Thanks you very much for the excellent help.

Thanks & Best Regards,
Syed

 

AvatarBeltrán Rueda

Administrator

3,714 post(s)

Great! I’m glad to hear this.

 

Avatarekasadevelop...

11 post(s)

Dear, Beltran

I´ve sent a topic similar to this to do a question (https://bitnami.com/forums/forums/redmine/topics… for recovery the backup.sql before the command
mysqldump -u root -p bitnami_redmine > backup.sql

I don´t Know how to do this and i don´t see anything about this in the forum to recovery de backup in Windows

Thanks

 

Avatarekasadevelop...

11 post(s)

Dear all,

Finish, i find the command to recovery the backup.

Apologize for the inconvenients.

 

AvatarSriram Chitturi

5 post(s)

Before installaing I did the following, which helped me backing up and moving the Bitnami redmine to another machine easily.
a) create or pick up some directory (say for eg. C:\MyProjects\Redmine) where you want to install the stack
b) use Windows “subst” command and assing a uncommon drive letter to the directory, eg. subst X: “C:\MyProjects\Redmine”
c) Now when you install the Bitnami stack give this drive (X:) as the destination folder to install
d) Make sure to place the subst command in autoexec.bat file, so that the drive letter is correctly assigned whenever the machine is rebooted

Now you can back up the complete Bitnami stack as it is.
Not only that if you run out of space on the current disk, or if you attach anoter drive or what ever, just move the contents to that folder and change the subst command. Hope this helps.

 

AvatarBeltrán Rueda

Administrator

3,714 post(s)

Great quick guide for backups. Thanks for sharing with other BitNami users.

  • ehsan gholami

change the opencart logo and footer in the admin panel 

 





easiest way to do this would be just to replace the main logo for admin site:

CODE: SELECT ALL
/public_html/admin/view/image/logo.png



for footer, edit the file:

CODE: SELECT ALL
/public_html/admin/language/english/common/footer.php
 
  • ehsan gholami

When operating an e-store in OpenCart sometimes store owners want to edit or delete Powered by OpenCart title, which is positioned right below in the footer. Usually to enhance presentation they put their store name or completely get rid of the title for various reasons. In this tutorial we will lead you through the necessary steps on how to edit and delete the Powered by OpenCart.

 
Editing Powered by OpenCart:
 
In order to edit the Powered by OpenCart you need to go to Catalog/Language/(The current language you are using)/Common/Footer and look for the line that reads:
$_['text_powered']      = 'Powered By <a href="http://www.opencart.com">OpenCart</a><br /> %s &copy; %s';
You can basically substitute the text with whatever message you want to send to your website visitors.
 
Removing Powered by OpenCart:
 
In order to remove the Powered by OpenCart you need to go to Catalog/View/Theme/(The Name of your Theme)/Template/Common/Footer.tpl
 
Look for the line that reads:
 
<div id="powered"><?php echo $powered; ?>
You can delete the line if you think you won't need to retrieve the Powered by OpenCart one day or you can comment it by putting:
 
/* <div id="powered"><?php echo $powered; ?> */
 
In case you are using iCustomFooter, things are even easier. All you need to do is go to the admin and click on Support & Settings/Settings and select Hide 'Powered By' message to No and click onSave.
 
  • ehsan gholami

You seem to be missing the following line in your config.php file which appears usually after define('DIR_SYSTEM', '../system/');

define('DIR_DATABASE', '../system/database/');

I would go back to relative paths, keep in mind there are two config files, one in the root of the site and one in admin. You need to add the '../system' in the admin one if the one in root is 'system'

  • ehsan gholami
This post is part of a series called Create a Custom Theme With OpenCart.
Create a Custom Theme With OpenCart: Part Three

If you've followed the series thus far, you should be able to find the location of home page layout template. Although a quick look at the templates here and there inside "€œdefault"€ theme should give you a hint that it's located at €œdefault/template/common/home.tpl

But if you may have noticed the route of the home page, it contains the value€œcommon/home. So, as we discussed earlier, you can always map this route to find the appropriate layout template file.

Homepage Layout Elements

Looking at the œhome.tpl€ file, you'll realize that most of the content is generated via the generic elements like $header$footer etc. We won't discuss the $headerand $footer elements as you already know that the contents of those variables are coming from œheader.tpl and €œfooter.tpl€ files underneath  template/common directory, respectively. 

In the case of default OpenCart home page, there are no modules assigned at the "€œColumn Left"€ or "€œColumn Right"€ position so you can say that $column_left and$column_right variables are not doing anything. So everything you see on the home page except for the header and footer, is coming from either $content_topor $content_bottom variable. "€œSlideshow"€ and "€œFeatured"€ modules are assigned to "€œContent Top"€ position and "€œCarousel"€ module is assigned to "€œContent Bottom"€ position to the "€œHome"€ layout.

Now lets go further and see how exactly these modules are assigned to "€œHome"€ page layout.

Get logged into the back-end and go to "€œExtensions > Modules"€. This will list out all the modules available in the system. Now, click on the "€œEdit"€ link for the "€œSlideshow"€ module which will display the module assignment interface.

Slideshow Module Configuration

Although there is quite a bit of configuration available here, the important column for us are "€œLayout"€ and "€œPosition"€. As per the values assigned there, "€œSlideshow"€ module will be displayed at "€œContent Top"€ part in the "€œHome"€ layout. 

From here, you can also assign a "€œSlideshow"€ module to any layout at any position using "Add Module" button. Now let's take a look at an another example, on the module listing page click on the "€œEdit"€ link for the "€œFeatured"€ module.

Featured Module Configuration

Again you can see that, the "€œLayout"€ and "€œPosition"€ values are same as that of the "€œSlideshow"€ module. So now you should be familiar with how exactly these modules are displayed in the home page. As you may have noticed that there is also "€œRemove"€ button available which is used to un-assign a module from the specific layout. Go ahead and explore the settings for "€œCarousel"€ module yourselves!

Now that you are aware with how module is assigned and unassigned to a specific page and position, we'll go through the same to tweak the home page layout. Jump into the admin section, and go to the "€œExtension > Modules"€ to bring the module listing page on the table.

In this step, we'll remove all the assigned modules from the home page.

  • Click on the "Edit" link for the "Slideshow" module. Now, click on the "Remove" button to un-assign a module from "Home" layout. After that click on "Save" button to apply the changes. Repeat the same procedure for the "Carousel" and "Featured" modules. 

At the end of this step if you check your home page, you should see almost an empty home page except "header" and "footer" parts. Don't worry, that's what we really intended to do! In the next step, we'll assign a bit different set of modules to "€œColumn Left"€ and "€œColumn Right"€ positions in home page. Let's go to the module listing page again.

  • Click on the "€œEdit"€ link for the "€œCategory"€ module. At the bottom right of the page, you'll see an "€œAdd Module"€ button, clicking upon which would add a new row to the listing. In that row, in the "€œLayout"€ column select "€œHome"€ and in the "€œPosition"€ column select "€œColumn Left"€. After that click on "€œSave"€ button to apply the changes.
  • Click on the "€œEdit"€ link for the "€œAccount"€ module. Click on the "€œAdd Module"€ button to add a new row. In the newly added row, in the "€œLayout"€ column select "€œHome"€ and in the "€œPosition"€ column select "€œColumn Right"€. Apply your changes using the "€œSave"€ button.

So now let's have a look at our front-page:

Partial Homepage

So far we have done all the layout related tweaking from the back-end itself. In this section, we'll add a bit of static text content to the œhome.tpl. Whenever you need to add a static text in any template, instead of putting the text directly inside the template you should follow the standard way of the OpenCart. Let's exercise the same. 

Of course, you won't directly edit the œhome.tpl file in the "€œdefault"€ theme, lets override it in your custom theme!

Go ahead and open €catalog/language/english/english.php. Add the following line at the end of the file just before the line which contains œ?>.

Now go ahead and open œcatalog/controller/common/home.php. We'll include the language variable added in the english.php file in this controller file so it's available in the œhome.tpl file for display.

In "€œhome.php"€ before the following line,

Add this one,

This will make sure that the $welcome_text variable is available in the layout template file just like any other variables. Now the only thing remaining is to include$welcome_text in the home.tpl file. So your home.tpl should look like this,

I've done very few changes in this file. I've added the variable $welcome_textsurrounded by <div> tag. I've also removed the display:none from the <h1> tag so the title is displayed. Finally, a bit of formatting of the code is done for better readability. Here's the final snap!

Complete Homepage

There are a couple of important things to note here, although we've directly modified english.php and home.php files but it's strictly discouraged to do so. It was just done to keep this example simple. In fact, you should use "vQmod" OpenCart extension in the case in which you need to modify the core files.

So this was a pretty simple example to demonstrate the layout modifications on the home page layout. Although we added a simple static text, you can fetch more dynamic information from the database and display the same in the template! 

Of course, that is something requires a bit of knowledge of how OpenCart model works. You're encouraged to go further and assign couple of more modules to the different positions to see how things work.

I hope this series helped you to understand what exactly OpenCart theme is all about and how to customize the default theme with your own. You can always shoot your comments and questions in the feed below.

  • ehsan gholami

How do you remove Help menu in Admin

 

admin/view/theme/common/header.tpl

delete all lines with the word help. just search for the word in the file.
  • ehsan gholami

The first thing we need to do is backup your website files. Open up FileZilla (or your favorite FTP program) and enter your current host's FTP Host, username and password into the top boxes then click the Quickconnect button. If you don't know what these settings are then you can usually find them in your control panel with your current hosting company. Failing that, you can contact your host and ask them for these.

Opencart FTP Download

Once connected, you will need to navigate to where your OpenCart website is located. This is usually in your public folder called Public_html or Htdocs. If you installed your OpenCart website into a sub folder e.g. yourwebsite.co.uk/shop, then you will need to find your 'shop' folder.

Double click on your public folder to open it.

public_html

You should now see your website's files. We need to double check you are in the correct folder for your OpenCart files. Look for the below three files. If you can see these you are in the correct location.

  • config.php
  • hide_config_files.php
  • index.php

If you can't see these files then you will need to look inside your other folders. If you installed your OpenCart store in a sub folder e.g. yourdomain.co.uk/shop then look for your 'shop' folder and double click it to open it. Then look for the above files.

Once you are in the correct location, you will need to select all the files and folders. To do this, left click once on config.php and press the 'CTRL' button and the 'A' key at the same time (command-A on a Mac). This will change all the files to be selected. You can now drag the files into a folder of your choice (left click on one file and drag them over a folder on your computer). We suggest having a folder on your desktop called 'old website' and downloading the files into here.

Download Opencart Files via FTP

You will see a lot of connection and download text show in the top bar. Once this has stopped you should have all your OpenCart files downloaded to your computer.

Next, we need to download a copy of your OpenCart database. To do this, we will use phpMyAdmin. You will need to contact your current host and ask them for instructions on how to access phpMyAdmin for your database. Usually this will be under your control panel in a manage MySQL databases section.

Once in phpMyAdmin, click your database from the left hand menu.

OpenCart Database

You should see a list of tables related to open cart, starting with oc_ e.g. oc_address,oc_affiliate etc.

Next, click the export tab at the top.

Export OpenCart Database

Click the custom button then click the 'Select All' link to highlight all of the OpenCart tables.

Export database settings

Finally choose zipped from the 'Compression' drop down, then scroll down and click the 'Go' button.

Ziped OpenCart databse

You will be asked to save this to your computer. Make sure you remember where you save it to as you will need it later.

Step 2 : Upload your OpenCart Files to your new server

Now you have a copy of your website, we need to upload it and restore it on your new hosting/server. If you have purchased hosting with Squirrel Hosting then you can follow this guide exactly. If you're using another company for hosting, you will need to contact them for details on how to connect to your hosting via FTP and how to setup/connect to your database.

Open up FileZilla and connect to your new hosting company. Squirrel Hosting customers check your welcome e-mail for your FTP details. As your domain is still technically loading up your old hosting company at this stage, you will need to use the host's IP address instead of ftp.yourdomain to connect.

Opencart FTP upload

Double click on your public folder to open it up (for Squirrel Hosting customers, double click public_html).

public_html

Next, we need to upload all the files you downloaded in step 1 (do not upload your MySQL database).

To do this open up the folder where your files are stored and highlight them all, then drag them over onto your public folder.

Upload OpenCart via FTP

Step 3 : Create a MySQL Database

Now we need to create a new database on your new hosting. This can vary depending on which hosting company you choose to use. For Squirrel Hosting customers, simply follow the below steps. For other hosting companies you will need to contact them and ask how to set up a MySQL Database. You will also need to make a note of the database hostname, username, password and database name then skip to step 4.

For Squirrel Hosting customers only, load up your eXtend control panel (see your welcome e-mail for details on how to do this) and click the MySQL Databases icon.

MySql databases icon

Next, enter your desired username in the username box and then click the 'Generate Password' button. Finally click Create.

Generate database password

Scroll down to the bottom of the page and under the 'Manage MySQL Databases' section you will see the database you have just created. Make a note of the following;

  • Username (including any - )
  • Password (hover over to view it)

OpenCart database username and password

Step 4 : Upload your OpenCart Database

We now need to load phpMyAdmin on your new hosting to import our OpenCart database. Again if you are with a company other than Squirrel Hosting you will need to contact them for details on how to access your database. For Squirrel Hosting customers, click the 'manage database' button under your 'MySQL databases' button in eXtend.

Manage database

Once in phpMyAdmin, click your database menu on the left.

Import database tab

Click the 'Choose File' button and select the OpenCart database you made a backup of in step 1. Then scroll down to the bottom and click the 'Go' button.

Choose Opencart database

This may take a few moments to process depending on how big your database is.

uploading database

Once complete, you should see a message stating "Import has been successfully finished".

Import has been successfully finished

You have now restored your database and website files.

Step 6 : Update your config files

We now need to update your config.php and admin/config.php files to have the correct settings. You can either do this via FileZilla (FTP) or edit the files on your computer then upload them via FileZilla. If you do upload them, make sure they go in the correct location.

For the purpose of this guide, we will update them via FileZilla.

Open up FileZilla and connect to your new hosting package. Double click on your public folder (public_html). Next, right click on your config.php file and select 'View/Edit' (if you have installed your OpenCart in a sub folder, you will find your config file in there.)

View/Edit config.php

The file should now open up for editing. In here you will need to edit a few lines of code. Find the lines:

// DIR
define('DIR_APPLICATION', '/home/sites/YOUR-DOMAIN/public_html/catalog/');
define('DIR_SYSTEM', '/home/sites/YOUR-DOMAIN/public_html/system/');
define('DIR_DATABASE', '/home/sites/YOUR-DOMAIN/public_html/system/database/');
define('DIR_LANGUAGE', '/home/sites/YOUR-DOMAIN/public_html/catalog/language/');
define('DIR_TEMPLATE', '/home/sites/YOUR-DOMAIN/public_html/catalog/view/theme/');
define('DIR_CONFIG', '/home/sites/YOUR-DOMAIN/public_html/system/config/');
define('DIR_IMAGE', '/home/sites/YOUR-DOMAIN/public_html/image/');
define('DIR_CACHE', '/home/sites/YOUR-DOMAIN/public_html/system/cache/');
define('DIR_DOWNLOAD', '/home/sites/YOUR-DOMAIN/public_html/download/');
define('DIR_LOGS', '/home/sites/YOUR-DOMAIN/public_html/system/logs/');

You will need to update these to your correct path. Contact your hosting company for the full path to your public folder. (for Squirrel Hosting customers, use /home/sites/YOUR-DOMAIN/public_html/ . Make sure to replace YOUR-DOMAIN with your domain without the www. e.g. /home/sites/mywebsite.co.uk/public_html/)

Next, you need to update your database connection settings. Find the below:

// DB
define('DB_DRIVER', 'mysql');
define('DB_HOSTNAME', 'localhost');
define('DB_USERNAME', 'your-old-opencart-databse-username');
define('DB_PASSWORD', 'your-old-opencart-databse-password);
define('DB_DATABASE', 'your-old-opencart-databse-database);
define('DB_PREFIX', 'oc_');

You will need to replace these with the new details made in step 3;

  • DB_HOSTNAME = Your database host (usually localhost). Squirrel Hosting customers, use localhost here.
  • DB_USERNAME = Your Database username.
  • DB_PASSWORD = Your Database password
  • DB_DATABASE = Your database name (Squirrel Hosting customers, use your database username here.)

Once you have updated these, save the file and click back to FileZilla. It will ask you if you wish to upload the file as it has changed. Click 'Yes' to this.

Upload config.php to server

Next, we need to make the file 'read only' (CHMOD it to 444). On most servers, this is 444. To do this, right click on the config.php file again and click 'File Permissions'.

edit Config.php file permissions

In the popup box, enter 444 in the number area then click 'OK'.

Chmod config.php to 444

This file is now non editable. If you find you have made a mistake in what you have typed and you need to re-edit the file, you will need to re do this last step and enter 777. Make sure you DON'T leave this file CHMOD to 755 or you may leave your site open to hackers!

Next, we need to do the same edit with the admin/config.php file. Double click on your OpenCart admin folder.

OpenCart Admin Folder

As we did last time, right click on the config.php file and click 'View/Edit'.

edit admin config.php

As we did before, update the below to show your correct path.

// DIR
define('DIR_APPLICATION', '/home/sites/YOUR-DOMAIN/public_html/admin/');
define('DIR_SYSTEM', '/home/sites/YOUR-DOMAIN/public_html/system/');
define('DIR_DATABASE', '/home/sites/YOUR-DOMAIN/public_html/system/database/');
define('DIR_LANGUAGE', '/home/sites/YOUR-DOMAIN/public_html/admin/language/');
define('DIR_TEMPLATE', '/home/sites/YOUR-DOMAIN/public_html/admin/view/template/');
define('DIR_CONFIG', '/home/sites/YOUR-DOMAIN/public_html/system/config/');
define('DIR_IMAGE', '/home/sites/YOUR-DOMAIN/public_html/image/');
define('DIR_CACHE', '/home/sites/YOUR-DOMAIN/public_html/system/cache/');
define('DIR_DOWNLOAD', '/home/sites/YOUR-DOMAIN/public_html/download/');
define('DIR_LOGS', '/home/sites/YOUR-DOMAIN/public_html/system/logs/');
define('DIR_CATALOG', '/home/sites/YOUR-DOMAIN/public_html/catalog/');

Then edit your Database settings:

// DB
define('DB_DRIVER', 'mysql');
define('DB_HOSTNAME', 'localhost');
define('DB_USERNAME', 'your-old-opencart-databse-username');
define('DB_PASSWORD', 'your-old-opencart-databse-password);
define('DB_DATABASE', 'your-old-opencart-databse-database);
define('DB_PREFIX', 'oc_');

Your database settings will be the same as you entered in your other config.php file earlier. Once edited save the file then confirm the upload on FileZilla.

Upload admin config.php Opencart

Finally, CHMOD this file like you did with your other config.php (right click 'File Permissions') to 444.

  • ehsan gholami