2

I've disabled the Magento_Bundle module because I don't need it.
But now when I try to set the catalogsearch_fulltext index to schedule via cli:

php bin/magento indexer:set-mode schedule catalogsearch_fulltext I get an error :

Catalog Search indexer process unknown error:

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'catalog_product_bundle_selection' doesn't exist, query was: CREATE TRIGGER trg_catalog_product_bundle_selection_after_insert AFTER INSERT ON catalog_product_bundle_selection FOR EACH ROW BEGIN INSERT IGNORE INTO catalogsearch_fulltext_cl (entity_id) VALUES (NEW.parent_product_id); END

Tracked this down and apparently this happens because in the Magento_CatalogSearch module in etc/mview.xml file, there is this line specified for the index catalogsearch_fulltext <table name="catalog_product_bundle_selection" entity_column="parent_product_id" />.
removing the line mentioned above makes everything work as expected. Obviously I cannot remove the config setting.
Any ideas on how I can bypass it?

1

I solved this with a workaround.
I added an after plugin for the method Magento\Framework\Mview\View::getSubscriptions that removes the catalog_product_bundle_selection if the bundle module is disabled.

di.xml looks like this:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Framework\Mview\View">
        <plugin name="remove-bundle-dependency" type="[Vendor]\[Module]\Plugin\Mview\ViewPlugin"/>
    </type>
</config>

[Vendor]/[Module]/Plugin/Mview/WiewPlugin.php looks like this.

<?php
namespace [Vendor]\[Module]\Plugin\Mview;

class ViewPlugin
{
    /**
     * @var \Magento\Framework\Module\ModuleList
     */
    private $moduleList;

    /**
     * ViewPlugin constructor.
     * @param ModuleList $moduleList
     */
    public function __construct(\Magento\Framework\Module\ModuleList $moduleList)
    {
        $this->moduleList = $moduleList;
    }

    /**
     * @param View $subject
     * @param $subscriptions
     * @return array
     */
    public function afterGetSubscriptions(\Magento\Framework\Mview\View $subject, $subscriptions)
    {
        if (!$this->moduleList->has('Magento_Bundle')) {
            unset($subscriptions['catalog_product_bundle_selection']);
        }
        return $subscriptions;
    }
}

Also posted this as an issue on the magento 2 repo: #19719

  • You got the solution and post on github., Excellent – Amit Bera Dec 14 '18 at 10:15

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.