user2605708
user2605708

Reputation: 51

SEO URL for information pages in opencart

I have created the a custom menu in the header where I put the links to About Us, Register and Contact Us.

Now I want to utilise SEO URL's. I've set the SEO URL keywords in admin, and all the pages work fine but the custom links aren't working.

Here's the customised code I've added to the header

<div class="nav">
      <ul>

        <li><?php foreach ($categories as $category) { ?><a href="<?php echo $category['href']; ?>"> <?php }?> Products</a></li>
        <li><a href="index.php?route=account/register">Register Now</a></li>
        <li><a href="index.php?route=information/information&information_id=4">About Us</a></li>
        <li><a href="index.php?route=information/information&information_id=7">The Company</a></li>
        <li><a href="index.php?route=information/information&information_id=8">iPhone App</a></li>
        <li><a href="index.php?route=information/contact">Connect@Cobra Razors</a></li>

        </ul>
    </div>

Upvotes: 1

Views: 4504

Answers (1)

Jay Gilford
Jay Gilford

Reputation: 15151

OpenCart uses a URL class to handle all of your links. It has the format

$this->url->link('route_here', 'parameters_here', 'SSL/NONSSL');

Only the first parameter (route) is required however. For example, the Register Now link you have above would be

<a href="<?php echo $this->url->link('account/register'); ?>">Register Now</a>

However it should be a secure page since a customer is expected to input sensitive data, so you need to link using an HTTPS link (will automatically set to HTTP if your store doesn't support SSL) so we need to set the third parameter to SSL. If we don't, by default it's set to NONSSL

<a href="<?php echo $this->url->link('account/register', '', 'SSL'); ?>">Register Now</a>

As you'll notice, the second parameter is just an empty string. This is because it doesn't have any extra parameters. This brings us onto your info pages links which will need the information_id parameter

<a href="<?php echo $this->url->link('information/information', 'information_id=4'); ?>">About Us</a>"

Upvotes: 1

Related Questions