Showing results for 
Search instead for 
Did you mean: 

main.CRITICAL: Plugin class doesn't exist

main.CRITICAL: Plugin class doesn't exist

Hi guys,

I'm pretty new to Magento, so excuse me if I may be asking something obvious.


I'm trying to override function formatTxt() of class Magento\Directory\Model\Currency


I did a little search and I don't know if I've got the best way for it, so please guide me if I've chosen a wrong path:

I think doing it through plugins is the right way.


The problem is that when I render a search-result page, no result is being rendered. When I looked inside 'var/log/system.log', the following error is being logged:

[2016-09-17 16:47:49] main.CRITICAL: Plugin class Amaj\CorePlugin\Model\Currency\Plugin doesn't exist [] []


Please help me to find the problem.

Thank you for your helps in advance Smiley Happy



-------------------------------------- The files ---------------------------------------------------------

I created a module with the following structure:




I have defined the files like the following:






<?xml version="1.0"?>
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
<config xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Amaj_CorePlugin" setup_version="1.0.0">
            <module name="Magento_Directory"/>



namespace Amaj\CorePlugin\Setup;

use Magento\Framework\Setup\InstallSchemaInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\SchemaSetupInterface;

 * @codeCoverageIgnore
class InstallSchema implements InstallSchemaInterface
     * {@inheritdoc}
     * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
    public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)



<?xml version="1.0"?>
<config xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Directory\Model\Currency">
    	<plugin name="amaj-core-plugin-currency" type="Amaj\CorePlugin\Model\Currency\Plugin" sortOrder="10" disabled="false" />
    <!--preference for="Magento\Directory\Model\Currency" type="Amaj\CorePlugin\Model\CurrencyPlugin" /-->



namespace Amaj\CorePlugin\Model\Currency;

class Plugin
	protected $logger;

	public function __construct(\Psr\Log\LoggerInterface $logger) {
		$this->logger = $logger;

     * @param float $price
     * @param array $options
     * @return string
    public function aroundFormatTxt(
    	\Closure $proceed,
    	$options = []
    	$logger->info('Amaj aroundFormatTxt');
    	return '2';