Magento 2 Fixes

  1. Fix: Module 'Company_Module' from 'app/code/Company/Module' has been already defined in 'vendor/company/module'.

    If you have installed or updated Magento 2 extension and received the error message e.g.:

    Module 'Company_Module' from 'app/code/Company/Module' has been already defined in 'vendor/company/module'.

    this means that you have 2 versions of the extension:

    1) in the folder app/code/Company/Module
    2) in the folder vendor/company/module

    In vendor folder Magento stores all components (extensions, themes, language packages) that have been installed using Composer.

    As installing or updating extensions via Composer is preferred, you need to remove extension folder app/code/Company/Module (please don't forget about a backup before removal) and run installation commands.

    Read more »
  2. No such entity - Fix for Magento 2

    If you receive the error message "No such entity.", "No such entity with" or "No such entity with customerId" in Magento 2, the issue usually occurred when you try to load not existing object via Magento 2 Repository Class.

    To debug this issue, please open the file

    vendor/magento/framework/Exception/NoSuchEntityException.php

    Read more »
  3. Issue: The following modules are outdated

    If you receive the error:

    Please upgrade your database: Run "bin/magento setup:upgrade" from the Magento root directory. 
    The following modules are outdated:
    Vendor_Module schema: current version - x.x.x, required version - z.z.z
    Vendor_Module data: current version - x.x.x., required version - z.z.z

    And you have already run these commands:

    composer update vendor/module-name
    bin/magento setup:upgrade

    Read more »
  4. Magento 2.2.x layout pattern issue

    If you use Magento 2.2.x and get the error like:

    1 exception(s):
    Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'block', attribute 'class': [facet 'pattern'] The value '\Magento\Framework\View\Element\Text\ListText' is not accepted by the pattern '[A-Z][_a-zA-Z\d]*(\\[A-Z][_a-zA-Z\d]*)*'.
    Line: 1187
    Element 'block', attribute 'class': '\Magento\Framework\View\Element\Text\ListText' is not a valid value of the atomic type 'blockClassType'.
    Line: 1187

    Please find in all *.xml layout files string

    class="\

    and replace it with

    class="

    (Remove slash from the beginning of the class attribute value)

    Read more »
  5. bash: bin/magento: Permission denied

    If you run the CLI command:

    bin/magento ...

    and get the error:

    bash: bin/magento: Permission denied

    You'll need to add execute (x) permission to the file bin/magento.

    To do this, please run the command:

    Read more »
  6. Fixing issue with missing color option on search results

    Please follow the instructions to fix the issue.

    1. Create new layout XML file in you theme

    app/design/frontend/Vendor/theme/Magento_Swatches/layout/catalogsearch_result_index.xml

    2. Put content

    <?xml version="1.0"?>
    <!--
    /**
     * Copyright © 2015 Magento. All rights reserved.
     * See COPYING.txt for license details.
     */
    -->
    <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" 
                    xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <head>
            <css src="Magento_Swatches::css/swatches.css"/>
        </head>
        <body>
            <referenceBlock name="category.product.type.details.renderers">
                <block class="Magento\Swatches\Block\Product\Renderer\Listing\Configurable" as="configurable"
                                 template="Magento_Swatches::product/listing/renderer.phtml" />
            </referenceBlock>
        </body>
    </page>

    Read more »