How to start opencart Reviewed by Momizat on . Some important steps to start OpenCart Opencart provide naming conversion for controller,model and view in camel case Like:-Controller(folder)/manish.php [php] Some important steps to start OpenCart Opencart provide naming conversion for controller,model and view in camel case Like:-Controller(folder)/manish.php [php] Rating: 0

How to start opencart

Some important steps to start OpenCart

Opencart provide naming conversion for controller,model and view in camel case Like:-Controller(folder)/manish.php

<?php
class ControllerManish extends Controller {
//---
}
?>

OR

Opencart provide naming conversion for controller,model and view in camel case Like:-Controller(folder)/Test(folder)/test.php

<?php
class ControllerTestTest extends Controller {
//---
}
?>

  • Rename config-dist.php to config.php is missing to installation time
  • select driver for database mysqli or mpdo select mpdo
  • after installation remove install folder
  • controller

    Path–catlog/controller/manish.php

    <?php
    class ControllerManish extends Controller {
    	
    	public function index() {
    	$data['abc']='';
    	//load view
    	$this->response->setOutput($this->load->view('default/template/test/mktest.tpl', $data));
    	}
    	public function name() {
    	//load model
    	$this->load->model('test/test');
    	//get value from model
    	$category_info = $this->model_test_test->getallrecord();
    	$data['abc']=$category_info;
    	$this->response->setOutput($this->load->view('default/template/test/mktest.tpl', $data));
    	}
    }
    ?>
    
  • Model
    Path–catlog/model/test/test.php

    <?php
    class ModelTestTest extends Model {
    	public function getallrecord() {
    		$query = $this->db->query("SELECT * from test");
    		// for multiple records
    		return $query->rows;
    		// for Single records
    		//return $query->row;
    	}
    
    }
    ?>
    
  • View
    Path–catlog/view/theme/default/template/test/mktest.tpl

    <?php echo $header;?>
    manish
    <?php echo "<pre>";print_r($abc);?>
    
  • (.htaccess)
    Options +FollowSymlinks
    Options -Indexes
    <FilesMatch "(?i)((\.tpl|\.ini|\.log|(?<!robots)\.txt))">
     Order deny,allow
     Deny from all
    </FilesMatch>
    
    RewriteBase /opencart/
    RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
    RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
    RewriteRule ^download/(.*) /index.php?route=error/not_found [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
    RewriteRule ^([^?]*) index.php?route=$1 [L,QSA]
    

Leave a Comment

© 2014 Powered By