0

enter image description here I have to override the Customer module.

vendor/magento/module-customer/Model/Indexer/Source.php

in my custom module

app/code/Magenticians/Moduleproduct/Model/Indexer/Source.php

here is registration.php file :

\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'Magenticians_Moduleproduct',
__DIR__
);

in etc folder di.xml and module.xml file

...di.xml:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magento\Customer\Model\Indexer\Source" type="Magenticians\Moduleproduct\Model\Indexer\Source" />
</config>

module.xml:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magenticians_Moduleproduct" setup_version="1.0.1">
</module>
</config>

just add one function in source.php file

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

override successfully. customer re-indexing has done.

but got an issue in Wysywig editor shows a broken image. which I insert in pages.

when I remove this overridden module Wysywig editor shows images properly. I want to identify what's wrong with my module and why Wyswig show a broken image when this module is here?

1

Please check all php files of your custom extension and please check this 2 poinst.

  1. Make sure that all php files start with <?php tag, with no space before it (most probably registration.php)
  2. Check if all you php files does not have ?> at the end of file, if yes, remove php close tag.

app/code/Magefan/Moduleblog/registration.php

app/code/Magenticians/Moduleproduct/registration.php

have empty line before <?php tag. Please fix it and it will work as expected.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.