Re: Creating a Custom Page in OpenCart
Posted: Sun Feb 10, 2013 8:50 am
if you changed the file name, you need to change references of all 'static' to 'product' so it should be Class ControllerInformationProducts now
OpenCart Community Forum - Discuss shopping cart and e-commerce solutions.
https://forum.opencart.com/
Code: Select all
if (isset($this->request->post['terms'])) { your codes }
got it to work making a minor change, thanks so much!MarketInSG wrote:you are missing thisCode: Select all
if (isset($this->request->post['terms'])) { your codes }
Code: Select all
if (isset($this->request->post['term'])) { your codes }
tophat wrote:Simply amazing. That was easier than I thought.MarketInSG wrote:Add that code into your htaccess file right after the rewrite on part. So to access your page, you can go to yoursite.com/static instead of the long url.Code: Select all
RewriteRule ^static$ index.php?route=information/static
I had to put it directly belowfor it to work, anywhere else it didn't regardeless of other rewrite rules.Code: Select all
RewriteBase /
Thanks again.
Code: Select all
<?php
class ControllerProductWeekly-specials extends Controller {
private $error = array();
public function index() {
$this->language->load('product/weekly-specials'); //Optional. This calls for your language file
$this->document->setTitle($this->language->get('heading_title')); //Optional. Set the title of your web page.
$this->data['breadcrumbs'] = array();
$this->data['breadcrumbs'][] = array(
'text' => $this->language->get('text_home'),
'href' => $this->url->link('common/home'),
'separator' => false
);
$this->data['breadcrumbs'][] = array(
'text' => $this->language->get('heading_title'),
'href' => $this->url->link('product/weekly-specials'),
'separator' => $this->language->get('text_separator')
);
$this->data['heading_title'] = $this->language->get('heading_title'); //Get "heading title" from language file.
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/weekly-specials.tpl')) { //if file exists in your current template folder
$this->template = $this->config->get('config_template') . '/template/product/weekly-specials.tpl'; //get it
} else {
$this->template = 'default/template/product/weekly-specials.tpl'; //or get the file from the default folder
}
$this->children = array( //Required. The children files for the page.
'common/column_left',
'common/column_right',
'common/content_top',
'common/content_bottom',
'common/footer',
'common/header'
);
$this->response->setOutput($this->render());
}
}
?>
Code: Select all
<?php echo $header; ?><?php echo $column_left; ?><?php echo $column_right; ?>
<div id="content"><?php echo $content_top; ?>
<div class="breadcrumb">
<?php foreach ($breadcrumbs as $breadcrumb) { ?>
<?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
<?php } ?>
</div>
<h1><?php echo $heading_title; ?></h1>
<p>My own content</p>
<?php echo $content_bottom; ?></div>
<?php echo $footer; ?>
Code: Select all
<?php
// Heading
$_['heading_title'] = 'Weekly Specials'; //Add as many as you want, but remember to call for it in the controller file before you can use it in the template
?>
Code: Select all
class ControllerProductWeekly-specials extends Controller {