[OpenCart] how to install vQmod in OpenCart ?

opencart

Today, I came up here to make some easy pictures to install “vQmod” (Create xml patches for php files without editing the core system source code so called Virtual file modification system) in OpenCart 1.5.5.1

If you don’t know what is vQmod? then please read before we start.

vQmod: Virtual file modification system

Assume, we have installed a fresh copy of OpenCart 1.5.5.1 in the system

In this tutorial there are more than one way that vQmod can be installed in the opencart system.

Install vQmod in OpenCart manually:

Step-1: For self securitey! Backup or make a duplicate of your existing installed OpenCart files and folders in safe place.

Step-2: Download the latest version of vQMod

Step-3: Extract vqmod-x.x.x-opencart.zip and upload the vqmod folder to root of OpenCart directory.

Step-4: Now, we need to modify two files. One is /index.php and another one is /admin/index.php file

Search,

//File: /index.php 
// Startup
require_once(DIR_SYSTEM . 'startup.php');

// Application Classes
require_once(DIR_SYSTEM . 'library/customer.php');
require_once(DIR_SYSTEM . 'library/currency.php');
require_once(DIR_SYSTEM . 'library/tax.php');
require_once(DIR_SYSTEM . 'library/weight.php');
require_once(DIR_SYSTEM . 'library/length.php');
require_once(DIR_SYSTEM . 'library/cart.php');
require_once(DIR_SYSTEM . 'library/affiliate.php');

Replace with,

// vQmod
require_once('./vqmod/vqmod.php');
VQMod::bootup();

// VQMODDED Startup
require_once(VQMod::modCheck(DIR_SYSTEM . 'startup.php'));

// Application Classes
require_once(VQMod::modCheck(DIR_SYSTEM . 'library/customer.php'));
require_once(VQMod::modCheck(DIR_SYSTEM . 'library/currency.php'));
require_once(VQMod::modCheck(DIR_SYSTEM . 'library/tax.php'));
require_once(VQMod::modCheck(DIR_SYSTEM . 'library/weight.php'));
require_once(VQMod::modCheck(DIR_SYSTEM . 'library/length.php'));
require_once(VQMod::modCheck(DIR_SYSTEM . 'library/cart.php'));
require_once(VQMod::modCheck(DIR_SYSTEM . 'library/affiliate.php'));

and,

Search,

//File: /admin/index.php
// Startup
require_once(DIR_SYSTEM . 'startup.php');

// Application Classes
require_once(DIR_SYSTEM . 'library/currency.php');
require_once(DIR_SYSTEM . 'library/user.php'));
require_once(DIR_SYSTEM . 'library/weight.php');
require_once(DIR_SYSTEM . 'library/length.php');

Replace with,

// vQmod
require_once('../vqmod/vqmod.php');
VQMod::bootup();

// VQMODDED Startup
require_once(VQMod::modCheck(DIR_SYSTEM . 'startup.php'));

// Application Classes
require_once(VQMod::modCheck(DIR_SYSTEM . 'library/currency.php'));
require_once(VQMod::modCheck(DIR_SYSTEM . 'library/user.php'));
require_once(VQMod::modCheck(DIR_SYSTEM . 'library/weight.php'));
require_once(VQMod::modCheck(DIR_SYSTEM . 'library/length.php'));

Step-5: vQmod is now ready to use. Upload desired xml script to ‘vqmod/xml’ folder

Step-6: How this .xml file should look? For exampale we need to add a menu item “Homenet” under “Extension” menu in the admin panel. So we need to create a file named admin_menu_modification.xml in ‘vqmod/xml’ folder like;

‘vqmod/xml/admin_menu_modification.xml’

<!--
#author: Tanveer Noman
#file name: admin_menu_modification.xml
#description: This file is demonstrating how to write a simple xml file to add new
menu item named "Homenet" in admin menu section
-->
<modification>
	<id>Admin Menu Modification</id>
	<version>1.5.x</version>
	<vqmver>2.2.1</vqmver>
	<author>tanveer.noman@gmail.com</author>
	<file name="admin/controller/common/header.php">
		<operation>
			<search position="after"><![CDATA[$this->data['text_feed'] = $this->language->get('text_feed');]]></search>
			<add><![CDATA[$this->data['text_homenet'] = $this->language->get('text_homenet');]]></add>
		</operation>
		<operation>
			<search position="after"><![CDATA[$this->data['feed'] = $this->url->link('extension/feed', 'token=' . $this->session->data['token'], 'SSL');]]></search>
			<add><![CDATA[$this->data['homenet'] = $this->url->link('homenet/homenet', 'token=' . $this->session->data['token'], 'SSL');]]></add>
		</operation>
	</file>
	<file name="admin/view/template/common/header.tpl">
		<operation>
			<search position="after"><![CDATA[<li><a href="<?php echo $feed; ?>"><?php echo $text_feed; ?></a></li>]]></search>
			<add><![CDATA[<li><a href="<?php echo $homenet; ?>"><?php echo $text_homenet; ?></a></li>]]></add>
		</operation>		
	</file>
	<file name="admin/language/english/common/header.php">
		<operation>
			<search position="after"><![CDATA[$_['text_feed']                        = 'Product Feeds';]]></search>
			<add><![CDATA[$_['text_homenet']                     = 'Homenet';]]></add>
		</operation>		
	</file>
</modification>

Wallah! You are done!

Step-7: Now log in to admin panel. Mouse over to “Extension” menu item, if everything works good then you can see a new menu item “Homenet” is added whithout changing any core system files.

homenet

Install vQmod in OpenCart using Autoinstaller:

