Category: Opencart

Add Gravatar image to Accounts page in Opencart

add gravatar to opencart account page

 
Recently I had an enquiry on how to add a customer’s Gravatar image to their Account page in Opencart. With a little bit of research I found out that you can “get” the following customer details:

    $this->customer->isLogged()
    $this->customer->getId()
    $this->customer->getFirstName()
    $this->customer->getLastName()
    $this->customer->getEmail()
    $this->customer->getTelephone()
    $this->customer->getFax()
    $this->customer->getNewsletter()
    $this->customer->getCustomerGroupId()
    $this->customer->getAddressId()
    $this->customer->getBalance()
    $this->customer->getRewardsPoints()

So we can use “getEmail” to extract the email address, and we then simply add the code into the account.tpl file to complete the Gravatar url as shown below, which will then display the Gravatar image.

<img src="http://www.gravatar.com/avatar/<?php echo md5(strtolower(trim($this->customer->getEmail()))); ?>" />

So if your client is using their Gravatar email address as their account email address, then their accompanying image will be displayed, otherwise a default Gravatar image will be shown.

For those who prefer to use VQMOD, I’ve put together a VQMOD XML file that is available as a download below. Simply unzip the file and upload the dtwdshowgravataraccountpage.xml file to your vqmod > vqcache folder. [wdsm_ad id=”1487″ class=” ” ]

Filed under: OpencartTagged with: ,

Managing the list of information pages shown in module and sitemap on Opencart

Following on from my earlier article Information pages showing in Opencart Footer – how to manage which ones are listed, I thought that you might like to know how to also modify the list of information pages shown in the Modules (such as the sidebar) and the Sitemap.

The procedure is basically the same, except this time you create a VQMOD file to change the other files. For the “information pages” listing in the module you are targeting “catalog/controller/module/information.php” file. For the “information pages” listing in the sitemap, you want to be adding changes to “catalog/controller/information/sitemap.php” file.

Then you simply add the following operation to your VQMOD file:

