private function addWebsiteFilter(\Magento\Framework\DB\Select $select, $productTableName, $productFieldName, $storeId)
    {
        $websiteId  = $this->getStore($storeId)->getWebsiteId();
        $indexTable = $this->getTable('catalog_product_website');

        $visibilityJoinCond = $this->getConnection()->quoteInto(
            "websites.product_id = $productTableName.$productFieldName AND websites.website_id = ?",
            $websiteId
        );

        $select->useStraightJoin(true)->join(['websites' => $indexTable], $visibilityJoinCond, []);

        return $select;
    }
private function addWebsiteFilter(\Magento\Framework\DB\Select $select, $productTableName, $productFieldName, $storeId)
    {
        $websiteId  = $this->getStore($storeId)->getWebsiteId();
        $indexTable = $this->getTable('catalog_product_website');

        $visibilityJoinCond = $this->getConnection()->quoteInto(
            "websites.product_id = $productTableName.$productFieldName AND websites.website_id = ?",
            $websiteId
        );

        $select->useStraightJoin(true)->join(['websites' => $indexTable], $visibilityJoinCond, []);

        return $select;
    }
private function addWebsiteFilter ( \ Magento \ Framework \ DB \ Select $ select , $ productTableName , $ productFieldName , $ storeId ) { $ websiteId = $ this -> getStore ( $ storeId ) -> getWebsiteId ( ) ; $ indexTable = $ this -> getTable ( 'catalog_product_website' ) ; $ visibilityJoinCond = $ this -> getConnection ( ) -> quoteInto ( "websites.product_id = $productTableName.$productFieldName AND websites.website_id = ?" , $ websiteId ) ; $ select -> useStraightJoin ( true ) -> join ( [ 'websites' => $ indexTable ] , $ visibilityJoinCond , [ ] ) ; return $ select ; }
Add website clauses to products selected.

@param \Magento\Framework\DB\Select $select           Original select.
@param string                       $productTableName Product table name in the original select.
@param string                       $productFieldName Product id field name in the original select.
@param int                          $storeId          Store id.

@return \Magento\Framework\DB\Select $select
Add website clauses to products selected .