Age of Article Warning:
This article was originally published 43 months ago. The tips and techniques explained may be outdated, or information may longer be applicable. Please consider this when viewing the below content.

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=” ” ]

Add Gravatar image to Accounts page in Opencart was last modified: September 6th, 2016 by David Tiong
Add Gravatar image to Accounts page in Opencart