I am really enjoying working with OpenCart, I’m a big fan of wordpress but it’s not brilliant for online sales – it’s okay, but opencart is a great interface if all you really want is a shop.

The opencart theme structure

It’s a little like a wordpress child theme where you can create a duplicate of the default theme and only use the files that you change in your child theme – so the other files are pulled from the default theme and are updated when you upgrade opencart.

To set up your theme – create a theme folder that follows the file structure of the default theme. You have to have the header.tpl in the common folder and change “default” to whatever you call your theme

Some changes need to be made to core files

The Email text

to change the email text the file that needs to be edited is …/catalog/language/en-gb/mail/order.php

Parse error in the customers.php file

i experienced a syntax error when I was trying to look at the customers list in the backend

Parse error: syntax error, unexpected '&&' (T_BOOLEAN_AND), expecting ')' in .../admin/controller/customer/customer.php on line 1105

I found a solution here http://stackoverflow.com/questions/35939201/syntax-error-unexpected-t-boolean-and-expecting-in-opencart-when-cl

It was that the parentheses were in the wrong place… so I changed

!empty($custom_field['validation'] && $custom_field['location'] == 'address'))


!empty($custom_field['validation']) && $custom_field['location'] == 'address')

Parse error in the address.php file

On clicking address book in the my account page there is an error:

Parse error: syntax error, unexpected '&&' (T_BOOLEAN_AND), expecting ')' in .../catalog/controller/account/address.php on line 522

I found a fix in the forum http://forum.opencart.com/viewtopic.php?f=181&t=159242

to change line 522 from:

 } elseif (($custom_field['type'] == 'text' && !empty($custom_field['validation'] && $custom_field['location'] == 'address')) && !filter_var($this->request->post['custom_field'][$custom_field['custom_field_id']], FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => $custom_field['validation'])))) { 

change to:

 } elseif (($custom_field['type'] == 'text' && !empty($custom_field['validation']) && $custom_field['location'] == 'address') && !filter_var($this->request->post['custom_field'][$custom_field['custom_field_id']], FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => $custom_field['validation'])))) { 

I confirm that this works.

Related Posts