skip to Main Content

I just installed php-cuong customer avatar (https://github.com/php-cuong/magento2-customer-avatar) on magento 2.1.8

My problem is that when I want to upload an image in customer panel it has error and not to upload image. In the admin panel, customer tab when I choose a customer and upload image it saves in pub/media but not show avatar and sends error.

2

Answers


  1. CustomerProfilePicture/Model/Attribute/Backend/Avatar.php

    In this file there is one function

    public function prepareDataSource(array $dataSource)
      {
    

    just add

         if (isset($dataSource['data']['items'])) {
    

    this if condition , and you are done
    because you are getting undefined index error for
    $dataSource[‘data’][‘items’]

    Login or Signup to reply.
  2. Go to

     vendor/module-customer/Model/FileUploader.php
    

    Find

     $result['tmp_name'] = $result['path'] . '/' . ltrim($result['file'], '/'); 
    

    and replace with

     $result['tmp_name'] = ltrim($result['file'], '/');
    

    And you are ready to Go!!!!

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search