opencart product options : Default To First Option

opencart product options – Default To First Option

You can activate all first options automatically using this:



opencart current url

the seo guy requested to add link to current url to each H1 in the site so i found this code to do this

  <?php  $url = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; ?>
  <h1><a href="<?php echo $url; ?>"><?php echo $heading_title; ?></a></h1>

opencart can’t upload more than 300kb image

hello it’s me not this song again ๐Ÿ™‚

well this time my client had strange problem, she can’t upload images more than 300kb and the solution was like this

go to

line 436

if ($this->request->files[‘image’][‘size’] > 3000000000) {

and couple of zeros and your are good to go

opencart non www to www adds index.php?_route_=

this time it is about opencart and seo client needs to redirect site from non www to www all time so we added rule in .htaccess

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]


i added this to the end of file and it worked good but i had problem and it was showing index.php?_route_= after the base link like this

instead of


and after searching Google i found the solution

it was by putting these lines before the standard rules like this :

RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^download/(.*) /index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]


hope it will help someone



opencart Forbidden You don’t have permission to access

many times for some reason when u press save in opencart admin panel u get this


You don’t have permission to access /admin/index.php on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.


and start digging around and most of the times it is the same solution which i keep forgetting it is server issue and the answer is :

Mod_security is blocking this operation


so u need to talk to the hosting support to fix this and all will be alright



product description utf-8 problem

I notice on product description utf-8 problem showing diamond at end of the line

after some searching in google i found this

open the desired module from catalog\controller\module

like latest module is latest.php

on lineย  82 (opencart


'description' => substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, 100) . '..',

with this:

'description' => mb_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, 100, 'UTF-8') . '..',

notice the change of substr to mb_substr

and adding ‘UTF-8’ as new argument