Changes in opencart version 2.2.0.0

Opencart 2.2.0.0 has been released. It has a lots of changes. Here, we have mention all the changes.

Changes in files and Structure

  1. Opencart 2.2.0.0 is compatible with composer. Here two version of opencart 2.2.0.0 are available (complied or non-compiled).
  2. There are too much changes in index.php. It has only 22 line of code.
    <?php
    // Version
    define('VERSION', '2.2.0.0');
    
    // Configuration
    if (is_file('config.php')) {
        require_once('config.php');
    }
    
    // Install
    if (!defined('DIR_APPLICATION')) {
        header('Location: install/index.php');
        exit;
    }
    
    // Startup
    require_once(DIR_SYSTEM . 'startup.php');
    
    $application_config = 'catalog';
    
    // Application
    require_once(DIR_SYSTEM . 'framework.php');
    
    
  3.  startup new folder added catalog/controller/startup with following files.
    1. startup.php
    2. session.php
    3. seo_url.php
    4. router.php
    5. maintenance.php
    6. event.php
    7. error.php
  4. event folder added catalog/controller/event with following files.
    1. thmem.php
    2. debug.php
  5.  New class is added system/engine/proxy.php
  6. Cart folder is added under system/library/cart with following files.
    1. weight.php
    2. user.php
    3. tax.php4. length.php
    5. customer.php
    6. currency.php
    7. cart.php
    8. affiliate.php
  7. session folder added system/library/session with following files.
    1.db.php
    2.file.php
  8.  Localisation is now language/en-gb instead of language/english.

 

Changes in Admin area :

  1.  Theme route has been change now admin/index.php?route=theme/theme_default
  2.  Add new payment methods
    1. Lay-Buy
    2. Cardinity
    3. Eway
  3.  New modules added :
    1. Lay-Buy
    2. sagepay

Changes in code :

  1. Link creation has been changed
    from

    $data['href'] => $this->url->link('common/dashboard', 'token=' . $this->session->data['token'], 'SSL');

    to

    $data['href'] => $this->url->link('common/dashboard', 'token=' . $this->session->data['token'], true);

    ssl is included in the constructor of the library : system/library/url.php

    public function __construct($ssl = false) {
  2. Template loading has been changed

    before :

    $this->response->setOutput($this->load->view('catalog/product_form.tpl', $data));

    now :

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

    we do not need to write extension name of template file, it is automatically add. Template render adopter file has been changed now

    before :
    /system/library/template/basic.php

    now :
    /system/library/template.php

    public function render($template) {
    return $this->adaptor->render($template);
    }
  3. Changes in language loading : now you can load the language using $this->load->language('catalog/attribute_group'); instead of $this->language->load('catalog/attribute_group');
  4. Changes in event : Add event
    was

    if (version_compare(VERSION, '2.0.1', '>=')) {
      $this->load->model('extension/event');
      $this->model_extension_event->addEvent('openbay', 'post.admin.product.delete', 'extension/openbay/eventDeleteProduct');
      $this->model_extension_event->addEvent('openbay', 'post.admin.product.edit', 'extension/openbay/eventEditProduct');
    } else {
      $this->load->model('tool/event');
      $this->model_tool_event->addEvent('openbay', 'post.product.delete', 'extension/openbay/eventDeleteProduct');
      $this->model_tool_event->addEvent('openbay', 'post.product.edit', 'extension/openbay/eventEditProduct');
    }

    and now :

    $this->load->model('extension/event');
    $this->model_extension_event->addEvent('openbay', 'admin/model/catalog/product/deleteProduct/before', 'extension/openbay/eventDeleteProduct');
    $this->model_extension_event->addEvent('openbay', 'admin/model/catalog/product/editProduct/before', 'extension/openbay/eventEditProduct');
  5. Changes in event : Delete event
    was

    if (version_compare(VERSION, '2.0.1', '>=')) {
      $this->load->model('extension/event');
      $this->model_extension_event->deleteEvent('openbay');
    } else {
      $this->load->model('tool/event');
      $this->model_tool_event->deleteEvent('openbay');
    }

    and now :

    $this->model_extension_event->deleteEvent('openbay');
  6. Changes in trigger: Adding

    was :

    $this->event->trigger('pre.view.' . str_replace('/', '.', $template), $data);

    now :

    $result = $this->registry->get('event')->trigger('view/' . $route . '/before', array(&$route, &$data))
    Triggers files has been changes. Now triggers are in following files
    
    1. system/engine/loader.php
    2. catalog/model/openbay/etsy_order.php
    3. catalog/model/openbay/ebay_openbay.php
    4. catalog/controller/startup/router.php
    5. admin/controller/startup/router.php
  7. Changes in email validation
    before :

    if (utf8_strlen($email) > 0 && preg_match('/^[^\@]+@.*.[a-z]{2,15}$/i', $email)) {

    now

    if (utf8_strlen($email) > 0 && filter_var($email, FILTER_VALIDATE_EMAIL)) {