微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在发票网格 magento 2.3.2 中显示订购的产品列表

如何解决在发票网格 magento 2.3.2 中显示订购的产品列表

我试图在发票网格中显示订购的产品列表。我试过下面的代码

app\code\Magento\Sales\Model\ResourceModel\Order\Invoice\Grid\Collection.PHP

<?PHP
/**
 * copyright © Magento,Inc. All rights reserved.
 * See copYING.txt for license details.
 */

namespace Magento\Sales\Model\ResourceModel\Order\Invoice\Grid;

use Magento\Framework\Data\Collection\Db\FetchStrategyInterface as FetchStrategy;
use Magento\Framework\Data\Collection\EntityFactoryInterface as EntityFactory;
use Magento\Framework\Event\ManagerInterface as EventManager;
use Magento\Sales\Ui\Component\DataProvider\Document;
use Psr\Log\LoggerInterface as Logger;

class Collection extends \Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult
{
    /**
     * @inheritdoc
     */
    protected $document = Document::class;
    
    /**
     * Initialize dependencies.
     *
     * @param EntityFactory $entityFactory
     * @param Logger $logger
     * @param FetchStrategy $fetchStrategy
     * @param EventManager $eventManager
     * @param string $mainTable
     * @param string $resourceModel
     */
    public function __construct(
        EntityFactory $entityFactory,Logger $logger,FetchStrategy $fetchStrategy,EventManager $eventManager,$mainTable = 'sales_invoice_grid',$resourceModel = \Magento\Sales\Model\ResourceModel\Order\Invoice::class
    ) {
        parent::__construct($entityFactory,$logger,$fetchStrategy,$eventManager,$mainTable,$resourceModel);
    }
 
     protected function _renderFiltersBefore()
    {
    $joinTable = $this->getTable('sales_order_address');
    
   $this->getSelect()->joinLeft($joinTable,"main_table.order_id = 
{$joinTable}.parent_id AND {$joinTable}.address_type = 'billing'",['telephone','city','region','country_id']);
       
        
       parent::_renderFiltersBefore();
   }
   
}

代码有效。但是记录数显示错误的。如何纠正它。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。