Opencart2 : Create custom module in admin

Here is the way add custom helloworld module in admin.

  1. create admin/controller/custom/helloworld.php
    <?php
    class ControllerCustomHelloworld extends Controller {
    
     public function index() {
    
     $this->load->language('custom/helloworld');
     $this->document->setTitle($this->language->get('heading_title'));
     $this->load->model('custom/helloworld');        
    
     $data['header'] = $this->load->controller('common/header');
     $data['column_left'] = $this->load->controller('common/column_left');
     $data['footer'] = $this->load->controller('common/footer');
     $this->response->setOutput($this->load->view('custom/helloworld.tpl', $data));
    
     }
    }
    ?>
  2. Create admin/model/custom/helloworld.php

    <?php
    class ModelCustomHelloworld extends Model {
    
    public function helloworldmodel(){
    
     }
    }
    ?>
  3. create admin/language/english/custom/helloworld.php

    <?php
    // Heading
    $_['heading_title']          = 'Hello world Admin module';
    
    ?>
  4. Create admin/view/template/custom/helloworld.tpl

    <?php echo $header; ?><?php echo $column_left; ?>
    <h1><?php echo "This is helloworld admin module in opencart 2.x.x.x "; ?></h1>         
    <?php echo $footer; ?>
  5. Go to system -> users -> user groups -> edit Administrator group. Select all to access permission and modify permission and save.custom-module

Move website from one domain to another domain in opencart

Here is the steps to migrate opencart website from one server to another server.

  1. Download ALL the files from old server.
  2. Take a backup of Database using PhpMyAdmin.
  3. Upload files to NEW SERVER.
  4. Install Database on NEW SERVER
  5. Update the configuration files i.e config.php and admin/config.php with new domain path.

Update config file with following details.

<pre>
// HTTP
 
define('HTTP_SERVER', 'http://yournewdomain.com/');
 
// HTTPS
 
define('HTTPS_SERVER', 'http://yournewdomain.com/');
 
// DIR
 
define('DIR_APPLICATION','/root-folder-newdomain/public_html/catalog/');
define('DIR_SYSTEM','/root-folder-newdomain/public_html/system/');
define('DIR_DATABASE','/root-folder-newdomain/public_html/system/database/');
define('DIR_LANGUAGE','/root-folder-newdomain/public_html/catalog/language/');
define('DIR_TEMPLATE','/root-folder-newdomain/public_html/catalog/view/theme/');
define('DIR_CONFIG','/root-folder-newdomain/public_html/system/config/');
define('DIR_IMAGE','/root-folder-newdomain/public_html/image/');
define('DIR_CACHE','/root-folder-newdomain/public_html/system/cache/');
define('DIR_DOWNLOAD','/root-folder-newdomain/public_html/download/');
define('DIR_LOGS','/root-folder-newdomain/public_html/system/logs/');

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

</pre>


Save the changes and upload files on new server.

How to setup Robots.txt In OpenCart?

How to setup Roboto.txt file?

Robots.txt stands for robots dot txt.  Roboto.txt is a text file that helps search engines like Google, Bing to understand what information on a particular site needed to be indexed. It is a critical file to success for any e-commerce store.

Why we need this file ( Roboto.txt )?

Robots.txt file should be placed in the root directory of your website. It tell the search engines, which pages to skip and which to index. Webmasters use robots.txt files to help search engines index the content of their websites.  Robots.txt file is the simple and easy method of easing the process for spiders to provide more relevant search results.

Improve performance by the use of Roboto.txt file in Opencart.

There are two primary reasons of using roboto.txt file, which are mention below :

  1. Robots.txt will help prevent duplicate content issue, one of the primary thing for SEO success.
  2. Robots.txt also hide technical details about website  i.e. Error logs, SVN files, wanted directories etc. Since, these are prevented by Robots.txt you are left with clean URLs to be indexed in search engines.

 

Set Up Robots.txt in OpenCart

Robots.txt settings will only cover 1 domain at a time, so for multiple stores you have to create separate robots.txt files for each stores. Creating Robots.txt is super simple since it’s nothing but a text file . It is supposed to reside at root of your site

Example :  Ff your store domain is www.a2bizz.com you should put robots.txt file under the domain root where you also have app directory. So it sits and accessed like www.a2bizz.com/robots.txt.

