Archive for the ‘OpenCart’ Category

Sometimes it’ll be better to split the template file into separate files for various things that need to be shown in that page. The most standard way is to use opencart ‘module’ concept and assign it to necessary pages via the admin panel. However, there can be situation where we cannot assign and use opencart modules. In that case, add the code in a separate function in controller and create a new template file for it.

Suppose we want to show similar products in product page without using opencart modules. In that case, create a new file named ‘similar_products.tpl’ and use it in the following way: (more…)

Advertisements

Opencart: Vqmod tutorial

Posted: November 25, 2013 by Sankar Vijayakumar in OpenCart, Php
Tags: , , , , , ,

Opencart

Vqmod stands for ‘Virtual Quick Mod‘, also known as ‘Virtual File modification System‘. It’s used to virtually alter any php or tpl file in OpenCart except the main index.php files. The changes are mentioned in xml files using search/add/replace tags and these files are parsed on page load. The original core files with the xml files’ code injected to it are then executed. The files with injected code can be viewed in vqmod/vqcache folder. Thus the core files are never touched and the opencart version upgrade can be done anytime.

Advantages of Vqmod:

  1. No need to edit the core files.
  2. Fallback to original sourcefiles in case of errors.
  3. Opencart version upgrade can be done easily by replacing core files.
  4. Website Performance never gets affected due to vqmod xml files.
How to install vqmod?

(more…)

Opencart: Add bcc and cc in emails

Posted: August 6, 2013 by Sankar Vijayakumar in OpenCart, Php
Tags: , , , , ,
How to add cc mails in opencart?

Here’s it, just 1 file needs to be modified:

system\library\mail.php

  1. After “protected $to;” add:
    protected $cc;
  2. Below “public function setTo($to) {” function add: (more…)
How to add separate google analytics code for each store?

Here’s it, just 3 files need to be modified:

  1. admin\controller\setting\store.php
    After “$this->data[‘entry_secure’] = $this->language->get(‘entry_secure’);” add:

    $this->data['entry_google_analytics'] = $this->language->get('entry_google_analytics');

    Before “$this->template = ‘setting/store_form.tpl’;” add: (more…)

Use multiple databases in OpenCart

Posted: April 13, 2013 by Sankar Vijayakumar in OpenCart
Tags: , , , , , ,
To use multiple databases in OpenCart (1.5.*), just update 3 files as given below:

  1. Config.php:
    Add:

    //New DB
    define('NEWDB_DRIVER', 'mysql');
    define('NEWDB_HOSTNAME', 'localhost');
    define('NEWDB_USERNAME', 'root');
    define('NEWDB_PASSWORD', 'password');
    define('NEWDB_DATABASE', 'sitename_newdb');
    define('NEWDB_PREFIX', 'ndb');

  2. Index.php:
    Below the current database setup ($db = new DB(DB_DRIVER …) add: (more…)