<operation>
     <search position="replace" offset="4"><![CDATA[foreach ($this->model_catalog_information->getInformations() as $result) {]]></search>
     <add><![CDATA[foreach ($this->model_catalog_information->getInformations() as $result) {
     if ( $result['sort_order'] != -1) {
        $this->data['informations'][] = array(
        'title' => $result['title'],
        'href'  => $this->url->link('information/information', 'information_id=' . $result['information_id'])
     );}]]></add>
</operation>

Remember to save your VQMOD file with a name that helps you to identify the file, then upload to the XML folder of your VQMOD folder.

For more information, be sure to review the article on how to manage which Information pages are shown in the Opencart footer

Filed under: OpencartTagged with:

Information pages showing in Opencart Footer – how to manage which ones are listed

opencart footer hide information pages

How do I remove, hide, control information pages showing up in the Opencart footer?

In earlier versions of Opencart the way to stop the listing of certain information pages in the footer, was to give the page a “sort-order” of “-1″.

However it seems that this functionality has been removed from later versions. This VQMOD file will give you back control of this option. In addition to this you will also get the benefit of being able to customise the file further to suit your needs.

Of course firstly you must have VQMOD installed on your Opencart website. Then you need to download the file below and unzip the folder, then FTP the XML file to your vqmod > xml folder on your website. [wdsm_ad id=”1352″ class=” ” ]

The XML files looks for the catalog/controller/common/footer.php file, searches out the line for adding information page list to the footer:

foreach ($this->model_catalog_information->getInformations() as $result) {

and then inserts an if statement that looks for whether “-1” has been entered in the “sort-order” field in the information page editing screen:

if ( $result['sort_order'] != -1 ) {

To customise further, perhaps you don’t have to just use “-1”. Maybe you would prefer to still use sort order properly, then you could just start all the information pages, that you don’t want listed on your Opencart footer’s information pages list, with numbers greater than 50.
So you would change the line in the VQMOD XML file that says :

if ( $result['sort_order'] != -1 ) {

to:

if ( $result['sort_order'] >= 50 ) {

Then it’s just a matter of adding sort-order of 50,51,52,etc to the Opencart information pages that you don’t want shown in the footer.

Be sure to check that file has worked with your Opencart theme and version of Opencart. If you are familiar with using the VQMOD cache, you can FTP the catalog_controller_common_footer.php file down to your computer, open it up and check that the required line is in the correct location. Also of course you would view your website to ensure the changes are reflected.

Filed under: OpencartTagged with: , ,

Change default gravatar image in Opencart with VQMOD

Gravatar images are wonderful as they make the comments section of our websites look so much better when you can see someone’s face, icon, logo or image. If you don’t know what a Gravatar is then head on over to en.gravatar.com/

What if your commenters don’t have gravatar images- how do you change the image to look good on your website?
change default gravatar opencart
Well recently, a website that I was working on had installed on it a module for blogging in Opencart known as OPExtensions Blog System Opencart, and the developer of this module has configured the comments to pull in the Gravatar, in a similar fashion to the way WordPress pulls in the Gravatar when people comment.

Problem is that many people who are commenting on the blog articles, use email addresses that aren’t registered with Gravatar, and so there’s an ugly blue icon that shows up as a default.

Best way to fix or make changes on Opencart is to use VQMOD XML files to make changes on the fly– if you want to find out more about VQMOD then check out my article–> What is VQMOD

Change default gravatar image in Opencart with VQMOD

So here’s some bonus VQMOD file for you below- make sure to save the file as .xml and upload to your VQMOD > XML folder. Remember this file will only work with the OPExtensions blog module- if you are using another, you will need to make the necessary changes for your files.

Replace “http://www.YOURSITE.COM/IMAGE-FOLDER/NEW-DEFAULT-GRAVATAR.JPG” with the URL to your new default gravatar image

[xml]
<!–For OPExtensions Blog System Opencart //–>
<modification>
<id><![CDATA[change default gravatar in opencart opextensions blog comments]]></id>
<version><![CDATA[1.0.1]]></version>
<vqmver><![CDATA[2.2.1]]></vqmver>
<author><![CDATA[davidtiong.com]]></author>
<file name="catalog/controller/opextensions/comment.php">
<operation>
<search position="replace" offset="6"><![CDATA[private function getAvatar($type,$email = ”){]]></search>
<add><![CDATA[private function getAvatar($type,$email = ”){
$config = $this->config->get(‘blog_comment’);
$default="http://www.YOURSITE.COM/IMAGE-FOLDER/NEW-DEFAULT-GRAVATAR.JPG";
switch($type){
case ‘gravatar’ :
$img = ‘<img src="http://www.gravatar.com/avatar.php?gravatar_id=’.md5(strtolower(trim($email))).’&default=’.urlencode($default).’&rating=PG" width="’.(int)$config[‘avatar_w’].’px" height="’.(int)$config[‘avatar_h’].’px" />’;
break;
}
]]></add>
</operation>
</file>
</modification>
[/xml]

and if you are using the OPExtensions Blog System Opencart you may want to fix the spelling mistake “Creat by” to “Created by” or even change it to “Comment by”…

[xml]
<!– text fix for OPExtensions Blog System Opencart //–>
<modification>
<id><![CDATA[change creat to create in opextensions blog comments fix]]></id>
<version><![CDATA[1.0.1]]></version>
<vqmver><![CDATA[2.2.1]]></vqmver>
<author><![CDATA[davidtiong.com]]></author>
<file name="catalog/language/english/opextensions/comment.php">
<operation>
<search position="replace"><![CDATA[$_[‘text_creatby’] = ‘Creat By ‘;]]></search>
<add><![CDATA[$_[‘text_creatby’] = ‘Created By ‘;]]></add>
</operation>
</file>
</modification>
[/xml]

Filed under: OpencartTagged with: , ,

What is VQMOD and how to install

Sometimes when talking about customising Opencart you might hear the word VQMOD dropped into the conversation here and there. So what is this VQMOD?

Well quite simply it is an effective and clever way to modify your Opencart functionality without actually going in and hacking the core files. It stands for VirtualQMod and basically modifies the Opencart files on-the-fly with modification scripts.

By not modifying the core files, you won’t have to worry about overwriting these changes when you do an update of Opencart. The downside of course is that the VQMOD files are designed to work with certain versions of Opencart, so when you upgrade there is still the risk of incompatibilities.

If you are looking to implement VQMOD on your Opencart website, then you should check out the video and the links below.

How to install VQMOD in Opencart – click here

Filed under: OpencartTagged with: