Page 4 of 6

Re: Creating a Custom Page in OpenCart

Posted: Sun Feb 10, 2013 8:50 am
by MarketInSG
if you changed the file name, you need to change references of all 'static' to 'product' so it should be Class ControllerInformationProducts now

Re: Creating a Custom Page in OpenCart

Posted: Fri Mar 08, 2013 1:27 pm
by sssagar.36
How to show my latest product on custom page. i already created a custom page bt didn't solve these product problem can u plz. tell how can i do that??

Re: Creating a Custom Page in OpenCart

Posted: Fri Mar 08, 2013 5:28 pm
by MarketInSG
use the layouts function in system > design > layouts. And do not PM me for personal support!

Re: Creating a Custom Page in OpenCart

Posted: Mon Apr 01, 2013 11:31 am
by pittsleyb
I got this to work but am getting an error which goes away when you click search. My goal is to have the page load no results until the person enters a search, then display the records matching, also if they hit search without putting anything in i want it to say no results. It seems to work but something needs to be tweaked to stop that error. Here is the link.

http://www.indoorharvestgardens.com/ind ... ion/static

Re: Creating a Custom Page in OpenCart

Posted: Mon Apr 01, 2013 11:35 am
by pittsleyb
Hi I got this to work but when you load the page there is an error and also it will display all the records if you just hit search, can i make the field required and also not get this error?

http://www.indoorharvestgardens.com/ind ... ion/static

Re: Creating a Custom Page in OpenCart

Posted: Mon Apr 01, 2013 6:46 pm
by MarketInSG

Code: Select all

if (isset($this->request->post['terms'])) { your codes }
you are missing this

Re: Creating a Custom Page in OpenCart

Posted: Mon Apr 01, 2013 11:48 pm
by pittsleyb
MarketInSG wrote:

Code: Select all

if (isset($this->request->post['terms'])) { your codes }
you are missing this
got it to work making a minor change, thanks so much!

Code: Select all

if (isset($this->request->post['term'])) { your codes }

Re: Creating a Custom Page in OpenCart

Posted: Tue May 28, 2013 2:23 am
by sarikabtech
useful info .thank you so much .

Re: Creating a Custom Page in OpenCart

Posted: Wed Aug 28, 2013 6:42 am
by rsink
What does it mean if you get the error:
Fatal error: Class 'Controllerinformationstatic' not found in /home/store/public_html/store/vqmod/vqcache/vq2-system_engine_front.php on line 45

Re: Creating a Custom Page in OpenCart

Posted: Wed Aug 28, 2013 10:11 am
by MarketInSG
it means your controller file isn't found. They are looking for Controllerinformationstatic

Re: Creating a Custom Page in OpenCart

Posted: Sun Sep 29, 2013 5:47 am
by frankwho
Awesome tutorial, thank you! The only thing I cannot get to work is this:
tophat wrote:
MarketInSG wrote:

Code: Select all

RewriteRule ^static$ index.php?route=information/static
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.
Simply amazing. That was easier than I thought.

I had to put it directly below

Code: Select all

RewriteBase /
for it to work, anywhere else it didn't regardeless of other rewrite rules.

Thanks again.

Re: Creating a Custom Page in OpenCart

Posted: Sun Sep 29, 2013 10:32 am
by MarketInSG
Is your server apache? And if so, do you have a .htaccess file? Adding that line of code would allow you to access index.php?route=information/static as website.com/static

Re: Creating a Custom Page in OpenCart

Posted: Sun Sep 29, 2013 12:26 pm
by frankwho
Got it! I was thinking it redirected traffic to /static rather than being an alternative.
Would this work for categories as well?

Re: Creating a Custom Page in OpenCart

Posted: Mon Sep 30, 2013 12:10 am
by MarketInSG
categories are routed themselves through the system seo_url.php

Re: Creating a Custom Page in OpenCart

Posted: Tue Oct 15, 2013 6:55 pm
by maccadon
Thanks for the great guide.
I got one question about the HTacces rewrite. Will google see this as 2 pages?

Re: Creating a Custom Page in OpenCart

Posted: Tue Oct 15, 2013 7:22 pm
by MarketInSG
as long as you link the pages properly, they wont

Re: Creating a Custom Page in OpenCart

Posted: Tue Oct 15, 2013 7:44 pm
by maccadon
Your Awesome :) !

Re: Creating a Custom Page in OpenCart

Posted: Fri Nov 15, 2013 10:15 pm
by josee225
Hi,

this is exactly what I was looking for, because I wanted a page called weekly specials, and use the featured module on that page to create a landing page in my store for my weekly specials.

So I went ahead and created the files, but changed all "information/static" to "product/weekly-specials" and of course uploaded the files to the proper /product folders. I created the route in layout and added the Featured module to the route.

I am getting a blank page, so I was hoping you could help me? Thank you for your time!

Here is the code for my files:
controller/product/weekly-specials.php

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());     
         }
    }
    ?>
view/theme/default/template/product/weekly-specials.tpl

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; ?>
language/english/product/weekly-specials.php

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
    ?>

Re: Creating a Custom Page in OpenCart

Posted: Sat Nov 16, 2013 12:10 am
by MarketInSG

Code: Select all

class ControllerProductWeekly-specials extends Controller {
this is your issue

Re: Creating a Custom Page in OpenCart

Posted: Sat Nov 16, 2013 12:33 am
by josee225
Thanks for the quick answer! How should I fix it?