Step-1: Download the latest version of vQMod and extract it.
Step-2: Use your FTP to upload the folder “vqmod” to your opencart store. Make sure vqmod/vqcache folders are writable (either 755 or 777).
Step-3: Now browse http://www.your-domain.com/vqmod/install
Step-4: If everything goes well, you should get a success message. If not then check permissions.

***Troubleshooting***
– Make sure you are giving the currect vqmod path like; require_once(‘../vqmod/vqmod.php’);
– Check if the vqmod folder and the vqmod/vqcache folders are writable (755)
– Verify that there are new “vq2” files in the “vqmod/vqcache” folder after loading your store homepage
– Some times you may need to create “mods.cache” file inside “vqmod” folder and make it writable (755)
– You may need to create logs” folder inside “vqmod” folder and make it writable (755)

For more information:

http://docs.opencart.com/display/opencart/OpenCart+1.5+Home
http://www.opencart.com/index.php?route=extension/extension
http://forum.opencart.com
https://github.com/opencart/opencart/issues
http://opencart.hostjars.com
http://opencart-help.com

Related Links:
[Video] http://code.google.com/p/vqmod/wiki/Install_OpenCart

That’s all!

You can inbox me or drop your comments/feedbak here I will reply on that regards.

Thanks for reading and don’t forget to share!

About Tanveer
RIA (Rich Internet Application) Developer with a wide variety of business applications. Particularly interested in client/server and relational database design. Always interested in migration projects, as well as close interaction with the DB manufacturers.

10 Responses to [OpenCart] how to install vQmod in OpenCart ?

  1. thye says:

    Hi,

    I have an error in admin side. It shows ‘Fatal error: Class ‘User’ not found in /home/gokiddy/public_html/admin/index.php on line 148′.
    Need help…!!

    Rgds,

    • Tanveer says:

      Hi,

      First check the file “user.php” is exist in here “/home/gokiddy/public_html/system/library/user.php”. If yes, then check the file’s permission and set as per your need. After that, open the admin index file “/home/gokiddy/public_html/admin/index.php” and check if this line is exist in the application classes section. If not add this line.

      //Application Classes
      require_once(DIR_SYSTEM . ‘library/user.php’);

      Hope it will work now.

      Cheers!

  2. David says:

    well, i did the autoinstall thing, got a succes notice , (if i enter again it screams VQMOD ALREADY INSTALLED)
    I copied the xml source as you wrote to the xml folder, but i dont see the Homenet sub-menu.
    i got this from the log :
    “REQUEST URI : /index.php
    VQMod::_parseMods – DOM UNABLE TO LOAD: /home/vol11_2/byethost18.com/b18_14213019/htdocs/vqmod/xml/admin_menu_modification.xml

    i changed the premissions to 755 , yet still nothing changes.
    i am running the opencart 1.5.6.1, fresh out of the oven .
    Help please? thanks !

    • Tanveer says:

      Can you provide any error log?
      More easier way for you I guess, try to change any word from any language file to see if it works or not. Like try to replace “You are logged in as xxxxx” to “U R logged in as xxxx”.

      For example;

      <file name="admin/language/english/common/header.php">
              <operation>
                  <search position="replace"><![CDATA[$_['text_logged']                      = 'You are logged in as <span>%s</span>';]]></search>
                  <add><![CDATA[$_['text_logged']                      = 'Y R logged in as <span>%s</span>';]]></add>
              </operation>     
          </file>
      

      Not tested but you can try out yourself 😉

  3. David says:

    Hi,i just installed a fresh 1.5.6.1 and i did all of the above, and even set the premissions to all the files on my server to 755, yet i can’t enter the homenet page. i already enabled all the premissions of the usersl group and still nothing.
    i still get the Permission Denied.
    the only thing my error log shows is : “2014-01-09 9:52:19 – PHP Notice: Error: MySQL server has gone awayError No: 2006UPDATE currency SET value = ‘1.00000’, date_modified = ‘2014-01-09 09:52:19’ WHERE code = ‘USD’ in /home/vol11_2/byethost18.com/b18_14213019/htdocs/system/database/mysql.php on line 50

    i’m kinda new to this, but by the tutorial, i did everything right.

    • Tanveer says:

      “Permission Denied” could also be happend if your logged in user doesn’t has the proper right from System > User > User Group > Edit the user > check Access Permission and check Modify Permission for that particular page.

      Best of luck..

      • David says:

        first, i apologize for double posting,
        i googled abit about the problem,
        and by uploading the xml file in binary i managed the get the sub menu to appear.
        and i did the premissions thing from the user groups and i still couldn’t enter the sub menu.
        even though i enabled everything in the list,
        so i made a fresh install, the oc 1.5.6.1 and vqmod 2.4.1 , and now i’m back at the starting point – i don’t see the sub menu.
        i suppose i can upload the xml in binary – but it will probably take me back to no premission
        again.
        this is becoming really frustrating.
        there is something im missing, i can swear it.
        can you help?

      • Tanveer says:

        1. Try to install vQmod manually.
        2. Check if the vqmod folder and the vqmod/vqcache folders are writable (either 755 or 777).
        3. Verify that there are new “vq2-xxxx.php” files in the “vqmod/vqcache” folder after loading your store homepage.
        4. Make sure you are giving the currect vqmod path like; require_once(‘../vqmod/vqmod.php’) in the /index.php file and /admin/index.php file.
        5. If everything goes well, you don’t need to upload xml file in binary

        Best of luck.

      • David says:

        Did everything you said, go in a mess again,
        Downloaded vqmanager, Got out of that mess *-*.
        Thanks alot!

      • Tanveer says:

        Great 🙂

Leave a comment