Opencart SEO homepage (remove index.php?route=common/home)

If you are using SEO urls on your opencart site (which you should be), you may notice that sometimes when you navigate to the homepage by clicking on your site logo or other link, the url appears with the index.php?route=common/home suffix.

 

The easiest way to remove this, is to edit your .htaccess file with the following code:

 RewriteCond %{QUERY_STRING} ^route=common/home$
 RewriteCond %{REQUEST_METHOD} !^POST$
 RewriteRule ^index\.php$ http://%{HTTP_HOST}? [R=301,L]

Remove weight from cart/checkout – (Opencart Weight Based Shipping)

If you are using the Weight Based Shipping module in Opencart you may find that the weight appears in certain places such as the cart and checkout. However, you may not want this displayed as your weight might not be accurately setup or you may have it configured in your own way.

There is a setting to disable weight in the Opencart settings however this does not fully remove all references to the weight.

To fully remove the weight reference we need to edit the file:
catalog/model/extension/shipping/weight.php

Scroll down and find the line:

 'title' => $result['name'] . ' (' . $this->language->get('text_weight') . ' ' . $this->weight->format($weight, $this->config->get('config_weight_class_id')) . ')',

Simply replace this line with the following:

 'title' => $result['name'],

Adding Adwords Conversion code to Opencart Checkout

Google Adwords Conversions can be very useful for tracking what purchases on your site come from paid clicks through a PPC campaign.

Firstly you need to set up the tracking code on your Adwords account:
https://support.google.com/adwords/answer/6095821

To setup the conversion for an Opencart store we are going to track the success page that appears after a successful checkout. This is the page that lives at: catalog/view/theme/your-theme/template/common/success.tpl

However, this page is also used for all other success pages, for example after filling out any form. Therefore we need to check that the use has just completed the checkout page. We do this with a PHP query to check the route of the page we are on.

<?php $url_link_path = $_SERVER['QUERY_STRING'];;

if ($url_link_path = “route=checkout/success”) { ?>

//Insert Adwords Conversion Code Here

<?php } ?>

Force HTTPS using .htaccess Opencart

You may wish to use your ssl cert for every page on your opencart store. To do so you will need to select “Use SSL” in your opencart amin settings. You will also need to edit your .htaccess file as follows:

 

RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]

 

Make sure to replace “example.com” with your domain name.

How to Fix: VQMod::_parseMods – DOM UNABLE TO LOAD:

how-to-fix-vqmod

One of the most likely problems you will encounter with your XML VQMod files, assuming that your path locations are correct is going to be markup errors. The smallest thing such as an “&” symbol will cause the whole file to not load correctly.

You can access your VQMod error log by looking in the vqmod/logs/ folder.

How to Fix

Add Meta Description to Opencart Information Pages

how-to-add-meta-description-opencart

Working with Opencart version 1.5, however the script below is very easily editable to work with any version.

The way it works is by simply adding a meta description column to your information database table, populating it when editing your information page and spitting it out into the html of your front end page.

1) Login to your database and find the information_description table. Either add a new column called “meta_description” manually or by using the following code:

ALTER TABLE `information_description`
ADD `meta_description` VARCHAR( 255 ) NOT NULL

2) Presuming you already have vqmod installed, download the following XML file and upload it to your vqmod/xml/ folder. Click here to download.

Everything should now be live, you should have an editable Meta Description field now when you edit a information page. Any issues keep an eye on the vqmod/logs/ folder.

Display Part Number (Model) on Category Page – Opencart

  1. Go to the catalog controller page: catalog/controller/catalog.tpl
  2. Find the line: ‘name’  => $result[‘name’],
  3. Insert another line below this: ‘model’ => $result[‘model’],
  4. Now you can echo the model on your main category template page.

Default Grid View Products/Categories – Opencart 2

  1. Find the category.tpl file inside your template/product/ folder.
  2. Add the following code to the bottom of the page just below  <?php echo $footer; ?>

    <script type=”text/javascript”>
    $(document).ready(function() { if(typeof display == ‘function’) { display(‘grid’); } });
    </script>

How to clear image cache in opencart

If you need to clear the cached images for whatever reason, such as slow image loading, outdated image caches or importing new database you need to do the following:

  1. Using FTP navigate to /image/cache/data/
  2. Delete all files within that data/ folder.

On viewing any page within your site now these cached images will be recreated as needed.