Post by BrunoMinervino » Tue Sep 12, 2017 9:35 pm

Hello,
I'm trying to use model function in external file, someone can help me?

Code: Select all

<?php

// Configuration
require_once('config.php');

// Startup
require_once(DIR_SYSTEM . 'startup.php');

// Registry
$registry = new Registry();

// Config
$config = new Config();
$config->load('default');
$registry->set('config', $config);

// Loader
$loader = new Loader($registry);
$registry->set('load', $loader);

// Database
$db = new DB(DB_DRIVER, DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE, DB_PORT);
$registry->set('db', $db);

// Model
$model = $loader->model('checkout/order');
$model->addOrderHistory(1, 5, 'History test.', true);
Erros:
Fatal error: Uncaught Error: Call to a member function addOrderHistory() on null in C:\wamp64\www\opencart\test.php on line 27
Error: Call to a member function addOrderHistory() on null in C:\wamp64\www\opencart\test.php on line 27


Posts

Joined
Sun Jan 22, 2012 9:56 am
Who is online

Users browsing this forum: No registered users and 8 guests