title: How to call model file into controller and view in opencart?
body: <p>I am newer in Open cart frame work. I am working to create custom page with file uploading and direct checkout button(just like shopping cart page.)In this page, i already create <code>(tpl files)</code> view and controller based on contact form.
  Here my controller:</p>
  
  <pre><code>&lt;?php 
  class ControllerInformationRequest extends Controller {
      private $error = array(); 
  
      public function index() {
          $this-&gt;language-&gt;load('information/request');
  
          $this-&gt;document-&gt;setTitle($this-&gt;language-&gt;get('heading_title'));  
          $this-&gt;load-&gt;model('account/request');
  
          if (($this-&gt;request-&gt;server['REQUEST_METHOD'] == 'POST') &amp;&amp; $this-&gt;validate()) {
  
              $this-&gt;redirect($this-&gt;url-&gt;link('information/request/success'));
          }
  
          $this-&gt;data['breadcrumbs'] = array();
  
          $this-&gt;data['breadcrumbs'][] = array(
              'text'      =&gt; $this-&gt;language-&gt;get('text_home'),
              'href'      =&gt; $this-&gt;url-&gt;link('common/home'),         
              'separator' =&gt; false
          );
  
          $this-&gt;data['breadcrumbs'][] = array(
              'text'      =&gt; $this-&gt;language-&gt;get('heading_title'),
              'href'      =&gt; $this-&gt;url-&gt;link('information/request'),
              'separator' =&gt; $this-&gt;language-&gt;get('text_separator')
          );  
  
          $this-&gt;data['heading_title'] = $this-&gt;language-&gt;get('heading_title');
  
          $this-&gt;data['text_location'] = $this-&gt;language-&gt;get('text_location');
          $this-&gt;data['text_contact'] = $this-&gt;language-&gt;get('text_contact');
          $this-&gt;data['text_address'] = $this-&gt;language-&gt;get('text_address');
          $this-&gt;data['text_telephone'] = $this-&gt;language-&gt;get('text_telephone');
          $this-&gt;data['text_fax'] = $this-&gt;language-&gt;get('text_fax');
          $this-&gt;data['entry_name'] = $this-&gt;language-&gt;get('entry_name');
          $this-&gt;data['entry_email'] = $this-&gt;language-&gt;get('entry_email');
          $this-&gt;data['entry_enquiry'] = $this-&gt;language-&gt;get('entry_enquiry');
          $this-&gt;data['entry_captcha'] = $this-&gt;language-&gt;get('entry_captcha');
          $this-&gt;data['entry_phone']  = $this-&gt;language-&gt;get('entry_phone');
  
          if (isset($this-&gt;error['name'])) {
              $this-&gt;data['error_name'] = $this-&gt;error['name'];
          } else {
              $this-&gt;data['error_name'] = '';
          }
          if (isset($this-&gt;error['telephone'])) { 
              $this-&gt;data['error_telephone'] = $this-&gt;error['telephone'];   
          } else {      
               $this-&gt;data['error_telephone'] = '';       
          } 
          if (isset($this-&gt;error['email'])) {
              $this-&gt;data['error_email'] = $this-&gt;error['email'];
          } else {
              $this-&gt;data['error_email'] = '';
          }
          if (isset($this-&gt;error['enquiry'])) {
              $this-&gt;data['error_enquiry'] = $this-&gt;error['enquiry'];
          } else {
              $this-&gt;data['error_enquiry'] = '';
          }       
  
          if (isset($this-&gt;error['captcha'])) {
              $this-&gt;data['error_captcha'] = $this-&gt;error['captcha'];
          } else {
              $this-&gt;data['error_captcha'] = '';
          }   
  
          $this-&gt;data['button_continue'] = $this-&gt;language-&gt;get('button_continue');
  
          $this-&gt;data['action'] = $this-&gt;url-&gt;link('information/request');
          $this-&gt;data['store'] = $this-&gt;config-&gt;get('config_name');
          $this-&gt;data['address'] = nl2br($this-&gt;config-&gt;get('config_address'));
          $this-&gt;data['telephone'] = $this-&gt;config-&gt;get('config_telephone');
          $this-&gt;data['fax'] = $this-&gt;config-&gt;get('config_fax');
  
          if (isset($this-&gt;request-&gt;post['name'])) {
              $this-&gt;data['name'] = $this-&gt;request-&gt;post['name'];
          } else {
              $this-&gt;data['name'] = $this-&gt;customer-&gt;getFirstName();
          }
  
          if (isset($this-&gt;request-&gt;post['email'])) {
              $this-&gt;data['email'] = $this-&gt;request-&gt;post['email'];
          } else {
              $this-&gt;data['email'] = $this-&gt;customer-&gt;getEmail();
          }
  
          if (isset($this-&gt;request-&gt;post['telephone'])) {
              $this-&gt;data['telephone'] = $this-&gt;request-&gt;post['telephone'];
          } else {
              //$this-&gt;data['phone'] = $this-&gt;customer-&gt;getPhone();
              $this-&gt;data['telephone'] = $this-&gt;customer-&gt;getTelephone();
          }
          if (isset($this-&gt;request-&gt;post['enquiry'])) {
              $this-&gt;data['enquiry'] = $this-&gt;request-&gt;post['enquiry'];
          } else {
              $this-&gt;data['enquiry'] = '';
          }
  
          if (isset($this-&gt;request-&gt;post['captcha'])) {
              $this-&gt;data['captcha'] = $this-&gt;request-&gt;post['captcha'];
          } else {
              $this-&gt;data['captcha'] = '';
          }       
  
          if (file_exists(DIR_TEMPLATE . $this-&gt;config-&gt;get('config_template') . '/template/information/request.tpl')) {
              $this-&gt;template = $this-&gt;config-&gt;get('config_template') . '/template/information/request.tpl';
          } else {
              $this-&gt;template = 'default/template/information/request.tpl';
          }
          $this-&gt;load-&gt;model('account/request');
          $this-&gt;children = array(
              'common/column_left',
              'common/column_right',
              'common/content_top',
              'common/content_bottom',
              'common/footer',
              'common/header'
          );
  
          $this-&gt;response-&gt;setOutput($this-&gt;render());        
      }
  
      public function success() {
          $this-&gt;language-&gt;load('information/request');
  
          $this-&gt;document-&gt;setTitle($this-&gt;language-&gt;get('heading_title')); 
  
          $this-&gt;data['breadcrumbs'] = array();
  
          $this-&gt;data['breadcrumbs'][] = array(
              'text'      =&gt; $this-&gt;language-&gt;get('text_home'),
              'href'      =&gt; $this-&gt;url-&gt;link('common/home'),
              'separator' =&gt; false
          );
  
          $this-&gt;data['breadcrumbs'][] = array(
              'text'      =&gt; $this-&gt;language-&gt;get('heading_title'),
              'href'      =&gt; $this-&gt;url-&gt;link('information/request'),
              'separator' =&gt; $this-&gt;language-&gt;get('text_separator')
          );  
  
          $this-&gt;data['heading_title'] = $this-&gt;language-&gt;get('heading_title');
  
          $this-&gt;data['text_message'] = $this-&gt;language-&gt;get('text_message');
  
          $this-&gt;data['button_continue'] = $this-&gt;language-&gt;get('button_continue');
  
          $this-&gt;data['continue'] = $this-&gt;url-&gt;link('common/home');
  
          if (file_exists(DIR_TEMPLATE . $this-&gt;config-&gt;get('config_template') . '/template/common/success.tpl')) {
              $this-&gt;template = $this-&gt;config-&gt;get('config_template') . '/template/common/success.tpl';
          } else {
              $this-&gt;template = 'default/template/common/success.tpl';
          }
  
          $this-&gt;children = array(
              'common/column_left',
              'common/column_right',
              'common/content_top',
              'common/content_bottom',
              'common/footer',
              'common/header'
          );
  
          $this-&gt;response-&gt;setOutput($this-&gt;render()); 
      }
  
      private function validate() {
          if ((utf8_strlen($this-&gt;request-&gt;post['name']) &lt; 3) || (utf8_strlen($this-&gt;request-&gt;post['name']) &gt; 32)) {
              $this-&gt;error['name'] = $this-&gt;language-&gt;get('error_name');
          }
  
          if (!preg_match('/^[^\@]+@.*\.[a-z]{2,6}$/i', $this-&gt;request-&gt;post['email'])) {
              $this-&gt;error['email'] = $this-&gt;language-&gt;get('error_email');
          }
  
          if ((utf8_strlen($this-&gt;request-&gt;post['enquiry']) &lt; 10) || (utf8_strlen($this-&gt;request-&gt;post['enquiry']) &gt; 3000)) {
              $this-&gt;error['enquiry'] = $this-&gt;language-&gt;get('error_enquiry');
          }
  
          if (empty($this-&gt;session-&gt;data['captcha']) || ($this-&gt;session-&gt;data['captcha'] != $this-&gt;request-&gt;post['captcha'])) {
              $this-&gt;error['captcha'] = $this-&gt;language-&gt;get('error_captcha');
          }
  
          if (!$this-&gt;error) {
              return true;
          } else {
              return false;
          }     
      }
  
      public function captcha() {
          $this-&gt;load-&gt;library('captcha');
  
          $captcha = new Captcha();
  
          $this-&gt;session-&gt;data['captcha'] = $captcha-&gt;getCode();
  
          $captcha-&gt;showImage();
      }   
  }
  ?&gt;
  </code></pre>
  
  <p>In view <code>.tpl</code> files contain name,Email address, phone,message and captcha images.I just want to stored that data into database,I already create model file in particular locations,
  How to call model file (<code>$this-&gt;load-&gt;model('account/request');</code>)...its doesn<code>t working and its can</code>t stored database also.How is it possible ?please provide me solutions for this....</p>