0

我一直在尝试找到一种将照片添加到 Opencart 中的客户资料的方法。除了这个,他们什么都有,我在任何地方都找不到怎么做。任何帮助表示赞赏。我正在使用最新版本的opencart,如果有人知道任何以前版本的这个问题也非常有帮助......

感恩

4

1 回答 1

6

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.

于 2012-11-19T14:27:27.703 回答