idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
43,800 | private function getApplier ( OptimizerInterface $ optimizer , $ providerType ) { $ provider = $ this -> providerFactory -> create ( $ providerType , [ 'optimizer' => $ optimizer ] ) ; return $ this -> applierListFactory -> create ( [ 'collectionProvider' => $ provider ] ) ; } | Retrieve applier of a given type for an optimizer . |
43,801 | public function aroundReindex ( \ Magento \ Catalog \ Model \ Category $ subject , callable $ proceed ) { $ proceed ( ) ; if ( $ subject -> getLevel ( ) > 1 ) { $ categoryIndexer = $ this -> indexerRegistry -> get ( \ Smile \ ElasticsuiteCatalog \ Model \ Category \ Indexer \ Fulltext :: INDEXER_ID ) ; if ( ! $ categor... | Reindex category s data after into search engine after reindexing the category |
43,802 | public function getVariables ( ) { $ variables = [ ] ; $ order = $ order = $ this -> checkoutSession -> getLastRealOrder ( ) ; if ( $ order ) { $ variables [ 'order.subtotal' ] = $ order -> getBaseSubtotalInclTax ( ) ; $ variables [ 'order.discount_total' ] = $ order -> getDiscountAmount ( ) ; $ variables [ 'order.ship... | Return order and it s item related variables |
43,803 | private function getOrderItemVariables ( $ item , $ itemId ) { $ variables = [ ] ; if ( ! $ item -> isDummy ( ) ) { $ prefix = "order.items.$itemId" ; $ variables [ $ prefix . '.sku' ] = $ item -> getSku ( ) ; $ variables [ $ prefix . '.product_id' ] = $ item -> getProductId ( ) ; $ variables [ $ prefix . '.qty' ] = $ ... | Retrieve tracking variables for an order item |
43,804 | public function buildSearchRequest ( RequestInterface $ request ) { $ searchRequest = [ 'size' => $ request -> getSize ( ) , ] ; if ( $ searchRequest [ 'size' ] > 0 ) { $ searchRequest [ 'sort' ] = $ this -> getSortOrders ( $ request ) ; $ searchRequest [ 'from' ] = $ request -> getFrom ( ) ; } $ query = $ this -> getR... | Transform the search request into an ES request . |
43,805 | private function getRootFilter ( RequestInterface $ request ) { $ filter = null ; if ( $ request -> getFilter ( ) ) { $ filter = $ this -> queryBuilder -> buildQuery ( $ request -> getFilter ( ) ) ; } return $ filter ; } | Extract and build the root filter of the search request . |
43,806 | private function getSortOrders ( RequestInterface $ request ) { $ sortOrders = [ ] ; if ( $ request -> getSortOrders ( ) ) { $ sortOrders = $ this -> sortOrderBuilder -> buildSortOrders ( $ request -> getSortOrders ( ) ) ; } return $ sortOrders ; } | Extract and build sort orders of the search request . |
43,807 | private function getAggregations ( RequestInterface $ request ) { $ aggregations = [ ] ; if ( $ request -> getAggregation ( ) ) { $ aggregations = $ this -> aggregationBuilder -> buildAggregations ( $ request -> getAggregation ( ) ) ; } return $ aggregations ; } | Extract and build aggregations of the search request . |
43,808 | public function cleanIndex ( $ dimensions ) { foreach ( $ dimensions as $ dimension ) { $ this -> indexOperation -> createIndex ( $ this -> indexName , $ dimension -> getValue ( ) ) ; } return $ this ; } | This override does not delete data into the old index as expected but only create a new index . It allows to keep old index in place during full reindex . |
43,809 | private function getDatasources ( $ indexName ) { $ config = $ this -> indexSettings -> getIndexConfig ( $ indexName ) ; $ legacyDatasources = $ config [ 'datasources' ] ?? [ ] ; $ resolver = $ this -> dataSourceResolverFactory -> create ( [ 'legacyDataSources' => [ $ indexName => $ legacyDatasources ] ] ) ; $ sources ... | Retrieve data sources of an index by name . |
43,810 | private function decodeParams ( $ params ) { if ( is_string ( $ params ) ) { $ params = urldecode ( $ params ) ; } elseif ( is_array ( $ params ) ) { foreach ( $ params as & $ currentParam ) { $ currentParam = $ this -> decodeParams ( $ currentParam ) ; } } return $ params ; } | Decode URI params . |
43,811 | public function createThesaurusTable ( SchemaSetupInterface $ setup ) { $ table = $ setup -> getConnection ( ) -> newTable ( $ setup -> getTable ( ThesaurusInterface :: TABLE_NAME ) ) -> addColumn ( ThesaurusInterface :: THESAURUS_ID , \ Magento \ Framework \ DB \ Ddl \ Table :: TYPE_INTEGER , null , [ 'identity' => tr... | Create Thesaurus main table |
43,812 | public function appendIsActiveColumn ( SchemaSetupInterface $ setup ) { $ setup -> getConnection ( ) -> addColumn ( $ setup -> getTable ( ThesaurusInterface :: TABLE_NAME ) , ThesaurusInterface :: IS_ACTIVE , [ 'type' => \ Magento \ Framework \ DB \ Ddl \ Table :: TYPE_SMALLINT , 'nullable' => false , 'default' => 1 , ... | Add an is_active column to the Thesaurus table . |
43,813 | public function loadPriceData ( $ storeId , $ productIds ) { $ websiteId = $ this -> getStore ( $ storeId ) -> getWebsiteId ( ) ; $ baseSelects = [ ] ; foreach ( $ this -> getPriceIndexDimensionsTables ( $ websiteId ) as $ dimensionsTable ) { $ baseSelects [ ] = $ this -> getLoadPriceDataSelect ( $ dimensionsTable , $ ... | Load prices data for a list of product ids and a given store . |
43,814 | private function getLoadPriceDataSelect ( $ indexTable , $ websiteId , $ productIds ) { $ select = $ this -> getConnection ( ) -> select ( ) -> from ( [ 'p' => $ indexTable ] ) -> where ( 'p.website_id = ?' , $ websiteId ) -> where ( 'p.entity_id IN(?)' , $ productIds ) ; return $ select ; } | Return a single price loading query against a specific price index table . |
43,815 | private function getPriceIndexDimensionsTables ( $ websiteId ) { $ tables = [ ] ; $ indexDimensions = $ this -> getPriceIndexDimensions ( $ websiteId ) ; foreach ( $ indexDimensions as $ dimensions ) { $ tables [ ] = $ this -> priceTableResolver -> resolve ( 'catalog_product_index_price' , $ dimensions ) ; } return $ t... | Return the price index tables according to the price index dimensions for the given website . |
43,816 | private function getPriceIndexDimensions ( $ websiteId ) { if ( ! array_key_exists ( $ websiteId , $ this -> dimensionsByWebsite ) ) { $ indexDimensions = $ this -> getAllPriceIndexDimensions ( ) ; $ relevantDimensions = [ ] ; foreach ( $ indexDimensions as $ dimensions ) { if ( array_key_exists ( WebsiteDimensionProvi... | Return price index dimensions applicable for the given website . |
43,817 | private function getAllPriceIndexDimensions ( ) { if ( $ this -> dimensions === null ) { $ this -> dimensions = $ this -> dimensionCollectionFactory -> create ( ) ; } return $ this -> dimensions ; } | Return all price index dimensions . |
43,818 | private function addCategoryData ( $ data ) { $ category = $ data [ 'category' ] ; $ documentSource = $ category -> getDocumentSource ( ) ; $ title = $ documentSource [ 'name' ] ; if ( is_array ( $ title ) ) { $ title = current ( $ title ) ; } $ categoryData = [ 'title' => html_entity_decode ( $ title ) , 'url' => $ th... | Load category data and append them to the original data . |
43,819 | private function getCategoryUrl ( $ category ) { $ documentSource = $ category -> getDocumentSource ( ) ; if ( $ documentSource && isset ( $ documentSource [ 'url_path' ] ) ) { $ urlPath = is_array ( $ documentSource [ 'url_path' ] ) ? current ( $ documentSource [ 'url_path' ] ) : $ documentSource [ 'url_path' ] ; $ ur... | Retrieve category Url from the document source . Done from the document source to prevent having to use addUrlRewrite to result on category collection . |
43,820 | private function getCategoryBreadcrumb ( \ Magento \ Catalog \ Model \ Category $ category ) { $ path = $ category -> getPath ( ) ; $ rawPath = explode ( '/' , $ path ) ; $ rawPath = array_slice ( $ rawPath , 2 ) ; array_pop ( $ rawPath ) ; $ breadcrumb = [ ] ; foreach ( $ rawPath as $ categoryId ) { $ breadcrumb [ ] =... | Return a mini - breadcrumb for a category |
43,821 | private function getCategoryNameById ( $ categoryId , $ storeId ) { if ( ! isset ( $ this -> categoryNames [ $ categoryId ] ) ) { $ categoryResource = $ this -> categoryResource ; $ this -> categoryNames [ $ categoryId ] = $ categoryResource -> getAttributeRawValue ( $ categoryId , "name" , $ storeId ) ; } return $ thi... | Retrieve a category name by it s id and store it in local cache |
43,822 | public function addFieldsToFilter ( $ fields ) { if ( $ fields ) { foreach ( $ fields as $ fieldByType ) { foreach ( $ fieldByType as $ attributeId => $ condition ) { $ attributeCode = $ this -> getEntity ( ) -> getAttribute ( $ attributeId ) -> getAttributeCode ( ) ; $ condition = $ this -> cleanCondition ( $ conditio... | Add multiple fields to filter |
43,823 | private function cleanCondition ( $ condition ) { if ( is_array ( $ condition ) ) { $ condition = array_filter ( $ condition ) ; if ( empty ( $ condition ) ) { $ condition = null ; } } return $ condition ; } | Ensure proper building of condition |
43,824 | public function getCategorySearchQuery ( ContainerConfigurationInterface $ containerConfigurationInterface , CategoryInterface $ category ) { $ filters = array_merge ( [ 'category' => $ this -> categoryFilterProvider -> getQueryFilter ( $ category ) ] , $ containerConfigurationInterface -> getFilters ( ) ) ; $ filterQu... | Retrieve Search Query for a category |
43,825 | public function execute ( ) { $ events = $ this -> eventQueue -> getEvents ( $ this -> chunkSize ) ; if ( ! empty ( $ events ) ) { $ this -> eventIndex -> indexEvents ( $ events ) ; $ this -> sessionIndex -> indexEvents ( $ events ) ; $ this -> eventQueue -> deleteEvents ( array_column ( $ events , 'event_id' ) ) ; } } | Run the indexation . |
43,826 | private function getAttributeCode ( ) { $ attributeCode = false ; if ( $ this -> request -> isAjax ( ) && $ this -> request -> getParam ( 'filterName' ) ) { $ attributeCode = ( string ) $ this -> request -> getParam ( 'filterName' ) ; } return $ attributeCode ; } | Get attribute code |
43,827 | private function getFilterField ( ) { try { $ attribute = $ this -> getAttribute ( ) ; $ field = $ this -> mappingHelper -> getFilterField ( $ attribute ) ; } catch ( \ Magento \ Framework \ Exception \ NoSuchEntityException $ exception ) { $ field = $ this -> getAttributeCode ( ) ; } return $ field ; } | Get filter field |
43,828 | public function get ( ) { $ identities = [ ] ; $ origData = $ this -> optimizer -> getOrigData ( ) ; $ containers = $ this -> optimizer -> getData ( 'search_container' ) ?? [ ] ; if ( ! $ this -> optimizer -> isObjectNew ( ) ) { $ containers = array_unique ( array_keys ( array_merge ( $ this -> optimizer -> getSearchCo... | Get Limitation identities for the current optimizer . |
43,829 | private function getSearchQueryIdentities ( ) { $ identities = [ ] ; $ queryIds = [ ] ; $ origData = $ this -> optimizer -> getOrigData ( ) ; $ data = $ this -> optimizer -> getData ( ) ; $ isAppliedToAllQueries = empty ( $ data [ 'quick_search_container' ] ) || ( bool ) $ data [ 'quick_search_container' ] [ 'apply_to'... | Get search queries identities related to current optimizer . |
43,830 | private function getCategoryIdentities ( ) { $ identities = [ ] ; $ categoryIds = [ ] ; $ origData = $ this -> optimizer -> getOrigData ( ) ; $ data = $ this -> optimizer -> getData ( ) ; $ isAppliedToAllCategories = empty ( $ data [ 'catalog_view_container' ] ) || ( bool ) $ data [ 'catalog_view_container' ] [ 'apply_... | Get category identities related to current optimizer . |
43,831 | private function getMaxCountCacheableSearchTerms ( int $ storeId ) { return $ this -> scopeConfig -> getValue ( PopularSearchTerms :: XML_PATH_MAX_COUNT_CACHEABLE_SEARCH_TERMS , \ Magento \ Store \ Model \ ScopeInterface :: SCOPE_STORE , $ storeId ) ; } | Retrieve maximum count cacheable search terms by Store . |
43,832 | public function saveEvent ( $ eventData ) { $ serializedEvent = $ this -> jsonSerializer -> serialize ( $ eventData ) ; $ insertData = [ 'event_id' => md5 ( $ serializedEvent . time ( ) ) , 'data' => $ serializedEvent ] ; $ this -> getConnection ( ) -> insertOnDuplicate ( $ this -> getMainTable ( ) , $ insertData , [ '... | Save an event to the queue . |
43,833 | public function getEvents ( $ limit = null ) { $ select = $ this -> getConnection ( ) -> select ( ) -> from ( $ this -> getMainTable ( ) ) ; if ( $ limit !== null ) { $ select -> limit ( $ limit ) ; } $ eventData = $ this -> getConnection ( ) -> fetchAll ( $ select ) ; foreach ( $ eventData as & $ currentEvent ) { $ cu... | Get event from the queue . |
43,834 | public function deleteEvents ( array $ eventIds ) { $ connection = $ this -> getConnection ( ) ; $ connection -> delete ( $ this -> getMainTable ( ) , $ connection -> quoteInto ( 'event_id IN(?)' , $ eventIds ) ) ; } | Clean event from the reindex queue . |
43,835 | public function getByProductIds ( array $ productIds , $ storeId ) { $ searchQueryTable = $ this -> getTable ( 'search_query' ) ; $ select = $ this -> getBaseSelect ( ) -> joinInner ( $ searchQueryTable , "main_table.query_id = {$searchQueryTable}.query_id" , [ ] ) -> where ( 'product_id IN(?)' , $ productIds ) -> wher... | Get query position for a product list . |
43,836 | public function getProductPositionsByQuery ( $ query ) { if ( is_object ( $ query ) ) { $ query = $ query -> getId ( ) ; } $ select = $ this -> getBaseSelect ( ) -> where ( 'query_id = ?' , ( int ) $ query ) -> where ( 'position IS NOT NULL' ) -> columns ( [ 'product_id' , 'position' ] ) -> order ( 'position' ) ; retur... | Load product positions for the given query . |
43,837 | private function reindex ( $ productIds ) { $ this -> indexerRegistry -> get ( \ Magento \ CatalogSearch \ Model \ Indexer \ Fulltext :: INDEXER_ID ) -> reindexList ( $ productIds ) ; } | Reindex product on position change . |
43,838 | public function execute ( ) { $ resultPage = $ this -> createPage ( ) ; if ( $ this -> getRequest ( ) -> getParam ( "type" ) ) { $ this -> _forward ( 'edit' ) ; return $ resultPage ; } $ resultPage -> getConfig ( ) -> getTitle ( ) -> prepend ( __ ( 'Create Thesaurus' ) ) ; $ resultPage -> addBreadcrumb ( __ ( 'Thesauru... | Render Thesaurus creation screen |
43,839 | public function isPageCacheable ( ) { $ result = false ; $ pragma = $ this -> response -> getHeader ( 'pragma' ) ; if ( $ pragma ) { $ result = $ pragma -> getFieldValue ( ) === 'cache' ; } return $ result ; } | Check if current page is cacheable |
43,840 | public function convert ( $ source ) { $ xpath = new \ DOMXPath ( $ source ) ; $ defaultConfig = $ this -> getDefaultConfiguration ( $ xpath ) ; $ configuration = [ 'default' => $ defaultConfig ] ; foreach ( $ this -> getAllLanguages ( $ xpath ) as $ language ) { $ configuration [ $ language ] = $ this -> getLanguageCo... | Convert dom node tree to array . |
43,841 | private function getDefaultConfiguration ( \ DOMXPath $ xpath ) { $ charFilters = $ this -> parseFilters ( $ xpath , self :: CHAR_FILTER_TYPE_ROOT_NODE , self :: CHAR_FILTER_TYPE_NODE ) ; $ filters = $ this -> parseFilters ( $ xpath , self :: FILTER_TYPE_ROOT_NODE , self :: FILTER_TYPE_NODE ) ; $ analyzers = $ this -> ... | Return default configuration available for all languages . |
43,842 | private function getLanguageConfiguration ( \ DOMXPath $ xpath , $ language , array $ defaultConfig ) { $ languageCharFilters = $ this -> parseFilters ( $ xpath , self :: CHAR_FILTER_TYPE_ROOT_NODE , self :: CHAR_FILTER_TYPE_NODE , $ language ) ; $ charFilters = array_merge ( $ defaultConfig [ self :: CHAR_FILTER_TYPE_... | Return configuration for a given language . |
43,843 | private function getAllLanguages ( \ DOMXPath $ xpath ) { $ languages = [ ] ; foreach ( $ xpath -> query ( '//*[@language]' ) as $ currentNode ) { $ languages [ ] = $ currentNode -> getAttribute ( 'language' ) ; } return array_unique ( $ languages ) ; } | Parse languages available in the document . |
43,844 | private function parseFilters ( \ DOMXPath $ xpath , $ rootNodeName , $ nodeName , $ language = 'default' ) { $ filters = [ ] ; $ languagePath = sprintf ( "[@language='%s']" , $ language ) ; $ searchPath = sprintf ( "/%s/%s/%s%s" , self :: ROOT_NODE_NAME , $ rootNodeName , $ nodeName , $ languagePath ) ; $ filterNodes ... | Filters parser by language . |
43,845 | private function parseAnalyzers ( \ DOMXPath $ xpath , array $ availableCharFilters , array $ availableFilters , $ language = 'default' ) { $ analyzers = [ ] ; $ languagePath = "@language='default'" ; if ( $ language != 'default' ) { $ languagePath .= " or @language='{$language}'" ; } $ searchPath = sprintf ( '/%s/%s/%... | Analyzers parser by language . |
43,846 | private function getFiltersByRef ( \ DOMXPath $ xpath , \ DomNode $ rootNode , $ searchPath , array $ availableFilters ) { $ filters = [ ] ; $ filterNodes = $ xpath -> query ( $ searchPath , $ rootNode ) ; foreach ( $ filterNodes as $ filterNode ) { $ filterName = $ filterNode -> getAttribute ( 'ref' ) ; if ( in_array ... | Return all filters under a root node filtered by an array of available filters . |
43,847 | private function getCategorySearchQuery ( CategoryInterface $ category ) { $ virtualRule = $ category -> getVirtualRule ( ) ; if ( ! ( $ virtualRule instanceof VirtualRuleInterface ) ) { return $ this -> loadVirtualRule ( $ category ) -> getCategorySearchQuery ( $ category ) ; } return $ this -> helper -> loadUsingCach... | Get category search query |
43,848 | public function createOptimizerTable ( SchemaSetupInterface $ setup ) { if ( ! $ setup -> getConnection ( ) -> isTableExists ( $ setup -> getTable ( OptimizerInterface :: TABLE_NAME ) ) ) { $ table = $ setup -> getConnection ( ) -> newTable ( $ setup -> getTable ( OptimizerInterface :: TABLE_NAME ) ) -> addColumn ( Opt... | Create Optimizer main table . |
43,849 | public function createOptimizerSearchContainerTable ( SchemaSetupInterface $ setup ) { if ( ! $ setup -> getConnection ( ) -> isTableExists ( $ setup -> getTable ( OptimizerInterface :: TABLE_NAME_SEARCH_CONTAINER ) ) ) { $ table = $ setup -> getConnection ( ) -> newTable ( $ setup -> getTable ( OptimizerInterface :: T... | Create Optimizer Query table . |
43,850 | public function updateOptimizerSearchContainerTable ( SchemaSetupInterface $ setup ) { $ setup -> getConnection ( ) -> addColumn ( $ setup -> getTable ( OptimizerInterface :: TABLE_NAME_SEARCH_CONTAINER ) , 'apply_to' , [ 'type' => \ Magento \ Framework \ DB \ Ddl \ Table :: TYPE_BOOLEAN , 'nullable' => false , 'defaul... | Adding apply_to column to smile_elasticsuite_optimizer_search_container table |
43,851 | public function createOptimizerLimitationTable ( SchemaSetupInterface $ setup ) { if ( ! $ setup -> getConnection ( ) -> isTableExists ( $ setup -> getTable ( OptimizerInterface :: TABLE_NAME_LIMITATION ) ) ) { $ categoryIdField = $ this -> metadataPool -> getMetadata ( \ Magento \ Catalog \ Api \ Data \ CategoryInterf... | Create table containing entity association between optimizer and category_id or search_terms . |
43,852 | public function getSearchContainersFromOptimizerId ( $ optimizerId ) { $ connection = $ this -> getConnection ( ) ; $ select = $ connection -> select ( ) ; $ select -> from ( $ this -> getTable ( OptimizerInterface :: TABLE_NAME_SEARCH_CONTAINER ) , [ OptimizerInterface :: SEARCH_CONTAINER , 'apply_to' ] ) -> where ( O... | Retrieve Search Containers for a given optimizer . |
43,853 | private function saveSearchContainerRelation ( \ Magento \ Framework \ Model \ AbstractModel $ object ) { $ searchContainers = $ object -> getSearchContainer ( ) ; if ( is_array ( $ searchContainers ) && ( count ( $ searchContainers ) > 0 ) ) { $ searchContainerLinks = [ ] ; $ deleteCondition = OptimizerInterface :: OP... | Saves relation between optimizer and search container |
43,854 | protected function _checkUnique ( \ Magento \ Framework \ Model \ AbstractModel $ object ) { $ select = $ this -> getConnection ( ) -> select ( ) -> from ( $ this -> getMainTable ( ) , [ $ this -> getIdFieldName ( ) ] ) -> where ( 'scope = :scope' ) -> where ( 'scope_code = :scope_code' ) -> where ( 'path = :path' ) ; ... | Validate unique configuration data before save Set id to object if exists configuration instead of throw exception |
43,855 | protected function _isInheritCheckboxRequired ( \ Magento \ Framework \ Data \ Form \ Element \ AbstractElement $ element ) { return $ element -> getCanUseContainerValue ( ) || $ element -> getCanUseDefaultValue ( ) ; } | Check if inheritance checkbox has to be rendered |
43,856 | protected function _getInheritCheckboxLabel ( \ Magento \ Framework \ Data \ Form \ Element \ AbstractElement $ element ) { $ checkboxLabel = __ ( 'Use Default' ) ; if ( $ element -> getCanUseContainerValue ( ) ) { $ checkboxLabel = __ ( 'Use Container' ) ; } return $ checkboxLabel ; } | Retrieve label for the inheritance checkbox |
43,857 | private function getIds ( $ controller ) { $ ids = $ controller -> getRequest ( ) -> getParam ( 'selected' , [ ] ) ; if ( ! is_array ( $ ids ) ) { $ ids = [ ] ; } foreach ( $ ids as $ key => & $ id ) { $ id = ( int ) $ id ; if ( $ id <= 0 ) { unset ( $ ids [ $ key ] ) ; } } return array_unique ( $ ids ) ; } | Retrieve currently selected Ids . |
43,858 | public function getTermsData ( ) { $ data = [ ] ; try { $ data = $ this -> getReport ( ) -> getData ( ) ; } catch ( \ LogicException $ e ) { ; } foreach ( $ data as & $ value ) { $ value [ 'url' ] = $ this -> getMerchandiserUrl ( $ value [ 'term' ] ) ; } return $ data ; } | Get terms data from the report . |
43,859 | private function getMerchandiserUrl ( $ term ) { $ url = null ; $ query = $ this -> queryFactory -> create ( ) ; $ query -> loadByQueryText ( $ term ) ; if ( $ query -> getId ( ) ) { $ url = $ this -> getUrl ( 'search/term/edit' , [ 'id' => $ query -> getId ( ) ] ) ; } return $ url ; } | Get the term merchandiser URL for a given search term . |
43,860 | public function getAttributeCollection ( ) { if ( $ this -> attributeCollection === null ) { $ this -> attributeCollection = $ this -> attributeCollectionFactory -> create ( ) ; $ attributeNameMapping = array_flip ( $ this -> fieldNameMapping ) ; $ arrayNameCb = function ( FieldInterface $ field ) use ( $ attributeName... | Retrieve attribute collection prefiltered with only attribute usable in rules . |
43,861 | public function getField ( $ attributeName ) { if ( isset ( $ this -> fieldNameMapping [ $ attributeName ] ) ) { $ attributeName = $ this -> fieldNameMapping [ $ attributeName ] ; } return $ this -> getMapping ( ) -> getField ( $ attributeName ) ; } | Retrieve the mapping field for the rule attribute . |
43,862 | private function getMapping ( ) { if ( $ this -> mapping === null ) { $ defaultStore = $ this -> getDefaultStoreView ( ) ; $ index = $ this -> indexManager -> getIndexByName ( $ this -> indexName , $ defaultStore ) ; $ this -> mapping = $ index -> getMapping ( ) ; } return $ this -> mapping ; } | Retrieve the search engine mapping . |
43,863 | private function getDefaultStoreView ( ) { $ store = $ this -> storeManager -> getDefaultStoreView ( ) ; if ( null === $ store ) { $ store = current ( $ this -> storeManager -> getWebsites ( ) ) -> getDefaultStore ( ) ; } return $ store ; } | Retrieve default Store View |
43,864 | public function getScope ( ) { return $ this -> request -> getParam ( 'store' ) ? ContainerScopeInterface :: SCOPE_STORE_CONTAINERS : ( $ this -> request -> getParam ( 'container' ) ? ContainerScopeInterface :: SCOPE_CONTAINERS : ContainerScopeInterface :: SCOPE_DEFAULT ) ; } | Retrieve current config scope |
43,865 | public function convert ( $ source ) { $ indices = [ ] ; $ xpath = new \ DOMXPath ( $ source ) ; $ indexSearchPath = sprintf ( "/%s/%s" , self :: ROOT_NODE_NAME , self :: INDEX_NODE_TYPE ) ; foreach ( $ xpath -> query ( $ indexSearchPath ) as $ indexNode ) { $ indexIdentifier = $ indexNode -> getAttribute ( 'identifier... | Convert dom node tree to array |
43,866 | private function parseIndexConfig ( \ DOMXPath $ xpath , \ DOMNode $ indexRootNode ) { $ indexConfig = [ 'types' => [ ] ] ; $ typesSearchPath = sprintf ( '%s' , self :: TYPE_NODE_TYPE ) ; $ xpath -> query ( $ typesSearchPath , $ indexRootNode ) ; foreach ( $ xpath -> query ( $ typesSearchPath , $ indexRootNode ) as $ t... | Parse index node configuration . |
43,867 | private function parseTypeConfig ( \ DOMXPath $ xpath , \ DOMNode $ typeRootNode ) { $ staticFields = $ this -> parseMappingFields ( $ xpath , $ typeRootNode ) ; $ idFieldName = $ typeRootNode -> getAttribute ( 'idFieldName' ) ; $ datasources = $ this -> parseDatasources ( $ xpath , $ typeRootNode ) ; $ mappingParams =... | Parse type node configuration . |
43,868 | private function parseMappingFields ( \ DOMXPath $ xpath , \ DOMNode $ typeRootNode ) { $ fields = [ ] ; $ fieldSearchPath = sprintf ( '%s/%s' , self :: MAPPING_NODE_TYPE , self :: MAPPING_FIELD_NODE_TYPE ) ; foreach ( $ xpath -> query ( $ fieldSearchPath , $ typeRootNode ) as $ fieldNode ) { $ fields [ $ fieldNode -> ... | Parse type fields from type node configuration . |
43,869 | private function parseDatasources ( \ DOMXPath $ xpath , \ DOMNode $ typeRootNode ) { $ datasources = [ ] ; foreach ( $ xpath -> query ( self :: DATASOURCES_PATH , $ typeRootNode ) as $ datasourceNode ) { $ datasources [ $ datasourceNode -> getAttribute ( 'name' ) ] = $ datasourceNode -> nodeValue ; } return $ datasour... | Parse datasources from type node configuration . |
43,870 | private function createMappingField ( \ DOMNode $ fieldNode ) { $ fieldParam = [ 'type' => $ fieldNode -> getAttribute ( 'type' ) ] ; if ( $ fieldNode -> hasAttribute ( 'nestedPath' ) ) { $ fieldParam [ 'nestedPath' ] = $ fieldNode -> getAttribute ( 'nestedPath' ) ; } foreach ( $ fieldNode -> childNodes as $ childNode ... | Parse field configuration params . |
43,871 | private function underscore ( $ name ) { if ( ! isset ( $ this -> underscoreCache [ $ name ] ) ) { $ this -> underscoreCache [ $ name ] = strtolower ( preg_replace ( '/(.)([A-Z])/' , "$1_$2" , $ name ) ) ; } return $ this -> underscoreCache [ $ name ] ; } | Converts tag name from camelCase to snake_case |
43,872 | private function getQueryFilter ( ) { $ query = null ; $ this -> category -> setIsActive ( true ) ; if ( $ this -> category -> getIsVirtualCategory ( ) || $ this -> category -> getId ( ) ) { $ query = $ this -> category -> getVirtualRule ( ) -> getCategorySearchQuery ( $ this -> category ) ; } if ( ( bool ) $ this -> c... | Return the filter applied to the query . |
43,873 | protected function processFullTextIndex ( $ ids ) { $ fullTextIndexer = $ this -> indexerRegistry -> get ( \ Magento \ CatalogSearch \ Model \ Indexer \ Fulltext :: INDEXER_ID ) ; if ( ! is_array ( $ ids ) ) { $ ids = [ $ ids ] ; } $ parentIds = $ this -> fullIndexer -> getRelationsByChild ( $ ids ) ; $ processIds = $ ... | Process full - text reindex for product ids |
43,874 | private function getCurrentCategory ( ) { $ category = $ this -> context -> getCurrentCategory ( ) ; if ( null === $ category ) { $ category = $ this -> categoryRepository -> get ( $ this -> storeManager -> getStore ( ) -> getRootCategoryId ( ) , $ this -> storeManager -> getStore ( ) -> getId ( ) ) ; } return $ catego... | Retrieve current category from search context or instantiate the default root of current store . |
43,875 | public function getRequest ( ) { $ storeId = $ this -> context -> getStoreId ( ) ; $ aggregations = $ this -> getAggregations ( ) ; $ searchQuery = $ this -> getSearchQuery ( ) ; return $ this -> searchRequestBuilder -> create ( $ storeId , $ this -> containerName , 0 , 0 , null , [ ] , [ ] , $ searchQuery , $ aggregat... | Get request . |
43,876 | private function getAggregations ( ) { $ aggs = [ ] ; foreach ( $ this -> aggregationProviders as $ aggregationProvider ) { $ aggs [ ] = $ aggregationProvider -> getAggregation ( ) ; } return $ aggs ; } | Get aggregations . |
43,877 | protected function getFilterItemByLabel ( array $ filterItems , $ filterLabel ) { foreach ( $ filterItems as $ item ) { if ( ( string ) $ item -> getValue ( ) === ( string ) $ filterLabel ) { return $ item ; } } return false ; } | Fetch Filter item by it s label . |
43,878 | private function getVirtualRuleReadHandler ( ) { if ( $ this -> virtualRuleReadHandler === null ) { $ this -> virtualRuleReadHandler = $ this -> _universalFactory -> create ( VirtualRuleReadHandler :: class ) ; } return $ this -> virtualRuleReadHandler ; } | Virtual rule read handler . |
43,879 | public function getNewChildUrl ( ) { $ urlParams = [ 'form' => $ this -> getElement ( ) -> getContainer ( ) -> getHtmlId ( ) , 'element_name' => $ this -> getElement ( ) -> getName ( ) , ] ; if ( is_array ( $ this -> getData ( 'url_params' ) ) ) { $ urlParams = array_merge ( $ urlParams , $ this -> getData ( 'url_param... | Get URL used to create a new child condition into the rule . |
43,880 | public function getInputHtml ( ) { $ this -> rule -> setElementName ( $ this -> element -> getName ( ) ) ; if ( $ this -> element -> getValue ( ) ) { $ conditions = $ this -> element -> getValue ( ) ; if ( ! is_array ( $ conditions ) ) { $ conditions = $ conditions -> getConditions ( ) -> asArray ( ) ; } $ this -> rule... | Render HTML of the element using the rule engine . |
43,881 | private function setConditionFormName ( \ Magento \ Rule \ Model \ Condition \ AbstractCondition $ conditions , $ formName ) { $ conditions -> setJsFormObject ( $ formName ) ; if ( $ conditions -> getConditions ( ) && is_array ( $ conditions -> getConditions ( ) ) ) { foreach ( $ conditions -> getConditions ( ) as $ co... | Set proper form name to rule conditions . |
43,882 | private function setConditionUrlParams ( \ Magento \ Rule \ Model \ Condition \ AbstractCondition $ conditions , $ urlParams ) { $ conditions -> setUrlParams ( $ urlParams ) ; if ( $ conditions -> getConditions ( ) && is_array ( $ conditions -> getConditions ( ) ) ) { foreach ( $ conditions -> getConditions ( ) as $ co... | Set proper url params to rule conditions . |
43,883 | public function afterGetSortOrders ( RequestMapper $ subject , $ result , ContainerConfigurationInterface $ containerConfiguration , SearchCriteriaInterface $ searchCriteria ) { if ( $ this -> isEnabled ( $ containerConfiguration ) ) { $ sortOrders = [ ] ; if ( $ containerConfiguration -> getName ( ) == "catalog_view_c... | Post process catalog sort orders . |
43,884 | public function afterGetFilters ( RequestMapper $ subject , $ result , ContainerConfigurationInterface $ containerConfiguration , SearchCriteriaInterface $ searchCriteria ) { if ( $ this -> isEnabled ( $ containerConfiguration ) ) { $ filters = [ ] ; foreach ( $ result as $ fieldName => $ filterValue ) { $ fieldName = ... | Post process catalog filters . |
43,885 | private function getMappingField ( ContainerConfigurationInterface $ containerConfiguration , $ fieldName ) { if ( isset ( $ this -> fieldMapper [ $ fieldName ] ) ) { $ fieldName = $ this -> fieldMapper [ $ fieldName ] ; } try { $ optionTextFieldName = $ this -> mappingHelper -> getOptionTextFieldName ( $ fieldName ) ;... | Name of the field in the search engine mapping . |
43,886 | private function getCurrentCategoryId ( ContainerConfigurationInterface $ containerConfiguration , SearchCriteriaInterface $ searchCriteria ) { $ store = $ this -> storeManager -> getStore ( $ containerConfiguration -> getStoreId ( ) ) ; $ categoryId = $ this -> storeManager -> getGroup ( $ store -> getStoreGroupId ( )... | Return current category id for the search request . |
43,887 | private function updateSearchContext ( $ storeId , $ categoryId ) { $ this -> searchContext -> setStoreId ( $ storeId ) ; $ category = $ this -> categoryRepository -> get ( $ categoryId , $ storeId ) ; if ( $ category -> getId ( ) ) { $ this -> searchContext -> setCurrentCategory ( $ category ) ; } } | Update the search context using current store id and category Id . |
43,888 | public function getSearchRequestParams ( ContainerConfigurationInterface $ containerConfig , $ category = null , $ queryText = null , $ size = 20 ) { $ sortOrders = [ ] ; $ query = $ this -> queryFactory -> create ( \ Magento \ Framework \ Search \ Request \ QueryInterface :: TYPE_BOOL , [ ] ) ; if ( $ queryText !== nu... | Prepare the Search Request Params |
43,889 | private function getConversionRateAggregation ( ) { return $ this -> aggregationFactory -> create ( BucketInterface :: TYPE_QUERY_GROUP , [ 'queries' => [ 'sales' => $ this -> queryFactory -> create ( QueryInterface :: TYPE_EXISTS , [ 'field' => 'product_sale' ] ) , ] , 'name' => 'conversion' , ] ) ; } | Return the child aggregation used to compute the conversion rate of sessions . |
43,890 | public function aroundGetNoteMessages ( Result $ resultBlock , \ Closure $ proceed ) { $ messages = $ proceed ( ) ; $ query = $ this -> queryFactory -> get ( ) ; $ query -> setNumResults ( $ this -> resultCount ) ; $ query -> setIsSpellchecked ( false ) ; $ isSpellcheck = $ resultBlock -> getListBlock ( ) -> getLoadedP... | Append the fuzziness alert message + save the search result count . |
43,891 | public function aroundGetResultCount ( Result $ resultBlock , \ Closure $ proceed ) { if ( $ this -> resultCount === null ) { $ size = $ resultBlock -> getListBlock ( ) -> getLoadedProductCollection ( ) -> getSize ( ) ; $ this -> resultCount = $ size ; } return $ this -> resultCount ; } | Avoid the search result count to be saved by the original method . |
43,892 | public function aroundSetListOrders ( Result $ resultBlock , \ Closure $ proceed ) { $ proceed ( ) ; $ resultBlock -> getListBlock ( ) -> setDefaultDirection ( 'asc' ) ; return $ resultBlock ; } | Change default behavior of the search result block . Order has to be set to ASC and not DESC . |
43,893 | public function getCategorySearchQuery ( $ category , $ excludedCategories = [ ] ) { $ query = null ; if ( ! is_object ( $ category ) ) { $ category = $ this -> categoryFactory -> create ( ) -> setStoreId ( $ this -> getStoreId ( ) ) -> load ( $ category ) ; } if ( ! in_array ( $ category -> getId ( ) , $ excludedCateg... | Build search query by category . |
43,894 | public function getSearchQueriesByChildren ( CategoryInterface $ rootCategory ) { $ queries = [ ] ; $ childrenIds = $ rootCategory -> getResource ( ) -> getChildren ( $ rootCategory , false ) ; if ( ! empty ( $ childrenIds ) ) { $ storeId = $ this -> getStoreId ( ) ; $ categoryCollection = $ this -> categoryCollectionF... | Retrieve search queries of children categories . |
43,895 | private function getVirtualRootCategory ( CategoryInterface $ category ) { $ storeId = $ this -> getStoreId ( ) ; $ rootCategory = $ this -> categoryFactory -> create ( ) -> setStoreId ( $ storeId ) ; if ( $ category -> getVirtualCategoryRoot ( ) !== null && ! empty ( $ category -> getVirtualCategoryRoot ( ) ) ) { $ ro... | Load the root category used for a virtual category . |
43,896 | private function getStandardCategoriesQuery ( array $ categoryIds , $ excludedCategories ) { $ conditionsParams = [ 'data' => [ 'attribute' => 'category_ids' , 'operator' => '()' , 'value' => $ categoryIds ] ] ; $ categoryCondition = $ this -> productConditionsFactory -> create ( $ conditionsParams ) ; return $ this ->... | Transform a category ids list in query rule . |
43,897 | private function getVirtualCategoryQuery ( CategoryInterface $ category , $ excludedCategories = [ ] ) { $ query = $ category -> getVirtualRule ( ) -> getConditions ( ) -> getSearchQuery ( $ excludedCategories ) ; $ parentCategory = $ this -> getVirtualRootCategory ( $ category ) ; if ( $ parentCategory && in_array ( $... | Transform the virtual category into a QueryInterface used for filtering . |
43,898 | private function addChildrenQueries ( $ query , CategoryInterface $ category , $ excludedCategories = [ ] ) { $ childrenCategories = $ this -> getChildrenCategories ( $ category , $ excludedCategories ) ; $ childrenCategoriesIds = [ ] ; if ( $ childrenCategories -> getSize ( ) > 0 && $ query !== null ) { $ queryParams ... | Append children queries to the rule . |
43,899 | private function getChildrenCategories ( CategoryInterface $ category , $ excludedCategories = [ ] ) { $ storeId = $ category -> getStoreId ( ) ; $ categoryCollection = $ this -> categoryCollectionFactory -> create ( ) -> setStoreId ( $ storeId ) ; $ categoryCollection -> addIsActiveFilter ( ) -> addPathFilter ( sprint... | Returns the list of the virtual categories available under a category . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.