public function beforeLoad($collection, $printQuery=false, $logQuery=false)
    {
		if (!$collection->isLoaded()) {
			$select = $collection->getSelect();	
			$connection = $select->getConnection();
			
			$select->joinLeft(
				['sale_flag' => $collection->getTable('faonni_catalog_product_index_sale')],
				join(
					' AND ',
					[
						'e.entity_id = sale_flag.entity_id',
						$connection->quoteInto('sale_flag.website_id = ?', $this->_storeManager->getStore()->getWebsiteId())
					]
				),
				['is_sale' => $connection->getCheckSql('sale_flag.entity_id IS NULL', '0', '1')]
			);
		}
        return null;
    }
public function beforeLoad($collection, $printQuery=false, $logQuery=false)
    {
		if (!$collection->isLoaded()) {
			$select = $collection->getSelect();	
			$connection = $select->getConnection();
			
			$select->joinLeft(
				['sale_flag' => $collection->getTable('faonni_catalog_product_index_sale')],
				join(
					' AND ',
					[
						'e.entity_id = sale_flag.entity_id',
						$connection->quoteInto('sale_flag.website_id = ?', $this->_storeManager->getStore()->getWebsiteId())
					]
				),
				['is_sale' => $connection->getCheckSql('sale_flag.entity_id IS NULL', '0', '1')]
			);
		}
        return null;
    }
public function beforeLoad ( $ collection , $ printQuery = false , $ logQuery = false ) { if ( ! $ collection -> isLoaded ( ) ) { $ select = $ collection -> getSelect ( ) ; $ connection = $ select -> getConnection ( ) ; $ select -> joinLeft ( [ 'sale_flag' => $ collection -> getTable ( 'faonni_catalog_product_index_sale' ) ] , join ( ' AND ' , [ 'e.entity_id = sale_flag.entity_id' , $ connection -> quoteInto ( 'sale_flag.website_id = ?' , $ this -> _storeManager -> getStore ( ) -> getWebsiteId ( ) ) ] ) , [ 'is_sale' => $ connection -> getCheckSql ( 'sale_flag.entity_id IS NULL' , '0' , '1' ) ] ) ; } return null ; }
Load collection data into object items

@param \Magento\Catalog\Model\ResourceModel\Product\Collection $collection
@param bool $printQuery
@param bool $logQuery
@return null
Load collection data into object items