Question

I've been trying to find a way to add Photo to a customer profile in Opencart. They have everything but this, and I can't find anywhere how to do it. Any help is appreciated. I'm using latest version opencart, if anybody knows about this issue with any previous version also very helpfull...

thnaks

Était-ce utile?

La solution

Avatars are not a common feature of shopping carts, so it is not surprising that OpenCart does not have one. Indeed, the only time I could imagine it usefully appearing would be by user reviews.

Allowing customers to upload an arbitrary image, cropping and processing it, and then displaying it next to the customer's reviews is quite a big ask. And although the extension is possible, you'd then have to police the images for genitals and other inappropriateness. Even if the only people that see this are the customer and admin, this can be a problem if you are employing admin staff who are offendable and litigious.

The simplest solution is to use Gravatar. This takes an MD5 hash of the customer's email address and returns an avatar. For example, to add one to the admin customer report you would add to admin\view\template\report\customer_order.tpl after the line

<td class="left"><?php echo $customer['email']; ?></td>:

the line

<td class="left">
<img src="http://www.gravatar.com/avatar/
<?php echo md5(strtolower(trim($customer['email']))); ?>
"></td>

(You'd want to tidy up the table header rows as well to match).

Some places where you'd want to show an avatar, like the reviews page, don't already show the email. You'd therefore need to adjust the query (for example in getReviewsByProductId in model/catalog/review.php) so that it pulls in the user table and the email field, and also add it to the relevant controller.

That's all great for people who already have a Gravatar (usually people who blog or comment on blogs), but everyone else gets a default image. How do you get customers to upload an image?

Simple. In your FAQ, add "How do I change my avatar profile picture? We use Gravatar. Upload your picture there." or similar. People who want to update their picture will follow the instructions.

A very real benefit to this approach is that you are not delaying people from becoming customers. Cart abandonment is bad enough without asking customers to go find a picture of themselves. Indeed, you should bear in mind that some people shop online because they don't want people to see them.

So, although not literally adding user photo upload facilities to OpenCart, this approach gives you customer avatars without modifying too much code.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top