2

When you edit a product in the magento administration the number of items listed in the related products, up-sells and cross-sells list is limited to 20. Also there is no possibility to change this like in felt every other grid.

I tried to fix this programmatically by creating an observer which sets the default limit to 50. The observer is called correctly (when adminhtml_block_html_before is fired) but nothing changes.

Any thoughts on this?

0

Ok, I could fix this.

If you're interested:

create a new file

app/code/$yourModule/Catalog/etc/adminhtml/di.xml

with the following content

<?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\Catalog\Controller\Adminhtml\Product\Initialization\Helper\HandlerInterface" type="Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper\Plugin\Handler\Composite" />
<preference for="Magento\Catalog\Model\Locator\LocatorInterface" type="Magento\Catalog\Model\Locator\RegistryLocator"/>
<virtualType name="Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\Pool" type="Magento\Ui\DataProvider\Modifier\Pool">
    <arguments>
        <argument name="modifiers" xsi:type="array">
            <item name="related" xsi:type="array">
                <item name="class" xsi:type="string">$yourModule\Catalog\Ui\DataProvider\Product\Form\Modifier\Related</item>
                <item name="sortOrder" xsi:type="number">110</item>
            </item>
        </argument>
    </arguments>
</virtualType>

and copy from vendor the Related.php to

/app/code/$yourModule/Catalog/Ui/DataProvider/Product/Form/Modifier/Related.php

and add the pageSize to the config Array in the method getGrid.

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.