How to Create a Custom Page in OpenCart 3 - Kvcodes
X

Congrats, You are Subscribed to Receive Updates.

How to Create a Custom Page in OpenCart 3


Introduction

After a long gap, A new article about Opencart. How to Create a Custom Page in OpenCart 3.  Sometimes an updated version has something different from the previous codes. Since there are many page creation tutorials and other stuffs available to create custom page for opencart. But for the recent version Opencart 3 has something different. Here is my codes I just tried to make one custom page for Opencart 3.

 

Steps

Create folder structure for Controller and Language layer. Here I am not creating the View file to show you the results. Without View file it could work. That’s the advantage of new Opencart.

Controller: catalog/controller/kvcodes/blog.php And your blog.php controller code should be

<?php
 class ControllerKvcodesBlog extends Controller {
 	public function index() {
 		$this->language->load('kvcodes/blog');

		$this->document->setTitle($this->language->get('heading_title'));

		$data['breadcrumbs'] = array();

		$data['breadcrumbs'][] = array(
 		   'text' => $this->language->get('text_home'),
 		   'href' => $this->url->link('common/home')
 		);

		$data['breadcrumbs'][] = array(
 		  'text' => $this->language->get('kvcodes'),
 		  'href' => $this->url->link('kvcodes/kvcodes', '', true)
		);

		$data['breadcrumbs'][] = array(
 		  'text' => $this->language->get('blog'),
 		  'href' => $this->url->link('kvcodes/blog')
 		);

		$data['column_left'] = $this->load->controller('common/column_left');
 		$data['column_right'] = $this->load->controller('common/column_right');
 		$data['content_top'] = $this->load->controller('common/content_top');
 		$data['content_bottom'] = $this->load->controller('common/content_bottom');
 		$data['footer'] = $this->load->controller('common/footer');
 		$data['header'] = $this->load->controller('common/header');

		$this->response->setOutput($this->load->view('common/success', $data));
	}
}?>


Language: catalog/language/en-gb/kvcodes/blog.php  and below the code

<?php
 // Heading
 $_['heading_title'] = 'Kvcodes Blog';
 $_['kvcodes'] = 'Kvcodes';
 $_['blog'] = 'Blog';

//Content
 $_['heading_text'] = 'Blog Heading Text';

// Text
 $_['text_message'] = '<p>Congratulations! You are successfully created a new custom page!</p> <p>This is a tesing page. You can create many pages like this. I hope this will help You to create custom pages in opencart. Read Here for more <a href="http://www.Kvcodes.com"> Kvcodes </a> </p>';
 ?>

Accessing Custom Page.

Modify variable ‘heading_title in language file to set title of page and box. Modify variable ‘heading_text’ in language file and put heading content for your custom page. Modify variable ‘text_message’ in language file and put heading content for your custom page. You can easily create new variables and put more content.

Conclusion,

Put link to your new custom page anywhere you want, in my example it will be: index.php?route=kvcodes/blog and the full url will be like this.

http://www.kvcodes.com/yourstore/index.php?route=kvcodes/blog

 

commenter

About Varadharaj V

The founder of Kvcodes, Varadharaj V is an ERP Analyst and a Web developer specializing in WordPress(WP), WP Theme development, WP Plugin development, Frontaccounting(FA), Sales, Purchases, Inventory, Ledgers, Payroll & HRM, CRM, FA Core Customization, OpenCart Theme Development, PHP, HTML, CSS, jQuery, Bootstrap development and content SEO.

Comment Below

Your email address will not be published. Required fields are marked *

*

Current ye@r *

Menu

Sidebar

Subscribe E-mail Updates

Congrats, You are Subscribed to Receive Updates.

Advertisement

Category Posts