private function joinStorePosition(\Magento\Framework\Db\Select &$select, $storeId, $useStorePositionsValue)
    {
        $useStorePositionsAttr  = $this->getUseStorePositionsAttribute();

        if ($useStorePositionsAttr && $useStorePositionsAttr->getAttributeId()) {
            $linkField = $this->getEntityMetaData(CategoryInterface::class)->getLinkField();

            $conditions    = [
                "p.category_id = use_store_positions.{$linkField}",
                "use_store_positions.store_id = " . (int) $storeId,
                "use_store_positions.attribute_id = " . (int) $useStorePositionsAttr->getAttributeId(),
            ];
            $joinCondition = new \Zend_Db_Expr(implode(" AND ", $conditions));

            $select->joinLeft(
                ['use_store_positions' => $useStorePositionsAttr->getBackendTable()],
                $joinCondition,
                []
            );

            $select->where(
                $this->getConnection()->quoteInto(
                    "COALESCE(use_store_positions.value, 0) = ?",
                    $useStorePositionsValue
                )
            );
        }
    }
private function joinStorePosition(\Magento\Framework\Db\Select &$select, $storeId, $useStorePositionsValue)
    {
        $useStorePositionsAttr  = $this->getUseStorePositionsAttribute();

        if ($useStorePositionsAttr && $useStorePositionsAttr->getAttributeId()) {
            $linkField = $this->getEntityMetaData(CategoryInterface::class)->getLinkField();

            $conditions    = [
                "p.category_id = use_store_positions.{$linkField}",
                "use_store_positions.store_id = " . (int) $storeId,
                "use_store_positions.attribute_id = " . (int) $useStorePositionsAttr->getAttributeId(),
            ];
            $joinCondition = new \Zend_Db_Expr(implode(" AND ", $conditions));

            $select->joinLeft(
                ['use_store_positions' => $useStorePositionsAttr->getBackendTable()],
                $joinCondition,
                []
            );

            $select->where(
                $this->getConnection()->quoteInto(
                    "COALESCE(use_store_positions.value, 0) = ?",
                    $useStorePositionsValue
                )
            );
        }
    }
private function joinStorePosition ( \ Magento \ Framework \ Db \ Select & $ select , $ storeId , $ useStorePositionsValue ) { $ useStorePositionsAttr = $ this -> getUseStorePositionsAttribute ( ) ; if ( $ useStorePositionsAttr && $ useStorePositionsAttr -> getAttributeId ( ) ) { $ linkField = $ this -> getEntityMetaData ( CategoryInterface :: class ) -> getLinkField ( ) ; $ conditions = [ "p.category_id = use_store_positions.{$linkField}" , "use_store_positions.store_id = " . ( int ) $ storeId , "use_store_positions.attribute_id = " . ( int ) $ useStorePositionsAttr -> getAttributeId ( ) , ] ; $ joinCondition = new \ Zend_Db_Expr ( implode ( " AND " , $ conditions ) ) ; $ select -> joinLeft ( [ 'use_store_positions' => $ useStorePositionsAttr -> getBackendTable ( ) ] , $ joinCondition , [ ] ) ; $ select -> where ( $ this -> getConnection ( ) -> quoteInto ( "COALESCE(use_store_positions.value, 0) = ?" , $ useStorePositionsValue ) ) ; } }
Process left join on a select to the 'use_store_positions' attribute backend table.

@param \Magento\Framework\Db\Select $select                 The select to alter
@param int                          $storeId                The store id
@param int                          $useStorePositionsValue The value of the use_store_positions attribute to select.
Process left join on a select to the use_store_positions attribute backend table .