Adding Website content to your OpenCart store
Posted: Fri Aug 06, 2010 8:53 am
I've seen a couple requests for adding additional website type content to a store front and no modules exist for doing this... so... here is a simple solution:
You'll need to edit
<INSTALL DIR>/catalog/view/theme/default/template/common/header.tpl
first, replace:
<?php echo $heading_title; ?>
with:
<?php if(!isset($_GET['content'])) { echo $heading_title; } ?>
then, replace:
<?php echo $welcome; ?>
with:
<?php
if(isset($_GET['content'])) {
$content = $_GET['content'] . ".php";
include ($content);
} else {
echo $welcome;
}
?>
Now... create some new content:
create a .php file in the same direct as the file you just edited. Add whatever HTML you would like (remember, this is going to display in the content area of the welcome page, so no need for html, head or body tags). Save and close the file. e.x. my_new_content.php
Next, to display the content, using the following query stirng to access the override html:
http://<YOUR URL>/index.php?content=my_new_content
or
http://<YOUR URL>/?content=my_new_content
This will override the standard content of the homepage with whatever content yo would like to add. You can create as many new content pages as you would like, just change the query string appropriately.
Hope someone finds this useful,
Chris
You'll need to edit
<INSTALL DIR>/catalog/view/theme/default/template/common/header.tpl
first, replace:
<?php echo $heading_title; ?>
with:
<?php if(!isset($_GET['content'])) { echo $heading_title; } ?>
then, replace:
<?php echo $welcome; ?>
with:
<?php
if(isset($_GET['content'])) {
$content = $_GET['content'] . ".php";
include ($content);
} else {
echo $welcome;
}
?>
Now... create some new content:
create a .php file in the same direct as the file you just edited. Add whatever HTML you would like (remember, this is going to display in the content area of the welcome page, so no need for html, head or body tags). Save and close the file. e.x. my_new_content.php
Next, to display the content, using the following query stirng to access the override html:
http://<YOUR URL>/index.php?content=my_new_content
or
http://<YOUR URL>/?content=my_new_content
This will override the standard content of the homepage with whatever content yo would like to add. You can create as many new content pages as you would like, just change the query string appropriately.
Hope someone finds this useful,
Chris