2

While re indexing got an error:

PHP Fatal error: Uncaught Error: Call to undefined method Magento\Customer\Model\Indexer\Source::addAttributeToSelect() in /var/www/html/ncsmokehouse/vendor/magento/framework/Indexer/Handler/AttributeHandler.php:38

15
  • Did you done any modifications or added any custom module? Commented Sep 18, 2018 at 7:33
  • yes add this function public function addAttributeToSelect($fieldName, $alias = null) { $this->customerCollection->addAttributeToSelect($fieldName, $alias); return $this; } Commented Sep 18, 2018 at 7:35
  • i follow this link github.com/magento/magento2/issues/10838 but my error got not remove Commented Sep 18, 2018 at 7:37
  • Where did you add it? Can you update your code with module files as well? Commented Sep 18, 2018 at 7:37
  • github.com/magento/magento2/issues/10838#issuecomment-360065531 this one Commented Sep 18, 2018 at 7:38

2 Answers 2

3

Add a function :

public function addAttributeToSelect($fieldName, $alias = null) { $this->customerCollection->addAttributeToSelect($fieldName, $alias); return $this; } 

in this file /www/vendor/magento/module-customer/Model/Indexer/Source.php

you can override this file because we can't change in core module. it's working

-1

In my case, it works. However, after that, I've found another reindex issue, which I've solved by following this Magento 2 How to Unlock Reindex Process: Index is locked by another reindex process Skipping

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.