idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
43,700
public function getScopeLabel ( Field $ field ) { $ showInStore = $ field -> showInStore ( ) ; $ showInContainer = $ field -> showInContainer ( ) ; if ( $ showInStore == 1 ) { return $ this -> _scopeLabels [ ContainerScopeInterface :: SCOPE_STORE_CONTAINERS ] ; } elseif ( $ showInContainer == 1 ) { return $ this -> _sc...
Retrieve label for scope
43,701
public function getScope ( ) { $ scope = $ this -> getData ( 'scope' ) ; if ( $ scope === null ) { $ scope = ContainerScopeInterface :: SCOPE_DEFAULT ; if ( $ this -> getContainerCode ( ) ) { $ scope = ContainerScopeInterface :: SCOPE_CONTAINERS ; } if ( $ this -> getStoreCode ( ) ) { $ scope = ContainerScopeInterface ...
Retrieve current scope
43,702
public function getScopeCode ( ) { $ scopeCode = $ this -> getData ( 'scope_code' ) ; if ( $ scopeCode === null ) { $ scopeCode = 'default' ; if ( $ this -> getStoreCode ( ) ) { $ store = $ this -> _storeManager -> getStore ( $ this -> getStoreCode ( ) ) ; $ scopeCode = $ store -> getId ( ) ; if ( $ this -> getContaine...
Get current scope code
43,703
protected function _initObjects ( ) { $ this -> _configDataObject = $ this -> _configFactory -> create ( [ 'data' => [ 'section' => $ this -> getSectionCode ( ) , 'container' => $ this -> getContainerCode ( ) , 'store' => $ this -> getStoreCode ( ) , ] , ] ) ; $ this -> _configData = $ this -> _configDataObject -> load...
Initialize objects required to render config form
43,704
protected function _prepareLayout ( ) { $ section = $ this -> configStructure -> getElement ( $ this -> getRequest ( ) -> getParam ( 'section' ) ) ; $ this -> formBlockName = $ section -> getFrontendModel ( ) ; if ( empty ( $ this -> formBlockName ) ) { $ this -> formBlockName = self :: DEFAULT_SECTION_BLOCK ; } $ this...
Prepare layout object
43,705
public function getStoreIds ( ) { if ( $ this -> storeManager -> isSingleStoreMode ( ) ) { $ this -> storeIds = [ $ this -> storeManager -> getStore ( true ) -> getId ( ) ] ; } if ( empty ( $ this -> storeIds ) ) { $ this -> storeIds = $ this -> getResource ( ) -> getStoreIdsFromThesaurusId ( $ this -> getThesaurusId (...
Get store ids
43,706
public function getTermsData ( ) { if ( empty ( $ this -> termsData ) ) { $ this -> termsData = $ this -> getResource ( ) -> getTermsDataFromThesaurus ( $ this ) ; } return $ this -> termsData ; }
Get terms data
43,707
private function getResourceModel ( ) : InventoryDataInterface { if ( $ this -> resourceModel === null ) { $ resourceName = InventoryDataInterface :: class ; try { $ stockResolver = $ this -> config -> getPreference ( \ Magento \ InventorySalesApi \ Api \ StockResolverInterface :: class ) ; if ( ltrim ( $ stockResolver...
Init proper resource model .
43,708
private function getField ( ContainerConfigurationInterface $ containerConfiguration , OptimizerInterface $ optimizer ) { $ attributeCode = $ optimizer -> getConfig ( 'attribute_code' ) ; try { $ attribute = $ this -> getAttribute ( $ attributeCode ) ; $ field = $ this -> mappingHelper -> getFilterField ( $ attribute )...
Get field to apply boost on .
43,709
private function getContainerConfiguration ( ) { $ containerName = $ this -> getRequest ( ) -> getParam ( 'search_container_preview' ) ; $ containerConfig = $ this -> containerConfigFactory -> create ( [ 'containerName' => $ containerName , 'storeId' => $ this -> getOptimizer ( ) -> getStoreId ( ) ] ) ; return $ contai...
Return the container to preview .
43,710
private function getQueryText ( ) { $ queryText = trim ( strtolower ( ( string ) $ this -> getRequest ( ) -> getParam ( 'query_text_preview' , '' ) ) ) ; if ( $ queryText == '' ) { $ queryText = null ; } return $ queryText ; }
Return the query text to preview .
43,711
public function get ( $ language = null , $ default = null ) { if ( $ language === null ) { $ language = 'default' ; } $ data = parent :: get ( $ language , null ) ; if ( $ data === null ) { $ data = $ this -> get ( 'default' , $ default ) ; } return $ data ; }
Return analysis config by language .
43,712
public function create ( array $ data = [ ] ) { $ engine = $ this -> scopeConfig -> getValue ( $ this -> configPath , ScopeInterface :: SCOPE_STORE ) ; $ fullActionClass = $ this -> fullActionPool [ 'default' ] ; if ( isset ( $ this -> fullActionPool [ $ engine ] ) ) { $ fullActionClass = $ this -> fullActionPool [ $ e...
Create an indexer using the right class depending of the configuration .
43,713
public function execute ( ) { $ resultPage = $ this -> createPage ( ) ; $ thesaurusId = ( int ) $ this -> getRequest ( ) -> getParam ( ThesaurusInterface :: THESAURUS_ID ) ; $ type = ( string ) $ this -> getRequest ( ) -> getParam ( 'type' ) ; $ thesaurus = null ; $ isExistingThesaurus = ( bool ) $ thesaurusId ; if ( $...
Render Thesaurus edition screen
43,714
public function loadAttributesData ( int $ categoryId ) { $ binds = [ ':category_id' => $ categoryId ] ; $ select = $ this -> getConnection ( ) -> select ( ) ; $ select -> from ( $ this -> getMainTable ( ) ) -> where ( sprintf ( "%s = :category_id" , $ this -> getIdFieldName ( ) ) ) ; return $ this -> getConnection ( )...
Retrieve Layered Navigation Filters for a given category .
43,715
public function saveAttributesData ( int $ categoryId , array $ data ) { $ rows = [ ] ; $ this -> deleteByCategoryId ( $ categoryId ) ; $ fields = $ this -> getConnection ( ) -> describeTable ( $ this -> getMainTable ( ) ) ; foreach ( $ data as $ item ) { $ item [ $ this -> getIdFieldName ( ) ] = $ categoryId ; $ row =...
Save Layered Navigation Filters configuration for a given category .
43,716
public function deleteByCategoryId ( int $ categoryId ) { $ deleteCondition = [ sprintf ( "%s = ?" , $ this -> getIdFieldName ( ) ) => $ categoryId ] ; return ( bool ) $ this -> getConnection ( ) -> delete ( $ this -> getMainTable ( ) , $ deleteCondition ) ; }
Delete layered filters configuration by Category Id .
43,717
private function buildRow ( $ item , $ fields ) { if ( empty ( $ item [ 'is_pinned' ] ) || filter_var ( $ item [ 'is_pinned' ] , FILTER_VALIDATE_BOOLEAN ) === false ) { $ item [ 'position' ] = null ; } foreach ( array_keys ( $ fields ) as $ field ) { $ useDefault = 'use_default_' . $ field ; if ( isset ( $ item [ $ use...
Compute row data for later insert .
43,718
private function isValid ( $ row ) { $ result = false ; if ( ( int ) $ row [ 'facet_display_mode' ] !== FilterDisplayMode :: AUTO_DISPLAYED ) { $ result = true ; } unset ( $ row [ $ this -> getIdFieldName ( ) ] ) ; unset ( $ row [ 'attribute_id' ] ) ; unset ( $ row [ 'facet_display_mode' ] ) ; if ( ! empty ( array_filt...
Check if a given row is relevant to save .
43,719
public function aroundSave ( QueryModel $ subject , \ Closure $ proceed ) { $ needReindex = $ subject -> dataHasChangedFor ( 'synonym_for' ) ; $ result = $ proceed ( ) ; if ( $ needReindex ) { $ this -> indexerRegistry -> get ( ThesaurusIndexer :: INDEXER_ID ) -> invalidate ( ) ; } return $ result ; }
Ensure the index is invalidated when synonyms are updated .
43,720
protected function processNestedGroups ( $ group ) { $ data = [ ] ; if ( isset ( $ group [ 'fields' ] ) && is_array ( $ group [ 'fields' ] ) ) { foreach ( $ group [ 'fields' ] as $ fieldName => $ field ) { if ( ! empty ( $ field [ 'value' ] ) ) { $ data [ 'fields' ] [ $ fieldName ] = [ 'value' => $ field [ 'value' ] ] ...
Process nested groups
43,721
private function setSortParams ( \ Magento \ Catalog \ Model \ Layer $ layer , \ Magento \ Catalog \ Model \ ResourceModel \ Collection \ AbstractCollection $ collection ) { $ searchQuery = $ this -> queryFactory -> get ( ) ; if ( ! $ searchQuery -> getQueryText ( ) && $ layer -> getCurrentCategory ( ) ) { $ categoryId...
Apply sort params to the collection .
43,722
private function getQueryClause ( $ query , $ clause ) { $ queries = $ query -> getMust ( ) ; if ( $ clause == self :: QUERY_CONDITION_NOT ) { $ queries = $ query -> getMustNot ( ) ; } elseif ( $ clause == self :: QUERY_CONDITION_SHOULD ) { $ queries = $ query -> getShould ( ) ; } return $ queries ; }
Return the list of queries associated to a clause .
43,723
public function saveLimitation ( $ optimizer , $ limitationData ) { $ rows = [ ] ; $ optimizerId = ( int ) $ optimizer -> getId ( ) ; $ this -> getConnection ( ) -> delete ( $ this -> getMainTable ( ) , $ this -> getConnection ( ) -> quoteInto ( OptimizerInterface :: OPTIMIZER_ID . " = ?" , $ optimizerId ) ) ; $ fields...
Save limitation data for a given optimizer .
43,724
private function getLimitationData ( OptimizerInterface $ optimizer , $ column ) { $ select = $ this -> getConnection ( ) -> select ( ) -> from ( $ this -> getMainTable ( ) , $ column ) -> where ( $ this -> getConnection ( ) -> quoteInto ( OptimizerInterface :: OPTIMIZER_ID . " = ?" , ( int ) $ optimizer -> getId ( ) )...
Get Limitation data for a given optimizer .
43,725
public function createVirtualCategoriesAttributes ( $ eavSetup ) { $ eavSetup -> addAttribute ( Category :: ENTITY , 'is_virtual_category' , [ 'type' => 'int' , 'label' => 'Is virtual category' , 'input' => null , 'global' => \ Magento \ Eav \ Model \ Entity \ Attribute \ ScopedAttributeInterface :: SCOPE_GLOBAL , 'req...
Create virtual categories attributes .
43,726
public function createPositionTable ( SchemaSetupInterface $ setup ) { $ tableName = 'smile_virtualcategory_catalog_category_product_position' ; $ table = $ setup -> getConnection ( ) -> newTable ( $ setup -> getTable ( $ tableName ) ) -> addColumn ( 'category_id' , \ Magento \ Framework \ DB \ Ddl \ Table :: TYPE_INTE...
Create table containing position of products in virtual categories .
43,727
public function addBlacklistColumnToPositionTable ( SchemaSetupInterface $ setup ) { $ setup -> getConnection ( ) -> addColumn ( $ setup -> getTable ( 'smile_virtualcategory_catalog_category_product_position' ) , 'is_blacklisted' , [ 'type' => \ Magento \ Framework \ DB \ Ddl \ Table :: TYPE_BOOLEAN , 'nullable' => fal...
Add is_blacklisted column to smile_virtualcategory_catalog_category_product_position .
43,728
public function setNullablePositionColumn ( SchemaSetupInterface $ setup ) { $ setup -> getConnection ( ) -> modifyColumn ( $ setup -> getTable ( 'smile_virtualcategory_catalog_category_product_position' ) , 'position' , [ 'type' => \ Magento \ Framework \ DB \ Ddl \ Table :: TYPE_INTEGER , 'nullable' => true , 'commen...
Set the position column of smile_virtualcategory_catalog_category_product_position to nullable = true .
43,729
public function addStoreIdColumnToPositionTable ( SchemaSetupInterface $ setup ) { $ tableName = $ setup -> getTable ( 'smile_virtualcategory_catalog_category_product_position' ) ; $ setup -> getConnection ( ) -> addColumn ( $ tableName , 'store_id' , [ 'type' => \ Magento \ Framework \ DB \ Ddl \ Table :: TYPE_SMALLIN...
Add store_id column to smile_virtualcategory_catalog_category_product_position and make it part of the table compound primary key .
43,730
public function updateVirtualRuleBackend ( \ Magento \ Eav \ Setup \ EavSetup $ eavSetup ) { $ eavSetup -> updateAttribute ( Category :: ENTITY , 'virtual_rule' , 'backend_model' , null ) ; }
Remove the backend model of the virtual_rule attribute .
43,731
public function addUseStorePositionsAttribute ( \ Magento \ Eav \ Setup \ EavSetup $ eavSetup ) { $ eavSetup -> addAttribute ( Category :: ENTITY , 'use_store_positions' , [ 'type' => 'int' , 'input' => 'select' , 'source' => 'Magento\Eav\Model\Entity\Attribute\Source\Boolean' , 'label' => 'Use store positions' , 'glob...
Add the attribute handling the per - store merchandiser
43,732
private function reindexFlatCategories ( ) { if ( $ this -> flatCategoryIndexState -> isFlatEnabled ( ) ) { $ flatCategoryIndexer = $ this -> indexerRegistry -> get ( \ Magento \ Catalog \ Model \ Indexer \ Category \ Flat \ State :: INDEXER_ID ) ; $ flatCategoryIndexer -> reindexAll ( ) ; } }
Process full reindexing of flat categories if enabled and not scheduled .
43,733
public function renderCellTemplate ( $ columnName ) { if ( $ columnName == 'term_id' && isset ( $ this -> _columns [ $ columnName ] ) ) { $ element = $ this -> elementFactory -> create ( 'hidden' ) ; $ element -> setId ( "term_id" ) -> setName ( "term_id" ) ; $ element -> setForm ( $ this -> getForm ( ) ) -> setName ( ...
Render array cell for JS template
43,734
public function getValueElementChooserUrl ( ) { $ url = parent :: getValueElementChooserUrl ( ) ; if ( $ this -> getAttribute ( ) === 'category_ids' ) { $ url = $ this -> getCategoryChooserUrl ( ) ; } return $ url ; }
Retrieve value element chooser URL
43,735
private function getCategorySearchQuery ( $ excludedCategories ) { $ categoryIds = array_diff ( explode ( ',' , $ this -> getValue ( ) ) , $ excludedCategories ) ; $ subQueries = [ ] ; foreach ( $ categoryIds as $ categoryId ) { $ subQuery = $ this -> getRule ( ) -> getCategorySearchQuery ( $ categoryId , $ excludedCat...
Retrieve a query used to apply category filter rule .
43,736
private function loadProductCounts ( ) { $ searchResponse = $ this -> searchEngine -> search ( $ this -> request ) ; $ this -> countByAttributeSet = [ ] ; $ this -> countByAttributeCode = [ ] ; $ this -> size = $ searchResponse -> count ( ) ; $ attributeSetIdBucket = $ searchResponse -> getAggregations ( ) -> getBucket...
Compute calculation of product counts against the engine .
43,737
public function aroundExecute ( \ Magento \ CatalogSearch \ Controller \ Result \ Index $ subject , \ Closure $ proceed ) { $ result = $ proceed ( ) ; if ( ! $ subject -> getResponse ( ) -> isRedirect ( ) && $ this -> scopeConfig -> isSetFlag ( self :: REDIRECT_SETTINGS_CONFIG_XML_FLAG ) ) { $ layer = $ this -> layerRe...
Process a redirect to the product page if there is only one result for a given search .
43,738
private function addRedirectMessage ( ProductInterface $ product ) { $ message = __ ( "%1 is the only product matching your '%2' search." , $ product -> getName ( ) , $ this -> helper -> getEscapedQueryText ( ) ) ; $ this -> messageManager -> addSuccessMessage ( $ message ) ; }
Append message to the customer session to inform he has been redirected
43,739
public function updateDefaultValuesForNameAttributes ( $ eavSetup ) { $ setup = $ eavSetup -> getSetup ( ) ; $ connection = $ setup -> getConnection ( ) ; $ table = $ setup -> getTable ( 'catalog_eav_attribute' ) ; $ attributeIds = [ $ eavSetup -> getAttributeId ( \ Magento \ Catalog \ Model \ Product :: ENTITY , 'name...
Update default values for the name field of category and product entities .
43,740
public function addEavCatalogFields ( SchemaSetupInterface $ setup ) { $ connection = $ setup -> getConnection ( ) ; $ table = $ setup -> getTable ( 'catalog_eav_attribute' ) ; $ connection -> addColumn ( $ table , 'is_displayed_in_autocomplete' , [ 'type' => \ Magento \ Framework \ DB \ Ddl \ Table :: TYPE_BOOLEAN , '...
Add custom fields to catalog_eav_attribute table .
43,741
public function addIsSpellcheckedToSearchQuery ( SchemaSetupInterface $ setup ) { $ connection = $ setup -> getConnection ( ) ; $ table = $ setup -> getTable ( 'search_query' ) ; $ connection -> addColumn ( $ table , 'is_spellchecked' , [ 'type' => \ Magento \ Framework \ DB \ Ddl \ Table :: TYPE_BOOLEAN , 'nullable' =...
Append is spellchecked to the search query report table .
43,742
public function appendDecimalDisplayConfiguration ( SchemaSetupInterface $ setup ) { $ connection = $ setup -> getConnection ( ) ; $ table = $ setup -> getTable ( 'catalog_eav_attribute' ) ; $ connection -> addColumn ( $ table , 'display_pattern' , [ 'type' => \ Magento \ Framework \ DB \ Ddl \ Table :: TYPE_TEXT , 'nu...
Append decimal display related columns to attribute table
43,743
public function removeIsUsedInAutocompleteField ( SchemaSetupInterface $ setup ) { $ connection = $ setup -> getConnection ( ) ; $ table = $ setup -> getTable ( 'catalog_eav_attribute' ) ; $ connection -> dropColumn ( $ table , 'is_used_in_autocomplete' ) ; }
Remove the is_used_in_autocomplete
43,744
public function updateImageAttribute ( $ eavSetup ) { $ productImageAttributeId = $ eavSetup -> getAttributeId ( \ Magento \ Catalog \ Model \ Product :: ENTITY , 'image' ) ; $ setup = $ eavSetup -> getSetup ( ) ; $ setup -> getConnection ( ) -> update ( $ setup -> getTable ( 'catalog_eav_attribute' ) , [ 'is_used_for_...
Update Product image attribute and set it searchable .
43,745
public function createCategoryFacetConfigurationTable ( SchemaSetupInterface $ setup ) { $ tableName = 'smile_elasticsuitecatalog_category_filterable_attribute' ; $ idField = $ this -> metadataPool -> getMetadata ( CategoryInterface :: class ) -> getIdentifierField ( ) ; $ table = $ setup -> getConnection ( ) -> newTab...
Create table containing configuration of facets for categories .
43,746
public function addSortOrderMissingFields ( SchemaSetupInterface $ setup ) { $ connection = $ setup -> getConnection ( ) ; $ table = $ setup -> getTable ( 'catalog_eav_attribute' ) ; $ connection -> addColumn ( $ table , 'sort_order_asc_missing' , [ 'type' => \ Magento \ Framework \ DB \ Ddl \ Table :: TYPE_TEXT , 'nul...
Add sort_order_asc_missing and sort_order_desc_missing fields to catalog_eav_attribute table .
43,747
private function updateCategoryAttributeDefaultValue ( $ eavSetup , $ entityTypeId , $ attributeId , $ value , $ excludedIds = [ ] ) { $ setup = $ eavSetup -> getSetup ( ) ; $ entityTable = $ setup -> getTable ( $ eavSetup -> getEntityType ( $ entityTypeId , 'entity_table' ) ) ; $ attributeTable = $ eavSetup -> getAttr...
Update attribute value for an entity with a default value . All existing values are erased by the new value .
43,748
public function createIndexIfNotExists ( \ Smile \ ElasticsuiteCore \ Api \ Index \ IndexInterface $ index , $ store ) { if ( $ this -> client -> indexExists ( $ index -> getName ( ) ) === false ) { $ indexSettings = array_merge ( $ this -> indexSettings -> getCreateIndexSettings ( ) , $ this -> indexSettings -> getIns...
Create an event index if not exists .
43,749
public function getIndexName ( $ indexIdentifier , $ storeId , $ date ) { $ indexAlias = $ this -> getIndexAlias ( $ indexIdentifier , $ storeId ) ; $ date = substr ( $ date , 0 , 10 ) ; return sprintf ( "%s_%s" , $ indexAlias , str_replace ( "-" , "" , $ date ) ) ; }
Build index name from an event .
43,750
private function prepareAggregations ( array $ searchResponse , AggregationFactory $ aggregationFactory ) { $ aggregations = [ ] ; if ( isset ( $ searchResponse [ 'aggregations' ] ) ) { $ aggregations = $ searchResponse [ 'aggregations' ] ; } $ this -> aggregations = $ aggregationFactory -> create ( $ aggregations ) ; ...
Build buckets from raw search response .
43,751
private function prepareDocuments ( array $ searchResponse , DocumentFactory $ documentFactory ) { $ this -> documents = [ ] ; if ( isset ( $ searchResponse [ 'hits' ] ) ) { $ hits = $ searchResponse [ 'hits' ] [ 'hits' ] ; foreach ( $ hits as $ hit ) { $ this -> documents [ ] = $ documentFactory -> create ( $ hit ) ; ...
Build document list from the engine raw search response .
43,752
public function getValueElementType ( ) { $ valueElementType = 'text' ; if ( $ this -> getAttribute ( ) == 'attribute_set_id' ) { $ valueElementType = 'select' ; } elseif ( is_object ( $ this -> getAttributeObject ( ) ) ) { $ frontendInput = $ this -> getAttributeObject ( ) -> getFrontendInput ( ) ; if ( $ frontendInpu...
Retrieve value element type
43,753
public function getDefaultOperatorInputByType ( ) { if ( null === $ this -> _defaultOperatorInputByType ) { $ this -> _defaultOperatorInputByType = [ 'string' => [ '{}' , '!{}' ] , 'numeric' => [ '==' , '!=' , '>=' , '>' , '<=' , '<' ] , 'date' => [ '==' , '>=' , '>' , '<=' , '<' ] , 'select' => [ '==' , '!=' ] , 'bool...
Default operator input by type map getter
43,754
public function prepareCollection ( ProductCollection $ collection ) { $ collection -> addAttributeToSelect ( $ this -> attributes ) ; $ collection -> addPriceData ( ) ; return $ collection ; }
Add standard attributes and price data to the collection .
43,755
public function saveConfig ( $ path , $ value , $ scope = ScopeConfigInterface :: SCOPE_TYPE_DEFAULT , $ scopeCode = 'default' ) { $ connection = $ this -> getConnection ( ) ; $ select = $ connection -> select ( ) -> from ( $ this -> getMainTable ( ) ) -> where ( 'path = ?' , $ path ) -> where ( 'scope = ?' , $ scope )...
Save config value
43,756
public function deleteConfig ( $ path , $ scope = ScopeConfigInterface :: SCOPE_TYPE_DEFAULT , $ scopeCode = 'default' ) { $ connection = $ this -> getConnection ( ) ; $ connection -> delete ( $ this -> getMainTable ( ) , [ $ connection -> quoteInto ( 'path = ?' , $ path ) , $ connection -> quoteInto ( 'scope = ?' , $ ...
Delete config value
43,757
public function getRelationsByChild ( $ childrenIds ) { $ metadata = $ this -> getEntityMetaData ( \ Magento \ Catalog \ Api \ Data \ ProductInterface :: class ) ; $ entityTable = $ this -> getTable ( $ metadata -> getEntityTable ( ) ) ; $ relationTable = $ this -> getTable ( 'catalog_product_relation' ) ; $ joinCondit...
Retrieve products relations by childrens
43,758
private function addIsVisibleInStoreFilter ( $ select , $ storeId ) { $ rootCategoryId = $ this -> getRootCategoryId ( $ storeId ) ; $ indexTable = $ this -> getCategoryProductIndexTable ( $ storeId ) ; $ visibilityJoinCond = $ this -> getConnection ( ) -> quoteInto ( 'visibility.product_id = e.entity_id AND visibility...
Filter the select to append only product visible into the catalog or search into the index .
43,759
public function setCategory ( \ Magento \ Catalog \ Api \ Data \ CategoryInterface $ category ) { $ this -> category = $ category ; return $ this ; }
Set the current category for the collection .
43,760
public function applyCategory ( ) { $ this -> joinCategoryData ( ) ; $ this -> removeAdditionalTableDuplicateFields ( ) ; $ this -> getSelect ( ) -> columns ( $ this -> getAdditionalColumns ( ) ) ; $ subSelect = new \ Zend_Db_Expr ( sprintf ( "(%s)" , ( string ) $ this -> getSelect ( ) ) ) ; $ this -> _select = $ this ...
Apply current category settings to the collection .
43,761
public function setAttributeSetFilter ( $ setId ) { if ( is_array ( $ setId ) ) { if ( ! empty ( $ setId ) ) { $ this -> join ( [ 'entity_attribute' => $ this -> getTable ( 'eav_entity_attribute' ) ] , 'entity_attribute.attribute_id = main_table.attribute_id' , [ ] ) ; $ this -> addFieldToFilter ( 'entity_attribute.att...
Specify attribute set filter
43,762
private function getAdditionalColumns ( ) { $ columns = [ 'facet_display_mode' => 'fal.facet_display_mode' ] ; foreach ( $ this -> overridenColumns as $ column ) { $ columns [ $ column ] = new \ Zend_Db_Expr ( "COALESCE(fal.$column, additional_table.$column)" ) ; $ columns [ 'use_default_' . $ column ] = new \ Zend_Db_...
List of additional columns added to the select .
43,763
private function getMaxPosition ( ) { $ fullTableName = $ this -> getResource ( ) -> getTable ( self :: CATEGORY_FILTER_CONFIG_TABLE ) ; $ categoryPositionSelect = $ this -> getConnection ( ) -> select ( ) -> from ( $ fullTableName , [ ] ) -> columns ( [ 'category_max_position' => new \ Zend_Db_Expr ( 'MAX(position)' )...
Return the max attribute position configured for the current category .
43,764
private function removeAdditionalTableDuplicateFields ( ) { $ columns = $ this -> getSelect ( ) -> getPart ( \ Zend_Db_Select :: COLUMNS ) ; foreach ( $ columns as $ idx => $ column ) { if ( $ column [ 0 ] == 'additional_table' && $ column [ 1 ] == "*" ) { unset ( $ columns [ $ idx ] ) ; } } $ this -> getSelect ( ) -> ...
Clean collection select to remove duplicated fields .
43,765
private function getAdditionalTableFields ( ) { $ type = $ this -> eavConfig -> getEntityType ( \ Magento \ Catalog \ Model \ Product :: ENTITY ) ; $ table = $ type -> getAdditionalAttributeTable ( ) ; $ fullTableName = $ this -> getResource ( ) -> getTable ( $ table ) ; $ tableDesc = $ this -> getConnection ( ) -> des...
List of columns of the additional attribute config table without the overriden fields .
43,766
private function formatValue ( $ value ) { $ attribute = $ this -> getAttributeModel ( ) ; if ( ( int ) $ attribute -> getDisplayPrecision ( ) > 0 ) { $ locale = $ this -> localeResolver -> getLocale ( ) ; $ options = [ 'locale' => $ locale , 'precision' => ( int ) $ attribute -> getDisplayPrecision ( ) ] ; $ valueForm...
Format value according to attribute display options
43,767
public function getPageTypeLabel ( ) { if ( ! $ this -> getData ( 'page_type_label' ) ) { $ label = '' ; $ identifier = $ this -> getPageTypeIdentifier ( ) ; $ labelByIdentifier = $ this -> getPageTypeLabelMap ( ) ; if ( isset ( $ labelByIdentifier [ $ identifier ] ) ) { $ label = $ labelByIdentifier [ $ identifier ] ;...
Human readable version of the page
43,768
private function getPageTypeLabelMap ( ) { $ labelByIdentifier = [ ] ; $ pageTypes = $ this -> pageTypeConfig -> getPageTypes ( ) ; foreach ( $ pageTypes as $ identifier => $ pageType ) { $ labelByIdentifier [ $ identifier ] = $ pageType [ 'label' ] ; } return $ labelByIdentifier ; }
Return the array of page labels from layout indexed by handle names .
43,769
public function upgrade ( SchemaSetupInterface $ setup , ModuleContextInterface $ context ) { $ setup -> startSetup ( ) ; if ( version_compare ( $ context -> getVersion ( ) , "1.1.0" ) < 0 ) { $ setup -> startSetup ( ) ; $ logTable = $ setup -> getConnection ( ) -> newTable ( $ setup -> getTable ( 'elasticsuite_tracker...
Create table for the tracking module .
43,770
private function createCustomerLinkTable ( SchemaSetupInterface $ setup ) { $ logTable = $ setup -> getConnection ( ) -> newTable ( $ setup -> getTable ( 'elasticsuite_tracker_log_customer_link' ) ) -> addColumn ( 'customer_id' , \ Magento \ Framework \ DB \ Ddl \ Table :: TYPE_INTEGER , null , [ 'unsigned' => true , '...
Create customer link table .
43,771
public function addData ( $ storeId , array $ indexData ) { $ priceData = $ this -> resourceModel -> loadPriceData ( $ storeId , array_keys ( $ indexData ) ) ; foreach ( $ priceData as $ priceDataRow ) { $ productId = ( int ) $ priceDataRow [ 'entity_id' ] ; $ productTypeId = $ indexData [ $ productId ] [ 'type_id' ] ;...
Add price data to the index data .
43,772
public function create ( $ pipelineType , $ pipelineParams ) { if ( ! isset ( $ this -> factories [ $ pipelineType ] ) ) { throw new \ LogicException ( "No factory found for pipeline aggregation of type {$pipelineType}" ) ; } return $ this -> factories [ $ pipelineType ] -> create ( $ pipelineParams ) ; }
Create a new pipeline from its type and params .
43,773
private function addMappings ( ) { $ indicesSettings = $ this -> indexSettings -> getIndicesConfig ( ) ; foreach ( $ this -> _data as $ requestName => $ requestConfig ) { $ index = $ requestConfig [ 'index' ] ; $ this -> _data [ $ requestName ] [ 'mapping' ] = $ indicesSettings [ $ index ] [ 'mapping' ] ; } return $ th...
Append the type mapping to search requests configuration .
43,774
private function addFilters ( ) { foreach ( $ this -> _data as $ requestName => $ requestConfig ) { if ( isset ( $ requestConfig [ 'filters' ] ) ) { $ filters = [ ] ; foreach ( $ requestConfig [ 'filters' ] as $ filterName => $ filterClass ) { $ filters [ $ filterName ] = $ this -> objectManager -> get ( $ filterClass ...
Append the filters to search requests configuration .
43,775
private function addAggregationProviders ( ) { foreach ( $ this -> _data as $ requestName => $ requestConfig ) { if ( isset ( $ requestConfig [ 'aggregationsProviders' ] ) ) { $ providers = [ ] ; foreach ( $ requestConfig [ 'aggregationsProviders' ] as $ providerName => $ providerClass ) { $ providers [ $ providerName ...
Append the aggregation providers to search requests configuration .
43,776
private function addAggregationFilters ( ) { foreach ( $ this -> _data as $ requestName => $ requestConfig ) { if ( isset ( $ requestConfig [ 'aggregations' ] ) ) { $ aggregations = [ ] ; foreach ( $ requestConfig [ 'aggregations' ] as $ aggName => $ aggConfig ) { $ aggregations [ $ aggName ] = $ this -> replaceAggrega...
Append the aggregation filters to search requests configuration .
43,777
private function replaceAggregationFilter ( $ aggregationConfig ) { if ( isset ( $ aggregationConfig [ 'filters' ] ) ) { $ filters = [ ] ; foreach ( $ aggregationConfig [ 'filters' ] as $ filterName => $ filterClass ) { $ filters [ $ filterName ] = $ this -> objectManager -> get ( $ filterClass ) -> getFilterQuery ( ) ...
Instanciates aggregation filter classes .
43,778
private function addProductData ( $ data ) { $ product = $ data [ 'product' ] ; $ productData = [ 'title' => $ product -> getName ( ) , 'image' => $ this -> getImageUrl ( $ product ) , 'url' => $ product -> getProductUrl ( ) , 'price' => $ this -> renderProductPrice ( $ product , \ Magento \ Catalog \ Pricing \ Price \...
Load product data and append them to the original data .
43,779
private function renderProductPrice ( \ Magento \ Catalog \ Model \ Product $ product , $ priceCode ) { $ priceRender = $ this -> getPriceRenderer ( ) ; $ price = $ product -> getData ( $ priceCode ) ; if ( $ priceRender ) { $ price = $ priceRender -> render ( $ priceCode , $ product , [ 'include_container' => false , ...
Renders product price .
43,780
private function getPriceRenderer ( ) { if ( null === $ this -> priceRenderer ) { $ layout = $ this -> objectManager -> get ( '\Magento\Framework\View\LayoutInterface' ) ; $ layout -> getUpdate ( ) -> addHandle ( 'default' ) ; $ priceRenderer = $ layout -> getBlock ( 'product.price.render.default' ) ; if ( ! $ priceRen...
Retrieve Price Renderer Block
43,781
public function createFulltextQuery ( ContainerConfigurationInterface $ containerConfiguration , $ queryText , $ spellingType ) { return $ this -> fulltextQueryBuilder -> create ( $ containerConfiguration , $ queryText , $ spellingType ) ; }
Create a query from a search text query .
43,782
public function dispatch ( RequestInterface $ request ) { if ( ! $ request -> getParam ( 'section' ) ) { $ request -> setParam ( 'section' , $ this -> configStructure -> getFirstSection ( ) -> getId ( ) ) ; } return parent :: dispatch ( $ request ) ; }
Check if current section is found and is allowed
43,783
protected function _isAllowed ( ) { $ sectionId = $ this -> _request -> getParam ( 'section' ) ; return $ this -> configStructure -> getElement ( $ sectionId ) -> isAllowed ( ) || $ this -> _authorization -> isAllowed ( 'Smile_ElasticsuiteCore::manage_relevance' ) ; }
Check is allow modify system configuration
43,784
private function prepareAutocompleteAttributeCollection ( ) { $ storeId = $ this -> storeManager -> getStore ( ) -> getId ( ) ; $ this -> autocompleteAttributeCollection -> addStoreLabel ( $ storeId ) -> addFieldToFilter ( 'is_displayed_in_autocomplete' , true ) -> load ( ) ; return $ this ; }
Init the list of attribute displayed in autocomplete .
43,785
public function execute ( \ Magento \ Framework \ Event \ Observer $ observer ) { $ productCollection = $ observer -> getEvent ( ) -> getData ( 'product_collection' ) ; $ storeId = $ observer -> getEvent ( ) -> getData ( 'store_id' ) ; if ( ( $ productCollection instanceof \ Magento \ Catalog \ Model \ ResourceModel \ ...
Logs a fulltext search event before the user is redirected to the product page .
43,786
private function getPageTypeLabel ( $ pageTypeIdentifier ) { $ label = '' ; $ labelByIdentifier = $ this -> getPageTypeLabelMap ( ) ; if ( isset ( $ labelByIdentifier [ $ pageTypeIdentifier ] ) ) { $ label = $ labelByIdentifier [ $ pageTypeIdentifier ] ; } return $ label ; }
Human readable version of the page type identifier .
43,787
protected function _afterSave ( \ Magento \ Framework \ Model \ AbstractModel $ object ) { parent :: _afterSave ( $ object ) ; $ this -> saveStoreRelation ( $ object ) ; $ this -> saveTermsRelation ( $ object ) ; return $ this ; }
Saves thesaurus linking to terms and stores after save
43,788
protected function _afterLoad ( \ Magento \ Framework \ Model \ AbstractModel $ object ) { if ( $ object -> getId ( ) ) { $ stores = $ this -> getStoreIdsFromThesaurusId ( $ object -> getId ( ) ) ; $ object -> setStoreIds ( $ stores ) ; } return parent :: _afterLoad ( $ object ) ; }
Perform operations after object load restore linking with terms and stores
43,789
private function deleteThesaurusRelations ( \ Magento \ Framework \ Model \ AbstractModel $ object ) { $ deleteCondition = [ ThesaurusInterface :: THESAURUS_ID . " = ?" => $ object -> getThesaurusId ( ) ] ; $ this -> getConnection ( ) -> delete ( $ this -> getTable ( ThesaurusInterface :: EXPANSION_TABLE_NAME ) , $ del...
Delete thesaurus previous relations .
43,790
private function saveReferenceTerms ( \ Magento \ Framework \ Model \ AbstractModel $ object , $ referenceTerms ) { if ( $ object -> getType ( ) === ThesaurusInterface :: TYPE_EXPANSION ) { $ this -> getConnection ( ) -> insertOnDuplicate ( $ this -> getTable ( ThesaurusInterface :: REFERENCE_TABLE_NAME ) , $ reference...
Saves reference terms for a thesaurus . Reference term are used by expansions thesaurus only .
43,791
protected function prepareProductCollection ( \ Smile \ ElasticsuiteCatalog \ Model \ ResourceModel \ Product \ Fulltext \ Collection $ collection ) { return $ collection ; }
Apply custom logic to product collection .
43,792
private function getProductCollection ( ) { $ productCollection = $ this -> collectionFactory -> create ( ) ; $ productCollection -> setStoreId ( $ this -> storeId ) -> addAttributeToSelect ( [ 'name' , 'small_image' ] ) ; return $ this -> prepareProductCollection ( $ productCollection ) ; }
Preview base product collection .
43,793
private function getUnsortedProductData ( ) { $ productCollection = $ this -> getProductCollection ( ) -> setPageSize ( $ this -> size ) ; if ( ! in_array ( $ this -> search , [ null , '' ] ) ) { $ productCollection -> setSearchQuery ( $ this -> search ) ; } return [ 'products' => $ productCollection -> getItems ( ) , ...
Return a collection with with products that match the current preview .
43,794
private function getSortedProducts ( ) { $ products = [ ] ; $ productIds = $ this -> getSortedProductIds ( ) ; if ( $ productIds && count ( $ productIds ) ) { $ productCollection = $ this -> getProductCollection ( ) -> setPageSize ( count ( $ productIds ) ) ; $ idFilterParams = [ 'values' => $ productIds , 'field' => '...
Return a collection with all products manually sorted loaded .
43,795
public function getData ( ) { $ baseResults = $ this -> getBaseResults ( ) ; $ baseProducts = $ this -> preparePreviewItems ( $ baseResults ) ; $ optimizedResults = $ this -> canApply ( ) ? $ this -> getOptimizedResults ( ) : $ baseResults ; $ optimizedProducts = $ this -> preparePreviewItems ( $ optimizedResults ) ; $...
Load preview data .
43,796
private function getBaseResults ( ) { $ baseApplier = $ this -> getApplier ( $ this -> optimizer , ProviderInterface :: TYPE_EXCLUDE ) ; return $ this -> getPreviewResults ( $ baseApplier ) ; }
Load non - optimized results .
43,797
private function getOptimizedResults ( ) { $ optimizedApplier = $ this -> getApplier ( $ this -> optimizer , ProviderInterface :: TYPE_REPLACE ) ; return $ this -> getPreviewResults ( $ optimizedApplier ) ; }
Load optimized results .
43,798
private function canApply ( ) { $ canApply = in_array ( $ this -> containerConfiguration -> getName ( ) , $ this -> optimizer -> getSearchContainer ( ) ) ; if ( $ canApply && $ this -> containerConfiguration -> getName ( ) == 'quick_search_container' ) { $ config = $ this -> optimizer -> getQuickSearchContainer ( ) ; i...
Indicates if the current optmizer can be applied to the search context .
43,799
private function getEffectOnProduct ( $ baseProductIds , $ optimizedProductIds , $ productId ) { $ result = 0 ; $ baseProductPosition = array_search ( $ productId , $ baseProductIds ) ; $ optimizedProductPosition = array_search ( $ productId , $ optimizedProductIds ) ; if ( $ baseProductPosition === false && $ optimize...
Indicates if the product position have moved after optimization .