sabbir
sabbir

Reputation: 2025

adding custom page's link in homepage in opencart

I am new in opencart, and I am trying to build a new eCommerce site using opencart where I need to add some custom static page ( some additional page ). So I follow the link New Page For OpenCart and opencart php custom page without using the "information" feature, and I can create a new custom page. But my problem is, how can I get this page's link on my home and others page so that people view my page.

Upvotes: 1

Views: 7346

Answers (2)

secondman
secondman

Reputation: 3277

Creating your link would depend greatly on how the page has been created, and where it's located.

Urls are built based on the location ie: route of your controller.

Let's say your new page has been built in:

catalog/controller/common/mypage.php

Obviously you'll need to follow the code standards listed in the posts you referenced for created a correct class that extends the Controller, a language file, a model class (if your page needs to interact with the database) and a view file.

Once all that is correct via the previous posts you can create a link anywhere on the catalog (front) by calling the url class and passing in the required information.

You'll need to pass in a route, any arguments such as an id or customer, and whether the url should be secure.

$link = $this->url->link('common/mypage', 'mypage_id=' . $this->request->get['mypage_id'], 'SSL');

$arguments and 'SSL' being optional if they're needed.

Upvotes: 1

Samwise
Samwise

Reputation: 306

If you are creating a new page that way, you will be to access the page (called "newpage" for example) at: /index.php?route=common/newpage or /index.php?route=common/home/newpage depending how you set it up.

The simplest way of creating a new page is to create a new information page. You can input your custom html there if needs be. The link would then look like:

/index.php?route=information/information&information_id=x where the id is the id of your new page.

To add this link into your main menu you can edit template/common/header.tpl and hardcode in the new link.

Upvotes: 2

Related Questions