cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with type Magento\Sales\Model\ResourceModel\Order\Invoice\Grid\Collection

Problem with type Magento\Sales\Model\ResourceModel\Order\Invoice\Grid\Collection

Hello since the update to magento 2.4 I have a problem on a module following the passage of Magento\Sales\Model\ResourceModel\Order\Invoice\Grid\Collection in virtualtype.

My plugin does not work.
In my di.xml I have this line

<type name="Magento\Sales\Model\ResourceModel\Order\Invoice\Grid\Collection">
<plugin name="adfab_gdpr_resource_order_invoice_grid_collection" type="Adfab\Gdpr\Model\ResourceModel\CollectionPlugin" />
</type>
 

And suddenly with the error: "Class "Magento\Sales\Model\ResourceModel\Order\Invoice\Grid\Collection\Interceptor" does not exist"

In the page admin/sales/order/index/

How to sol it Please ?
5 REPLIES 5

Re: Problem with type Magento\Sales\Model\ResourceModel\Order\Invoice\Grid\Collection

Hi @quatrys81100 ,

 

Please replace your below code:

 

From:

<type name="Magento\Sales\Model\ResourceModel\Order\Invoice\Grid\Collection">
<plugin name="adfab_gdpr_resource_order_invoice_grid_collection" type="Adfab\Gdpr\Model\ResourceModel\CollectionPlugin" />
</type>

 

To:

<type name="Magento\Sales\Model\ResourceModel\Order\Invoice\Orders\Grid\Collection">
<plugin name="adfab_gdpr_resource_order_invoice_grid_collection" type="Adfab\Gdpr\Model\ResourceModel\CollectionPlugin" />
</type>

 

Problem Solved? Accept as solution!

 

Hope it helps!

Thanks

Ankit Jasani

Re: Problem with type Magento\Sales\Model\ResourceModel\Order\Invoice\Grid\Collection

Hello Thanks

I have already tried this but already working in order page on invoice tab.

 

This Not working in /sales/invoice/index page on magento 2.4.5

Re: Problem with type Magento\Sales\Model\ResourceModel\Order\Invoice\Grid\Collection

Hi @quatrys81100 ,

 

Please try below.

 

<type name="Magento\Sales\Model\ResourceModel\Order\Invoice\Collection">
<plugin name="adfab_gdpr_resource_order_invoice_grid_collection" type="Adfab\Gdpr\Model\ResourceModel\CollectionPlugin" />
</type>

Problem Solved? Accept as solution.

 

Hope it helps!

Thanks

Ankit Jasani

Re: Problem with type Magento\Sales\Model\ResourceModel\Order\Invoice\Grid\Collection

Smiley Sad sorry not working

Re: Problem with type Magento\Sales\Model\ResourceModel\Order\Invoice\Grid\Collection

Hello In Magento 2.4.5 this collection is loaded like this :

 

    <virtualType name="Magento\Sales\Model\ResourceModel\Order\Invoice\Grid\Collection" type="Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult">
        <arguments>
            <argument name="mainTable" xsi:type="string">sales_invoice_grid</argument>
            <argument name="resourceModel" xsi:type="string">Magento\Sales\Model\ResourceModel\Order\Invoice</argument>
        </arguments>
    </virtualType>
 

How can we modify a collection? in the module that I want to modify which no longer works

the class CollectionPlugin has a function :
 
public function afterLoad( SourceProviderInterface $collection, $result ) {

        if ( $this->cipher->getIsIndexing() || $this->isRunning ) {

            return $result;

        }

        $this->isRunning = true;

        foreach( $collection->getItems() as $item ) {

           $this->decipher($item);

        }

        $this->isRunning = false;

        return $result;

    }
 
How to make this work in magento 2.4.5 for invoices page. Thanks