{"id":41265,"date":"2016-02-17T14:16:49","date_gmt":"2016-02-17T14:16:49","guid":{"rendered":"http:\/\/webkul.com\/blog\/?p=41265"},"modified":"2016-02-17T14:22:41","modified_gmt":"2016-02-17T14:22:41","slug":"how-to-create-multi-layout-module-in-opencart","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/how-to-create-multi-layout-module-in-opencart\/","title":{"rendered":"How to create multi-layout module in opencart"},"content":{"rendered":"<p>Here, I&#8217;m going to explain the procedure to create the\u00a0multi-layout module in opencart. With the need of putting the same module with different data on\u00a0different layouts, there emerges a need for creating a multi-layout module. Here, I will discuss the procedure as well as code for creating a demo multi-layout module.<\/p>\n<p>We will start with the creation of files at admin side&#8217;s controller, language and view folders.<\/p>\n<p>First, we will create a controller file named multi_mod.php in admin&gt;controller&gt;module.<\/p>\n<p>The code for the multi-layout mod will be:<\/p>\n<pre class=\"brush:php\">&lt;?php\r\nclass ControllerModuleMultimod extends Controller {\r\n\tprivate $error = array();\r\n\r\n\tpublic function index() {\r\n\t\t$this-&gt;load-&gt;language('module\/multi_mod'); \/\/ load the language\r\n\r\n\t\t$this-&gt;document-&gt;setTitle($this-&gt;language-&gt;get('heading_title'));\r\n\r\n\t\t$this-&gt;load-&gt;model('extension\/module'); \/\/ loads the model\r\n\r\n\t\tif (($this-&gt;request-&gt;server['REQUEST_METHOD'] == 'POST') &amp;&amp; $this-&gt;validate()) {\r\n\t\t\tif (!isset($this-&gt;request-&gt;get['module_id'])) {\r\n\t\t\t\t$this-&gt;model_extension_module-&gt;addModule('multi_mod', $this-&gt;request-&gt;post);\/\/ adds a new module\r\n\t\t\t} else {\r\n\t\t\t\t$this-&gt;model_extension_module-&gt;editModule($this-&gt;request-&gt;get['module_id'], $this-&gt;request-&gt;post);\/\/ edits a pre-existing module\r\n\t\t\t}\r\n\r\n\t\t\t$this-&gt;session-&gt;data['success'] = $this-&gt;language-&gt;get('text_success');\r\n\r\n\t\t\t$this-&gt;response-&gt;redirect($this-&gt;url-&gt;link('extension\/module', 'token=' . $this-&gt;session-&gt;data['token'], 'SSL'));\r\n\t\t}\r\n\r\n\t\t$data['heading_title'] = $this-&gt;language-&gt;get('heading_title');\r\n\r\n\t\t$data['text_edit'] = $this-&gt;language-&gt;get('text_edit');\r\n\t\t$data['text_enabled'] = $this-&gt;language-&gt;get('text_enabled');\r\n\t\t$data['text_disabled'] = $this-&gt;language-&gt;get('text_disabled');\r\n\r\n\t\t$data['entry_name'] = $this-&gt;language-&gt;get('entry_name');\r\n\t\t$data['entry_message'] = $this-&gt;language-&gt;get('entry_message');\r\n\t\t$data['entry_status'] = $this-&gt;language-&gt;get('entry_status');\r\n\r\n\t\t$data['button_save'] = $this-&gt;language-&gt;get('button_save');\r\n\t\t$data['button_cancel'] = $this-&gt;language-&gt;get('button_cancel');\r\n\r\n\t\tif (isset($this-&gt;error['warning'])) {\r\n\t\t\t$data['error_warning'] = $this-&gt;error['warning'];\r\n\t\t} else {\r\n\t\t\t$data['error_warning'] = '';\r\n\t\t}\r\n\r\n\t\tif (isset($this-&gt;error['name'])) {\r\n\t\t\t$data['error_name'] = $this-&gt;error['name'];\r\n\t\t} else {\r\n\t\t\t$data['error_name'] = '';\r\n\t\t}\r\n\r\n\t\tif (isset($this-&gt;error['message'])) {\r\n\t\t\t$data['error_message'] = $this-&gt;error['message'];\r\n\t\t} else {\r\n\t\t\t$data['error_message'] = '';\r\n\t\t}\r\n\r\n\t\t$data['breadcrumbs'] = array();\r\n\r\n\t\t$data['breadcrumbs'][] = array(\r\n\t\t\t'text' =&gt; $this-&gt;language-&gt;get('text_home'),\r\n\t\t\t'href' =&gt; $this-&gt;url-&gt;link('common\/dashboard', 'token=' . $this-&gt;session-&gt;data['token'], 'SSL')\r\n\t\t);\r\n\r\n\t\t$data['breadcrumbs'][] = array(\r\n\t\t\t'text' =&gt; $this-&gt;language-&gt;get('text_module'),\r\n\t\t\t'href' =&gt; $this-&gt;url-&gt;link('extension\/module', 'token=' . $this-&gt;session-&gt;data['token'], 'SSL')\r\n\t\t);\r\n\r\n\t\tif (!isset($this-&gt;request-&gt;get['module_id'])) {\r\n\t\t\t$data['breadcrumbs'][] = array(\r\n\t\t\t\t'text' =&gt; $this-&gt;language-&gt;get('heading_title'),\r\n\t\t\t\t'href' =&gt; $this-&gt;url-&gt;link('module\/multi_mod', 'token=' . $this-&gt;session-&gt;data['token'], 'SSL')\r\n\t\t\t);\r\n\t\t} else {\r\n\t\t\t$data['breadcrumbs'][] = array(\r\n\t\t\t\t'text' =&gt; $this-&gt;language-&gt;get('heading_title'),\r\n\t\t\t\t'href' =&gt; $this-&gt;url-&gt;link('module\/multi_mod', 'token=' . $this-&gt;session-&gt;data['token'] . '&amp;module_id=' . $this-&gt;request-&gt;get['module_id'], 'SSL')\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\tif (!isset($this-&gt;request-&gt;get['module_id'])) {\r\n\t\t\t$data['action'] = $this-&gt;url-&gt;link('module\/multi_mod', 'token=' . $this-&gt;session-&gt;data['token'], 'SSL');\r\n\t\t} else {\r\n\t\t\t$data['action'] = $this-&gt;url-&gt;link('module\/multi_mod', 'token=' . $this-&gt;session-&gt;data['token'] . '&amp;module_id=' . $this-&gt;request-&gt;get['module_id'], 'SSL');\r\n\t\t}\r\n\r\n\t\t$data['cancel'] = $this-&gt;url-&gt;link('extension\/module', 'token=' . $this-&gt;session-&gt;data['token'], 'SSL');\r\n\r\n\t\tif (isset($this-&gt;request-&gt;get['module_id']) &amp;&amp; ($this-&gt;request-&gt;server['REQUEST_METHOD'] != 'POST')) {\r\n\t\t\t$module_info = $this-&gt;model_extension_module-&gt;getModule($this-&gt;request-&gt;get['module_id']);\r\n\t\t}\r\n\r\n\t\tif (isset($this-&gt;request-&gt;post['name'])) {\r\n\t\t\t$data['name'] = $this-&gt;request-&gt;post['name'];\r\n\t\t} elseif (!empty($module_info)) {\r\n\t\t\t$data['name'] = $module_info['name'];\r\n\t\t} else {\r\n\t\t\t$data['name'] = '';\r\n\t\t}\r\n\r\n\t\tif (isset($this-&gt;request-&gt;post['message'])) {\r\n\t\t\t$data['message'] = $this-&gt;request-&gt;post['message'];\r\n\t\t} elseif (!empty($module_info)) {\r\n\t\t\t$data['message'] = $module_info['message'];\r\n\t\t} else {\r\n\t\t\t$data['message'] = '';\r\n\t\t}\r\n\r\n\t\tif (isset($this-&gt;request-&gt;post['status'])) {\r\n\t\t\t$data['status'] = $this-&gt;request-&gt;post['status'];\r\n\t\t} elseif (!empty($module_info)) {\r\n\t\t\t$data['status'] = $module_info['status'];\r\n\t\t} else {\r\n\t\t\t$data['status'] = '';\r\n\t\t}\r\n\r\n\t\t$data['header'] = $this-&gt;load-&gt;controller('common\/header');\r\n\t\t$data['column_left'] = $this-&gt;load-&gt;controller('common\/column_left');\r\n\t\t$data['footer'] = $this-&gt;load-&gt;controller('common\/footer');\r\n\r\n\t\t$this-&gt;response-&gt;setOutput($this-&gt;load-&gt;view('module\/multi_mod.tpl', $data));\r\n\t}\r\n\r\n\tprotected function validate() {\r\n\t\tif (!$this-&gt;user-&gt;hasPermission('modify', 'module\/multi_mod')) {\r\n\t\t\t$this-&gt;error['warning'] = $this-&gt;language-&gt;get('error_permission');\r\n\t\t}\r\n\r\n\t\tif ((utf8_strlen($this-&gt;request-&gt;post['name']) &lt; 3) || (utf8_strlen($this-&gt;request-&gt;post['name']) &gt; 64)) {\r\n\t\t\t$this-&gt;error['name'] = $this-&gt;language-&gt;get('error_name');\r\n\t\t}\r\n\r\n\t\tif (!$this-&gt;request-&gt;post['message']) {\r\n\t\t\t$this-&gt;error['message'] = $this-&gt;language-&gt;get('error_message');\r\n\t\t}\r\n\r\n\t\treturn !$this-&gt;error;\r\n\t}\r\n}<\/pre>\n<p>We have to create language and view file in parallel.<\/p>\n<p>The language file will be created as multi_mod.php\u00a0in admin&gt;language&gt;english&gt;module as below.<\/p>\n<pre class=\"brush:php\">&lt;?php\r\n\/\/ Heading\r\n$_['heading_title']    = 'Multi Mod';\r\n\r\n\/\/ Text\r\n$_['text_module']      = 'Modules';\r\n$_['text_success']     = 'Success: You have modified Multi Mod module!';\r\n$_['text_edit']        = 'Edit Multi Mod Module';\r\n\r\n\/\/ Entry\r\n$_['entry_name']       = 'Module Name';\r\n$_['entry_message']    = 'Message';\r\n$_['entry_status']     = 'Status';\r\n\r\n\/\/ Error\r\n$_['error_permission'] = 'Warning: You do not have permission to modify Multi Mod module!';\r\n$_['error_name']       = 'Module Name must be between 3 and 64 characters!';\r\n$_['error_message']    = 'Message required!';<\/pre>\n<p>The view file at admin side will be created with name multi_mod.tpl at admin&gt;view&gt;template&gt;module as below:<\/p>\n<pre class=\"brush:xml\">&lt;?php echo $header; ?&gt;&lt;?php echo $column_left; ?&gt;\r\n&lt;div id=\"content\"&gt;\r\n  &lt;div class=\"page-header\"&gt;\r\n    &lt;div class=\"container-fluid\"&gt;\r\n      &lt;div class=\"pull-right\"&gt;\r\n        &lt;button type=\"submit\" form=\"form-multi_mod\" data-toggle=\"tooltip\" title=\"&lt;?php echo $button_save; ?&gt;\" class=\"btn btn-primary\"&gt;&lt;i class=\"fa fa-save\"&gt;&lt;\/i&gt;&lt;\/button&gt;\r\n        &lt;a href=\"&lt;?php echo $cancel; ?&gt;\" data-toggle=\"tooltip\" title=\"&lt;?php echo $button_cancel; ?&gt;\" class=\"btn btn-default\"&gt;&lt;i class=\"fa fa-reply\"&gt;&lt;\/i&gt;&lt;\/a&gt;&lt;\/div&gt;\r\n      &lt;h1&gt;&lt;?php echo $heading_title; ?&gt;&lt;\/h1&gt;\r\n      &lt;ul class=\"breadcrumb\"&gt;\r\n        &lt;?php foreach ($breadcrumbs as $breadcrumb) { ?&gt;\r\n        &lt;li&gt;&lt;a href=\"&lt;?php echo $breadcrumb['href']; ?&gt;\"&gt;&lt;?php echo $breadcrumb['text']; ?&gt;&lt;\/a&gt;&lt;\/li&gt;\r\n        &lt;?php } ?&gt;\r\n      &lt;\/ul&gt;\r\n    &lt;\/div&gt;\r\n  &lt;\/div&gt;\r\n  &lt;div class=\"container-fluid\"&gt;\r\n    &lt;?php if ($error_warning) { ?&gt;\r\n    &lt;div class=\"alert alert-danger\"&gt;&lt;i class=\"fa fa-exclamation-circle\"&gt;&lt;\/i&gt; &lt;?php echo $error_warning; ?&gt;\r\n      &lt;button type=\"button\" class=\"close\" data-dismiss=\"alert\"&gt;&amp;times;&lt;\/button&gt;\r\n    &lt;\/div&gt;\r\n    &lt;?php } ?&gt;\r\n    &lt;div class=\"panel panel-default\"&gt;\r\n      &lt;div class=\"panel-heading\"&gt;\r\n        &lt;h3 class=\"panel-title\"&gt;&lt;i class=\"fa fa-pencil\"&gt;&lt;\/i&gt; &lt;?php echo $text_edit; ?&gt;&lt;\/h3&gt;\r\n      &lt;\/div&gt;\r\n      &lt;div class=\"panel-body\"&gt;\r\n        &lt;form action=\"&lt;?php echo $action; ?&gt;\" method=\"post\" enctype=\"multipart\/form-data\" id=\"form-multi_mod\" class=\"form-horizontal\"&gt;\r\n          &lt;div class=\"form-group\"&gt;\r\n            &lt;label class=\"col-sm-2 control-label\" for=\"input-name\"&gt;&lt;?php echo $entry_name; ?&gt;&lt;\/label&gt;\r\n            &lt;div class=\"col-sm-10\"&gt;\r\n              &lt;input type=\"text\" name=\"name\" value=\"&lt;?php echo $name; ?&gt;\" placeholder=\"&lt;?php echo $entry_name; ?&gt;\" id=\"input-name\" class=\"form-control\" \/&gt;\r\n              &lt;?php if ($error_name) { ?&gt;\r\n              &lt;div class=\"text-danger\"&gt;&lt;?php echo $error_name; ?&gt;&lt;\/div&gt;\r\n              &lt;?php } ?&gt;\r\n            &lt;\/div&gt;\r\n          &lt;\/div&gt;\r\n          &lt;div class=\"form-group\"&gt;\r\n            &lt;label class=\"col-sm-2 control-label\" for=\"input-message\"&gt;&lt;?php echo $entry_message; ?&gt;&lt;\/label&gt;\r\n            &lt;div class=\"col-sm-10\"&gt;\r\n              &lt;textarea name=\"message\" placeholder=\"&lt;?php echo $entry_message; ?&gt;\" id=\"input-message\" class=\"form-control\" \/&gt;&lt;?php echo $message; ?&gt;&lt;\/textarea&gt;\r\n              &lt;?php if ($error_message) { ?&gt;\r\n              &lt;div class=\"text-danger\"&gt;&lt;?php echo $error_message; ?&gt;&lt;\/div&gt;\r\n              &lt;?php } ?&gt;\r\n            &lt;\/div&gt;\r\n          &lt;\/div&gt;\r\n          &lt;div class=\"form-group\"&gt;\r\n            &lt;label class=\"col-sm-2 control-label\" for=\"input-status\"&gt;&lt;?php echo $entry_status; ?&gt;&lt;\/label&gt;\r\n            &lt;div class=\"col-sm-10\"&gt;\r\n              &lt;select name=\"status\" id=\"input-status\" class=\"form-control\"&gt;\r\n                &lt;?php if ($status) { ?&gt;\r\n                &lt;option value=\"1\" selected=\"selected\"&gt;&lt;?php echo $text_enabled; ?&gt;&lt;\/option&gt;\r\n                &lt;option value=\"0\"&gt;&lt;?php echo $text_disabled; ?&gt;&lt;\/option&gt;\r\n                &lt;?php } else { ?&gt;\r\n                &lt;option value=\"1\"&gt;&lt;?php echo $text_enabled; ?&gt;&lt;\/option&gt;\r\n                &lt;option value=\"0\" selected=\"selected\"&gt;&lt;?php echo $text_disabled; ?&gt;&lt;\/option&gt;\r\n                &lt;?php } ?&gt;\r\n              &lt;\/select&gt;\r\n            &lt;\/div&gt;\r\n          &lt;\/div&gt;\r\n        &lt;\/form&gt;\r\n      &lt;\/div&gt;\r\n    &lt;\/div&gt;\r\n  &lt;\/div&gt;\r\n&lt;\/div&gt;\r\n&lt;?php echo $footer; ?&gt;<\/pre>\n<p>The UI of the module will be as :<\/p>\n<p><img decoding=\"async\" width=\"1064\" height=\"436\" class=\"size-full wp-image-41282\" src=\"http:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/admin-multi-mod.jpg\" alt=\"Admin end Module\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/admin-multi-mod.jpg 1064w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/admin-multi-mod-250x102.jpg 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/admin-multi-mod-300x123.jpg 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/admin-multi-mod-768x315.jpg 768w\" sizes=\"(max-width: 1064px) 100vw, 1064px\" loading=\"lazy\" \/><\/p>\n<p>On saving the module after filling the details, another module will create in the extension\/module. This will be visible as:<\/p>\n<p><img decoding=\"async\" class=\"size-full wp-image-41282\" src=\"http:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/sub-module.jpg\" alt=\"Sub-Module\" width=\"1064\" height=\"436\" loading=\"lazy\" \/><\/p>\n<p>Now, we have to set the module to some layout. Here, we are setting the module on the home layout.<\/p>\n<p><img decoding=\"async\" class=\"size-full wp-image-41299\" src=\"http:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/set-layout.jpg\" alt=\"Set layout to home page\" width=\"1050\" height=\"635\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/set-layout.jpg 1050w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/set-layout-250x151.jpg 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/set-layout-300x181.jpg 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/set-layout-768x464.jpg 768w\" sizes=\"(max-width: 1050px) 100vw, 1050px\" loading=\"lazy\" \/><\/p>\n<p>Now, we have to create the controller and view on the catalog side. So, here&#8217;s the controller and view code for this module.<\/p>\n<p><strong>Controller:<\/strong><\/p>\n<pre class=\"brush:php\">&lt;?php\r\nclass ControllerModuleMultimod extends Controller {\r\n\t\/**\r\n\t * @param  [array] $setting [contains the details filled in the module]\r\n\t * @return [HTML]          [contains the view part of the module]\r\n\t *\/\r\n\tpublic function index($setting) {\r\n\r\n\t\t$data['name'] = $setting['name'];\r\n\t\t$data['message'] = $setting['message'];\r\n\t\t$data['status'] = $setting['status'];\r\n\r\n\t\tif (file_exists(DIR_TEMPLATE . $this-&gt;config-&gt;get('config_template') . '\/template\/module\/multi_mod.tpl')) {\r\n\t\t\treturn $this-&gt;load-&gt;view($this-&gt;config-&gt;get('config_template') . '\/template\/module\/multi_mod.tpl', $data);\r\n\t\t} else {\r\n\t\t\treturn $this-&gt;load-&gt;view('default\/template\/module\/multi_mod.tpl', $data);\r\n\t\t}\r\n\t}\r\n}<\/pre>\n<p><strong>View:<\/strong><\/p>\n<pre class=\"brush:xml\">&lt;?php if ($status) { ?&gt;\r\n\t&lt;h3&gt;&lt;?php echo $name; ?&gt;&lt;\/h3&gt;\r\n\t&lt;p&gt;&lt;?php echo $message; ?&gt;&lt;\/p&gt;\r\n&lt;?php } ?&gt;<\/pre>\n<p>The <strong>output<\/strong> on the home page will be as:<\/p>\n<p><img decoding=\"async\" class=\"size-full wp-image-41301\" src=\"http:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/multi-mod-output.jpg\" alt=\"The output visible on the home page\" width=\"1277\" height=\"591\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/multi-mod-output.jpg 1277w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/multi-mod-output-250x116.jpg 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/multi-mod-output-300x139.jpg 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/multi-mod-output-768x355.jpg 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/multi-mod-output-1200x555.jpg 1200w\" sizes=\"(max-width: 1277px) 100vw, 1277px\" loading=\"lazy\" \/> <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here, I&#8217;m going to explain the procedure to create the\u00a0multi-layout module in opencart. With the need of putting the same module with different data on\u00a0different layouts, there emerges a need for creating a multi-layout module. Here, I will discuss the procedure as well as code for creating a demo multi-layout module. We will start with <a href=\"https:\/\/webkul.com\/blog\/how-to-create-multi-layout-module-in-opencart\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":70,"featured_media":41008,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[41,305],"tags":[2059,2753,2071],"class_list":["post-41265","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-module","category-opencart","tag-module","tag-multi-layout","tag-opencart"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to create multi-layout module in opencart - Webkul Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/how-to-create-multi-layout-module-in-opencart\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to create multi-layout module in opencart - Webkul Blog\" \/>\n<meta property=\"og:description\" content=\"Here, I&#8217;m going to explain the procedure to create the\u00a0multi-layout module in opencart. With the need of putting the same module with different data on\u00a0different layouts, there emerges a need for creating a multi-layout module. Here, I will discuss the procedure as well as code for creating a demo multi-layout module. We will start with [...]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/how-to-create-multi-layout-module-in-opencart\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2016-02-17T14:16:49+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2016-02-17T14:22:41+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/Opencart-Code-Snippet.png\" \/>\n\t<meta property=\"og:image:width\" content=\"825\" \/>\n\t<meta property=\"og:image:height\" content=\"260\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Vikhyat Sharma\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Vikhyat Sharma\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-multi-layout-module-in-opencart\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-multi-layout-module-in-opencart\/\"},\"author\":{\"name\":\"Vikhyat Sharma\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/af7160d2546c64a1856ab1b5ce77d9b0\"},\"headline\":\"How to create multi-layout module in opencart\",\"datePublished\":\"2016-02-17T14:16:49+00:00\",\"dateModified\":\"2016-02-17T14:22:41+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-multi-layout-module-in-opencart\/\"},\"wordCount\":238,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-multi-layout-module-in-opencart\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/Opencart-Code-Snippet.png\",\"keywords\":[\"module\",\"multi-layout\",\"opencart\"],\"articleSection\":[\"module\",\"opencart\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/how-to-create-multi-layout-module-in-opencart\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-multi-layout-module-in-opencart\/\",\"url\":\"https:\/\/webkul.com\/blog\/how-to-create-multi-layout-module-in-opencart\/\",\"name\":\"How to create multi-layout module in opencart - Webkul Blog\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-multi-layout-module-in-opencart\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-multi-layout-module-in-opencart\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/Opencart-Code-Snippet.png\",\"datePublished\":\"2016-02-17T14:16:49+00:00\",\"dateModified\":\"2016-02-17T14:22:41+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-multi-layout-module-in-opencart\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/how-to-create-multi-layout-module-in-opencart\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-multi-layout-module-in-opencart\/#primaryimage\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/Opencart-Code-Snippet.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/Opencart-Code-Snippet.png\",\"width\":825,\"height\":260},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-multi-layout-module-in-opencart\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to create multi-layout module in opencart\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/af7160d2546c64a1856ab1b5ce77d9b0\",\"name\":\"Vikhyat Sharma\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/7c9c700cc2d7120c9faf1ab3392b4e533808ba197f58c0441d6caecc68179e12?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/7c9c700cc2d7120c9faf1ab3392b4e533808ba197f58c0441d6caecc68179e12?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Vikhyat Sharma\"},\"url\":\"https:\/\/webkul.com\/blog\/author\/vikhyat-sharma83\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to create multi-layout module in opencart - Webkul Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/how-to-create-multi-layout-module-in-opencart\/","og_locale":"en_US","og_type":"article","og_title":"How to create multi-layout module in opencart - Webkul Blog","og_description":"Here, I&#8217;m going to explain the procedure to create the\u00a0multi-layout module in opencart. With the need of putting the same module with different data on\u00a0different layouts, there emerges a need for creating a multi-layout module. Here, I will discuss the procedure as well as code for creating a demo multi-layout module. We will start with [...]","og_url":"https:\/\/webkul.com\/blog\/how-to-create-multi-layout-module-in-opencart\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2016-02-17T14:16:49+00:00","article_modified_time":"2016-02-17T14:22:41+00:00","og_image":[{"width":825,"height":260,"url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/Opencart-Code-Snippet.png","type":"image\/png"}],"author":"Vikhyat Sharma","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Vikhyat Sharma","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/how-to-create-multi-layout-module-in-opencart\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/how-to-create-multi-layout-module-in-opencart\/"},"author":{"name":"Vikhyat Sharma","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/af7160d2546c64a1856ab1b5ce77d9b0"},"headline":"How to create multi-layout module in opencart","datePublished":"2016-02-17T14:16:49+00:00","dateModified":"2016-02-17T14:22:41+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/how-to-create-multi-layout-module-in-opencart\/"},"wordCount":238,"commentCount":0,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"image":{"@id":"https:\/\/webkul.com\/blog\/how-to-create-multi-layout-module-in-opencart\/#primaryimage"},"thumbnailUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/Opencart-Code-Snippet.png","keywords":["module","multi-layout","opencart"],"articleSection":["module","opencart"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/how-to-create-multi-layout-module-in-opencart\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/how-to-create-multi-layout-module-in-opencart\/","url":"https:\/\/webkul.com\/blog\/how-to-create-multi-layout-module-in-opencart\/","name":"How to create multi-layout module in opencart - Webkul Blog","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webkul.com\/blog\/how-to-create-multi-layout-module-in-opencart\/#primaryimage"},"image":{"@id":"https:\/\/webkul.com\/blog\/how-to-create-multi-layout-module-in-opencart\/#primaryimage"},"thumbnailUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/Opencart-Code-Snippet.png","datePublished":"2016-02-17T14:16:49+00:00","dateModified":"2016-02-17T14:22:41+00:00","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/how-to-create-multi-layout-module-in-opencart\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/how-to-create-multi-layout-module-in-opencart\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/how-to-create-multi-layout-module-in-opencart\/#primaryimage","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/Opencart-Code-Snippet.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/Opencart-Code-Snippet.png","width":825,"height":260},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/how-to-create-multi-layout-module-in-opencart\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to create multi-layout module in opencart"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/af7160d2546c64a1856ab1b5ce77d9b0","name":"Vikhyat Sharma","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/7c9c700cc2d7120c9faf1ab3392b4e533808ba197f58c0441d6caecc68179e12?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/7c9c700cc2d7120c9faf1ab3392b4e533808ba197f58c0441d6caecc68179e12?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Vikhyat Sharma"},"url":"https:\/\/webkul.com\/blog\/author\/vikhyat-sharma83\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/41265","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/70"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=41265"}],"version-history":[{"count":15,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/41265\/revisions"}],"predecessor-version":[{"id":41305,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/41265\/revisions\/41305"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media\/41008"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=41265"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=41265"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=41265"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}