How to use Opencart default admin over Joomla’s Component like jCart/Mijoshop or other CMS

This article is going to explain how to run a Opencart default admin with Joomla Opencart Extensions like jCart and mijoshop. This could apply to any other CMS which provide bridge between opencart and the CMS.

Some background

Opencart components are usually a opencart installation, wrapped with some code, so it will appear in Joomla or other CMS as a part of the site. Because of collisions between Joomla’s javascript libs and some opencart extensions, which heavily uses javascript they couldn’t work on the Joomla Opencart Admin. For this very reason, the following steps need to be done. The result – you will get fully functional opencart Admin, linked to the frontend of your shop. This way you can use extensions like Bulk Product Update PRO or similar.

Step by step

So here is what need to be done:

  1. Get a copy of opencart from opencart.com
  2. Extract the contents of {archive}/opencart-{version}/upload on your shop’s root. For example if your shop is located at: /var/www/ you need to place the contents of {archive}/opencart-{version}/upload dir under /var/www/upload. Optionally you can rename it to something more prominent like shop-admin or so.
  3. Remove the install dir. This is done for security reasons and probably you will be prompted when you login to the admin later
  4. (optional) You can remove catalog directory as well as you can replace index.php with something which redirect to the site url.
    An example of index.php could be the following content:

    <?php header('Location: ../');?>

    Just to play safe, you can move the original index.php to index.old.php and add the code to a new file.
    This will redirect any user which access url http://your-shop.com/upload/ to http://your-shop.com
    It’s useful if you care of SEO and this way you can prevent Search engine bots to crawl this part of the site.

  5. Rename /{yoursiteroot}/upload/admin/config-dist.php to /{yoursiteroot}/upload/admin/config.php – this is the key part of your integration
  6. Copy the following contents to the newly created file. This is an example contents of your config.php
    <?php
    //BRIDGE SECTION
    //Usually you need to change values of this section only.
    define('SITE_URL', 'http://your-shop.com'); //1*
    define('SITE_SECURE_URL', 'https://your-shop.com'); //2*
    define('SITE_DIR', __DIR__.'/../../'); //3*
    define('SITE_SHOP_DIR', '/var/www/components/com_opencart/'); //4*

    //Modified config definitions:
    // HTTP
    define('HTTP_SERVER', SITE_URL.'/uploads/admin/');
    define('HTTP_CATALOG', SITE_URL.'/');

    // HTTPS
    define('HTTPS_SERVER', SITE_SECURE_URL.'/uploads/admin/');
    define('HTTPS_CATALOG', SITE_SECURE_URL.'/');

    // DIR
    define('DIR_APPLICATION', SITE_DIR.'upload/admin/');
    define('DIR_SYSTEM', SITE_DIR.'upload/system/');
    define('DIR_DATABASE', SITE_DIR.'upload/system/database/');
    define('DIR_LANGUAGE', SITE_DIR.'upload/admin/language/');
    define('DIR_TEMPLATE', SITE_DIR.'upload/admin/view/template/');
    define('DIR_CONFIG', SITE_DIR.'upload/system/config/');
    define('DIR_IMAGE', SITE_SHOP_DIR.'image/');
    define('DIR_CACHE', SITE_SHOP_DIR.'system/cache/');
    define('DIR_DOWNLOAD', SITE_SHOP_DIR'download/');
    define('DIR_LOGS', SITE_SHOP_DIR.'system/logs/');
    define('DIR_CATALOG', SITE_SHOP_DIR.'/catalog/');

    // DB //5*
    define('DB_DRIVER', 'mysql');
    define('DB_HOSTNAME', 'localhost');
    define('DB_USERNAME', '{db_username}');
    define('DB_PASSWORD', '{db_password}');
    define('DB_DATABASE', '{database}');
    define('DB_PREFIX', '{extension}');

    Some notes:
    1* – The site domain is usually the root of the shop itself, like http://your-shop.com, but sometimes the shop is not the core of the business and could be just a subsection of the site, so the url should be http://your-shop.com/catalog.
    2* – If you are using server certificate (secure http or https) insert in the value url containing https:// in front. like: https://your-shop.com/ if you don’t have such certificate, use the value of 1*. Bear in mind also the comment from 1*.
    3* – This usually is the root of the shop like: /var/www/. In the example I am using relative path, so no matter what is the path it should work. This value is used for defining opencart’s default admin resources.
    4* – This should point to the joomla’s opencart component. The components are usually under /var/www/components/. That’s why the value should be like: ‘/var/www/components/com_opencart/’. Please check where your opencart component is installed. For mijoshop the component name probably is different. The same apply to other CMS – you need to see where are the core files of the opencart.

    5* – Change your db settings and link the admin to the actual opencart database. All values containing {} should be changes accordingly.

If everything is right, you should be able to see the admin of the shop accessing http://your-shop.com/upload/admin/ – username and password should be the same as the frontend admin. Now you can install as much opencart extensions as you like.

This post is written in order to clarify how to install Bulk Product Update PRO extension, but could be used for other extensions as well.

If you want to check my Opencart extensions please click here

Please write a comment, or use the contact form of the site if you experience troubles by following this manual. I will contact you as fast as I can, and if something is wrong with the article I will change it accordingly.

Share it:
  • Facebook
  • Twitter
  • Digg
  • StumbleUpon
  • del.icio.us
  • Google Bookmarks
  • Yahoo! Buzz
  • Add to favorites
  • Identi.ca

4 thoughts on “How to use Opencart default admin over Joomla’s Component like jCart/Mijoshop or other CMS

  1. So if I follow these instructions I will be able to have Opencart in my Joomla website using Mijoshop and will not be limited to Mijoshop compatible Opencart extensions? I will be able to install Opencart extensions in the default Opencart admin while the products will display in the Joomla site through Mijoshop?

    Will I have to configure the admin parameters to match the Mijoshop/Joomla admin parameters?

    Right now I am having problems printing an invoice through the Mijoshop/Opencart front end admin. Somehow the Joomla template css is overriding the Opencart invoice css & the invoice is not printing correctly in the Mijoshop/Joomla front end admin (it does print correctly in the Joomla/Mijoshop backend admin) . If I follow the instructions aboe I will be able to print the invoice as it was intended in the front end admin?

  2. Will I have to configure the admin parameters to match the Mijoshop/Joomla admin parameters?

    Right now I am having problems printing an invoice through the Mijoshop/Opencart front end admin. Somehow the Joomla template css is overriding the Opencart invoice css & the invoice is not printing correctly in the Mijoshop/Joomla front end admin (it does print correctly in the Joomla/Mijoshop backend admin) . If I follow the instructions aboe I will be able to print the invoice as it was intended in the front end admin?http://www.parts-hp.com

Leave a Reply

Your email address will not be published. Required fields are marked *