Note : Search engines look for Robots.txt file directly under store root and not under a directory.

 

Roboto.txt for opencart :

Test version of roboto.txt is given below :

User-agent: *
    Disallow: /*&limit
    Disallow: /*?limit
    Disallow: /*?sort
    Disallow: /*&sort
    Disallow: /*?order
    Disallow: /*&order
    Disallow: /*?price
    Disallow: /*&price
    Disallow: /*?brand_tabletpc
    Disallow: /*&brand_tabletpc
    Disallow: /*?color_default
    Disallow: /*&color_default
    Disallow: /*?filter_tag
    Disallow: /*&filter_tag
    Disallow: /*?mode
    Disallow: /*&mode
    Disallow: /*?cat
    Disallow: /*&cat
    Disallow: /*?dir
    Disallow: /*&dir
    Disallow: /*?color
    Disallow: /*&color
    Disallow: /*?product_id
    Disallow: /*&product_id
    Disallow: /*?minprice
    Disallow: /*&minprice
    Disallow: /*?maxprice
    Disallow: /*&maxprice
    Disallow: /*?route=checkout/
    Disallow: /*?route=account/
    Disallow: /*?route=product/search
    Disallow: /*?page=1
    Disallow: /*&create=1
    Disallow: /?route=information/contact
    Disallow: /*?route=affiliate/
    Disallow: /*?keyword
    Disallow: /*?av
    Disallow: /admin/
    Disallow: /system/
    Disallow: /catalog/
 
    Sitemap: http://www.a2bizz.com/index.php?route=feed/google_sitemap

 

 

How to install vQmod

Install vQmod in opencart :

If you have opencart version 2.0.0.0 or above, you don’t need to install vQmod. Opencart 2.0.0.0 or above already install vQmod ( exactly called OCMOD ).

It is for opencart 1.5.6.4 or below versions.

Here is the following steps to install vQmod.

  1. Download the latest version of vQmod form here. You have to download vQmod version with opencart. Standalone version is not compatible with opencart.
  2. Extract the archive and copy all files in the your OpenCart root directory. File structures of opencart root directory is given below.
    - admin
    - catalog
    - download
    - image
    - system
    - vqmod
    --- install
    --- vqcache
    --- log
    --- xml
  3. Give write access permission to following files:
    - index.php
    - admin/index.php
    And directories :
    vqmod/
    vqmod/logs/
    vqmod/vqcache/
  4. Openlink link in the browser : http://yourwebsite.com/vqmod/install

If you have done everything, you will see this message on browser : ‘VQMOD HAS BEEN INSTALLED ON YOUR SYSTEM!‘.

vQmod (OCMod)

“vQmod” (Virtual Quick Mod) is an override system designed to avoid having to change core files. The concept is quite simple… Instead of making changes to the core files directly, the changes are created as xml search/replace script files. These script files are parsed during page load as each “source” core file is loaded with the “include” or “require” php functions. The source is then patched with the script file changes, and saved to a temp file. That temp file is then substituted for the original during execution. The original source file is never altered. This results in a “virtual” change to the core during execution without any actual modification to the core files

How it works ?

Instead of modifying actual files to add custom modifications, source files are parsed “on-the-fly” right before any of the follow functions are called :

  • include()
  • include_once()
  • require()
  • require_once()

The source is then cloned to a temp file and modifications read from an external script file are made to that temp file. The temp file is then substituted for the real file in the include path. Now the modification is in place while the original file has not actually been altered. Remove the script file and the original source is loaded.

vQmod class is currently written in PHP and script files are xml based, but the concept could be ported to any language and parse could be created for any format. Opencart is only fully tested and working platform that vQmod works with, but this is a concept that can work for other projects and platforms that are controller-based.

There are some files that cannot be used with vQmod :

  • index.php – this is the main file of the Opencart site, it has to load vQmod first for it to work on other pages. So you can’t put the cart in front of the horse.
  • Standalone files – Files that are just standalone and don’t extend or have no hierarchy will not work with vQmod. vQmod works by intercepting the “include” functions. So if file isn’t being included or required, then it cannot be vQmodded
  • css & js files – These files are rendered at the browser level, not at the server level, so vQmod has no effect on these. You can, however, create new files and use vQmod to alter the tpl files to point to these new css/js files. Or you can put.

 

Create a vqmod file from here

Upgrading modules from OpenCart 1.5.x to OpenCart 2.0.x

Opencart has released version opencart 2 and it is very Cheap Manchester United football shirts different from opencart 1.5+. Extensions build in 1.5 will not work on opencart 2.x.x  . You have to upgrade these extension for opencart version 2.x.x

Changes in opencart 2

Coding standards: As many CMS doesn’t use this PHP end tag ” ?> “ in the php file. Opencart 2 also not use the PHP end tag ” ?> “.

Bootstrap : Opencart 2 uses bootstrap 3.0 .

OCMOD instead of VQMOD : It is almost the same. It has similar syntax, but OCMOD is cheap football tops built in the OpenCart. OCMOD planned to be Cheap Barcelona football shirts more simple for reduce amount of the conflicts.

Controllers : Controller changes has been cheap football shirts given below.

1. Assigning template variables

OpenCart 1.5:

$this->data['foo'] = $foo;

OpenCart 2.0:

$data['foo'] = $foo;

2. Assigning a template

OpenCart 1.5:

$this->template = 'module/module.tpl';

OpenCart 2.0:

$this->response->setOutput($this->load->view('module/module', $data));

3. Adding child controllers

OpenCart 1.5:

$this->children = array(
  'common/header',
  'common/footer'
);

OpenCart 2.0 (you can load controllers now):

$data['header'] = $this->load->controller('common/header');
$data['column_left'] = $this->load->controller('common/column_left');
$data['footer'] = $this->load->controller('common/footer');

4. Redirect

OpenCart 1.5:

$this->redirect($this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL'));

OpenCart 2.0:

$this->response->redirect($this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL'));

5. Status field is mandatory for the module now:

if (isset($this->request->post['module_name_status'])) {
  $data['featured_status'] = $this->request->post['module_name_status'];
} else {
  $data['featured_status'] = $this->config->get('module_name_status');
}

Note : If during upgrade your modules you will find cheap football kits a new change not described here. I will add it in blog.

Open Cart Tutorial

 

Introduction to MVC-L

 

OpenCart is an excellent platform for developers looking to understand PHP web frameworks in general. It is one of the easiest to follow MVC structured applications available. OpenCart allows you to learn the MVC framework while giving you access to the familiar PHP, mySQL and HTML technologies on which it is built. This guide will assume a basic understanding of HTML, CSS, Javascript, PHP (including classes and inheritance), and mySQL, and will describe how these are used in the OpenCart system.

MVC(L)

OpenCart is designed to follow an MVC design pattern. The components of MVC (Model View Controller) can be broken down as follows.

M - Model
This is where you will interact directly with your database, pulling data out and restructuring it to a format that is suitable for your frontend. This will usually mainly consist of DB queries, and little more. If you are used to writing mySQL queries, you will enjoy the way OpenCart provides access to continue to do just that. OpenCart does not use an ORM, but allows you to write direct database queries.

V - View
This is the display side of the MVC pattern. The idea of the M and C is to pull as much logic out of the view as possible, meaning simpler templates. In order to redesign your whole store, you simply modify the View component, the M, C and L would remain the same. The view files in OpenCart have the .tpl suffix.

C - Controller
This is where you will pull together the data from the Model, any config settings saved with your install or modules, and then render it by choosing the appropriate View file(s).

L - Language
OpenCart extends MVC to MVCL, providing an easy way of separating language specific information for internationalization. You can use language files to store any text like headings, titles, button text, etc., so that you only need to adjust one file per language to provide translations of your store.

Directory structure
The OpenCart directory structure is based around two important parts of the OpenCart application.
The frontend and the admin interface are each represented by a folder in the top level of your OpenCart installation. The frontend folder is called catalog/ and the admin folder is called admin/. If you are making modifications only to the admin of an OpenCart store, you should not expect to modify any file within the catalog/ folder. If you are working on the frontend only, you should not be modifying the admin/ folder at all.
Within each of the admin/ and catalog/ folders, you will find a folder for each of the Model, View, Controller and Language components of the OpenCart application.
Several other folders exist in your OpenCart installation.
The system folder contains classes and functions used by both the admin and catalog areas of your store. Within this folder are email helpers, database helpers, the core definition of controllers, models and other parts of the OpenCart engine and library classes. When modifying OpenCart functionality, you will seldom need to edit any of the system files.
The image folder contains all the images that are uploaded via the Image manager. These are your product images, additional images, and the cached versions of images that OpenCart has resized.
The download folder contains any downloads associated with products. Downloads are given a hashed suffix to avoid malicious users guessing the filenames correctly and accessing your downloads directly. This is why you will see random strings on the end of your download filenames in this directory.

 

Developing modules

 

Writing OpenCart modules can be a very good way to learn how the fundamentals of OpenCart actually work. Just as the rest of OpenCart, modules follow the MVCL design pattern. This documentation guide will describe how you use each of the MVC-L components to create the admin and frontend parts of your module. The easiest way to create a module is to download the DIY Module Builder skeleton from HostJars. This module contains the directory structure, files, and instructions on how to understand and build your own modules. This page is a more theoretical guide.

Basic directory structure
The basic file structure for your module will be divided into two sections, the admin and the catalog folders. The contents of each folder will follow the MVC-L framework respectively, with the difference that the admin will deal solely with backend functionality, and the catalog with frontend functionality. Users of your module will interact and configure its settings in the administration side of the store. Therefore, the files in the admin folder will handle any changes to its settings, the way the module is displayed in the administration, install/uninstalling the module, etc. Likewise, the way the module is displayed and how it works in the front end of the store will be handled by the files in the catalog folder.

The image above displays a skeleton of the directory structure that your module should follow. A good way to get started with your module is to duplicate the folder structure and create the files above. What will go in those files is determined by what your module is trying to accomplish, but the basic functionality is detailed in the sections below.

Admin module functionality
When a store owner uses your module, they will want to edit the module’s configuration options in the admin in order to decide which layouts to display the module on, whether it is enabled or disabled, and any module specific options. As the module developer, you will need to create the admin page where the module may be edited and the configuration options added or adjusted.
All admin files are located in the admin/ folder. You will find four folders within the admin/ folder:

  1. controller
  2. view
  3. language
  4. model

All modules will require at least a single file in each of the view and controller folders. Most will require a file in each of the model and language folders. Usually the files have the same name, except the view file has a different suffix (.tpl). We will go through these files one by one.

Controller

The first file you make will be the controller for your module’s admin interface page. OpenCart identifies existing modules automatically, simply by reading the admin/controller/module folder of your store. Any modules existing in this folder will automatically be shown on the Modules page, and on the User Permissions, page. You may call your controller file my_module.php.
The controller file is the place where you can load the language files to convert text into variables to be utilized in the template file. In the diagram above, you can see the $_[‘text’] variable being handled by the controller, then sent as $text to the view. You will also utilize multiple model files and their class functions here, including your module’s model file if it has one. For more information on loading files see Loading files in the controller.
You may also have a function defined as public function install(). This function will be triggered when the install link is clicked on the Extensions > Modules page. Similarly, a function defined as public function uninstall() will be triggered when the uninstall link is clicked. You can use these functions to create and remove any structures (such as database tables or config settings) required by your module. It is good practice to create an uninstall function to clean up any changes your module has made. To see the specific code for an install(), uninstall(), visit Install/Uninstall a module.

Accessed via URL

The controller is the only file in the MVC-L framework to be accessed by URL in OpenCart. In the administration, the URL will look like /admin/index.php?route=module/my_module&token. The admin adds a token to the URL, whereas the link in the catalog will not have it. As a result, the controller file will have a function defined as public function index(). This is a publicly accessible ‘page’ that is loaded by the URL, which will be shown when the Edit button is clicked, and where the view form will submit to. The submitted data will be processed in this function and saved to the `settings` database table through the controller’s config object.

View
The second required file for your module’s admin interface is the view file. This will be created in the admin/view/template/module folder, and will have the suffix .tpl. This is standard for OpenCart view files. In this file you will create a form for the user to fill out and submit. It will be submitted to the module controller’s index function. The easiest way to create your view file is to copy and paste an existing, similar view file, and edit the form to contain the correct fields for your module’s configuration options. You may call your view file my_module.tpl.
In the view, you will be able to access the text from the language that the controller file stored as a PHP variable. See Loading Files in the Controller for the code on how to do so.

Model

It is uncommon for modules to require a model file on the admin side. However, if your module relies on its own database table, or a custom query to create data of a particular format, then you may find yourself writing a model file. An example of this may be if you are writing a visitor counter module, where each visitor is stored in a database table with their IP address and number of visits. You may then create a model file, with a function to define and create this extra table in the OpenCart database. The model file will live in the admin/model/module folder. You may call your model file my_module.php, the same as your controller and language files.

Frontend module functionality

The frontend of your module follows the same pattern as the admin interface just described. What you will include in each of your frontend files will largely depend on what your module is supposed to do. A module can access any model files that already exist in OpenCart, you do not need to write your own database queries if the same query already exists. For example, the catalog/product model contains many useful queries for fetching products. Using these model functions should be preferred over reinventing the wheel.
A key difference in the frontend of your module, is that your view file will be in the catalog/view/theme//template/module folder. This is a significantly deeper folder structure to the admin view file because of themes.
On the frontend part of your module you will have access to the configuration options saved by your module, through both the controller’s config object, and the $settings variable passed to the module controller’s index function. You can control aspects of the frontend display on the basis of these settings.

 

Install/Uninstall a module

 

It is recommended that developers include an install and uninstall function for their modules in the controller file. Within these functions we will need to load the necessary model files for a clean install/uninstall. To learn how to load a file in the controller, see Loading files in the controller.

Install:

The first thing we will include within the install function, are calls to any functions from the model where tables are created in the db. Secondly, we will want to enable the module for OpenCart with the install. Therefore, install function should loosely follow the code below:

public function install() {
       $this->load->model('module/my_module');
       $this->model_feed_my_module->createTable(); 
       $this->load->model('setting/setting');
       $this->model_setting_setting->editSetting('my_module', array('my_module_status'=>1));
   }

Uninstall:

The uninstall function should loosely follow the code below:

public function uninstall() {
        $this->load->model('module/my_module');
        $this->model_feed_my_module->deleteTable();
         
        $this->load->model('setting/setting');
        $this->model_setting_setting->editSetting('my_module', array('my_module_status'=>0));
    }

If we created a table in the db from a function in the model for the install, we will need to load another function from the model that removes the table when uninstalled. Also, we will want to disable the status of the module when uninstalled.

 

Developing new product feeds

 

OpenCart includes several useful Product Feeds in the core, but you may find you require a custom format and decide to create your own. Writing OpenCart product feeds is very similar to writing OpenCart modules, and can be a very good way to learn how the fundamentals of OpenCart actually work. Just as the rest of OpenCart, feeds follow the MVCL design pattern. This documentation guide will describe how you use each of the MVCL components to create the admin and frontend parts of your product feed.

Admin feed functionality

When a store owner uses your product feed, they will want to edit the product feed’s configuration options in the admin in order to select whether it is enabled or disabled and any specific options you make available. As the developer, you will need to create the admin page where the product feed may be edited.
All admin files are located in the admin/ folder. You will find four folders within the admin/ folder:

  1. controller
  2. view
  3. language
  4. model

All product feeds will require at least a single file in each of the view and controller folders. Some will require a file in each of the model and language folders. Usually the files have the same name, except the view file has a different suffix (.tpl). We will go through these files one by one.

Controller

The first file you make will be the controller for your product feed’s admin interface page. OpenCart identifies existing product feeds automatically, simply by reading the admin/controller/feeds folder of your store. Any product feed files existing in this folder will automatically be shown on the Product Feeds page, and on the User Permissions, page. You may call your controller file my_feed.php.
The controller file will have a function defined as public function index(). This is a publicly accessible ‘page’, which will be shown when the Edit button is clicked, and where the view form will submit to. The submitted data will be processed in this function and saved to the `settings` database table through the controller’s config object.
You may also have a function defined as public function install(). This function will be triggered when the install link is clicked on the Extensions > feeds page. Similarly, a function defined as public function uninstall() will be triggered when the uninstall link is clicked. You can use these functions to create and remove any structures (such as database tables or config settings) required by your feed. It is good practice to create an uninstall function to clean up any changes your feed has made.

View

The second required file for your feed’s admin interface is the view file. This will be created in the admin/view/template/feed folder, and will have the suffix .tpl. This is standard for OpenCart view files. In this file you will create a form for the user to fill out and submit. It will be submitted to the feed controller’s index function. The easiest way to create your view file is to copy and paste an existing, similar view file, and edit the form to contain the correct fields for your feed’s configuration options. You may call your view file my_feed.tpl.

Language

The third file you will usually create for any feed is the language file(s). You will need Cheap AC Milan football shirts one language file per language that your feed is compatible with. The language file will live in the admin/language//feed folder. It simply contains a PHP associative array called $_, which contains the internal name as the key and the translation as the value. You may call your language file my_feed.php, the same as your controller and model files.

Model

It is uncommon for feeds to require a model file on the admin side. However, if your feed relies on its own database table, or a custom query to create data of a particular format, then you may find yourself writing a model file. An example of this may be if you are writing a visitor counter feed, where each visitor is stored in a database table with their IP address and number of visits. You may then create a model file, with a function to define and create this extra table in the OpenCart database. The model file will live in the admin/model/feed folder. You may call your model file my_feed.php, the same as your controller and language files.

Frontend feed functionality

The frontend of your feed follows the same pattern as the admin interface just described. What you will include in each of your frontend files will largely depend on what your feed is supposed to do. A feed can access any model files that already exist in OpenCart, you do not need to write your own database queries if the same query already exists. For example, the catalog/product model contains many useful queries for fetching products. Using these model functions should be preferred over reinventing the wheel.
A key difference in the frontend of your feed, is that your view file will be in the catalog/view/theme//template/feed folder. This is a significantly deeper folder structure to the admin view file because of themes. An OpenCart store may have many different frontend themes available, but only one admin template.
On the frontend part of your feed you will have access to the configuration options saved by your feed, through both the controller’s config object, and the $settings variable passed to the feed controller’s index function. You can control aspects of the frontend display on the basis of these settings.

 

Loading files in the controller

 

In OpenCart’s MVC-L framework, your module’s controller is the glue connecting your the language, model, and template files to each other. The controller is responsible for grabbing the text contained in the language file and making them accessible as PHP variables in Cheap Barcelona football shirts the view’s template file. In addition to inheriting the functions available in the controller’s parent class, Controller, you can also load any of OpenCart’s default model files and their functions in the controller. In this documentation, we will show the PHP code needed to load language and model files and their functions.

Loading the language file

The controller brings the text stored in the language file, and turns them into variables that can be echoed in the template file to displayed text. This is especially useful for managing translations of your module. Instead of modifying your .tpl file every time you have a new translation to change each piece of text inside, you just need to modify the text in your language file, and the variables will remain the same in the controller and the template.
The piece of code below will load the language file inside in your module’s controller. Inside the parentheses you will need to include the path to the language file from inside the language folder.

$this->load->language('module/my_module');

It is important to remember that the admin controller will only load the admin language file, but not the catalog language file; and likewise the catalog controller will only load the catalog language file. Once the language file is loaded into the controller, you can store its text into a php variable with the use of the $data array. The $this->language->get('text') will grab the text from the $_['text'] variable inside of the language file.

// for opencart version below than 2.x.x.x
$this->data['text'] = $this->language->get('text');

//for opencart version 2.x.x.x + 
$data['text'] = $this->language->get('text');

The $this->language->get(‘text’) will grab the text from the $_[‘text’] variable inside of the language file we just loaded above. Every element of the data array will be converted into its own variable. The $data[‘text’] will become $text for the template file inside view. The $text variable can be echoed in the view’s .tpl file wherever needed:

<?php echo $text; ?>

Setting the heading title

The following code will set text from the language file as the heading title of the page:

$this->document->setTitle($this->language->get('heading_title'));

This will grab the text for the variable $_['heading_title'] stored in the module’s language file.
If you need the text to be stored as a php session variable, use $this->session->data['text'] instead of $this->data['text'] or $data['text'].

Loading model files

Loading model files into your controller file will allow your module to utilize OpenCart’s built-in functions. The functions inside the model files interact with the store’s database and to add/pull important information for your module. We recommended that you to take advantage of these functions, rather than making your own DB queries. Take some time to explore the model folders in both the admin and catalog files, to see which files may benefit cheap football shirts your module’s purpose. For example, if your module needs to pull product information from the store’s database, it will be useful to load the admin/model/catalog/products.php file, since it already has a multitude of helpful, built-in functions that interact with the store’s products in the database.
Your module can load any model file its controller file using the following code, granted that they are in the same admin or catalog folder as the controller.

$this->load->model('setting/setting');

You will need to specify the path to the file you want to load from the admin cheap football tops folder within the parentheses. The code above will load the settings class so we have access to the functions within the ModelSettingSetting class in our model’s controller file. Use the following format in your code to call a function from a loaded model file:

$this->model_setting_setting->editSetting('my_module', $this->request->post);

The underscores refer to the file designations for model/setting/setting.php. If you have a model file included for your module your code would follow the format mentioned above, since the model file is uploaded to model folder.

$this->load->model(module/my_module.php);
$this->model_module_my_module->myFunction();

The code above will load the my_module.php stored in admin/model/module/my_module.php.
Instead of using spaces in file names for your module, use underscores.

Loading template files
In the controller you will need to load your module’s template file in view. To do so, set $this->template or $data['template'] as so:

$this->template = 'module/my_module.tpl';
or
$data['template'] = 'module/my_module.tpl';

Loading library files

The OpenCart directory contains a collection of library files that can be cheap football kits accessed by both the admin and catalog controller files. These files are located under system/library in the root folder of the OpenCart store. In the code examples seen in loading the language file, both $this->load->language and $this->document give access to functions within the language.php and document.php files in the library folder. If you want to access a function in a library file you need to call it using $this->[insert library file name]->function() in the controller class.

cheap France football shirts  |
cheap France football shirts  |
cheap France football shirts  |
cheap France football shirts  |
cheap France football shirts  |
cheap France football shirts  |
cheap France football shirts  |
cheap France football shirts  |
cheap France football shirts  |
cheap France football shirts  |
cheap France football shirts  |
cheap France football shirts  |
cheap France football shirts  |
cheap France football shirts  |
cheap France football shirts  |
cheap France football shirts  |
cheap France football shirts  |
cheap football shirts  |
cheap football shirts  |
cheap football shirts  |
cheap football shirts  |
cheap football shirts  |
cheap football shirts  |
cheap football shirts  |
cheap football shirts  |
cheap football shirts  |
cheap football shirts  |
cheap football shirts  |
cheap football shirts  |
cheap football shirts  |
cheap football shirts  |
cheap football shirts  |
cheap football shirts  |
cheap football shirts  |
cheap football shirts  |
cheap football shirts  |
cheap football shirts  |
cheap football shirts  |
cheap football shirts  |
cheap football shirts  |
cheap football shirts  |

LESS in OpenCart with LessEngine

What is LESS?

LESS stands short for Leaner CSS. LESS lets you write CSS in a more cheap football kits dynamic and functional manner, using variables and functions. When you write in LESS the code has to be transformed into CSS by a compiler. LESS is dynamic stylesheet language. You can read more about the LESS project and how to write in LESS here – http://lesscss.org/

What is LessEngine for OpenCart?

It is powered by a PHP compiler for LESS, built into the module to make it easy for developers to write and compile code using their OpenCart installation. When writing your LESS files you only need to put them in a server directory of your choice and the module cheap football shirts will automatically compile the LESS code when you visit the website or when you compile on demand from the module settings. There is no need to compile files locally on your computer and then to upload the already compiled CSS to your server.

Why should I use it?
If you are an extension or theme developer for OpenCart and you cheap football tops write LESS, LessEngine is just the tool for you. It allows you to specify input and output directories for your LESS and CSS files, as well as cache directories and directories with imported files. By default, they point to your default OpenCart theme, however, if you are developing a new theme you can always change that. The module will cache LESS files based on their modified time, so no unnecessary compiles Cheap Barcelona football shirts are made. Also, you have the option to get error reporting, in case you have made a syntax error. If you employ a more complex LESS framework using imported files, these files will also be checked for modifications and the main file will be re-compiled, if changes are found. Neat options is also to minify the Cheap Manchester United football shirts output CSS and remove comments in the code.