@@ -1957,109 +1957,6 @@ public function isDynamicFacetsEnabled(?int $storeId = null): bool
1957
1957
return $ this ->instantSearchConfig ->isDynamicFacetsEnabled ($ storeId );
1958
1958
}
1959
1959
1960
- /**
1961
- * @param $originalIndexName
1962
- * @param $storeId
1963
- * @param $currentCustomerGroupId
1964
- * @param $attrs
1965
- * @return array
1966
- * @throws \Magento\Framework\Exception\LocalizedException
1967
- * @throws \Magento\Framework\Exception\NoSuchEntityException
1968
- * @deprecated This method has been deprecated and should no longer be used
1969
- * @see \Algolia\AlgoliaSearch\Service\Product\SortingTransformer
1970
- */
1971
- public function getSortingIndices ($ originalIndexName , $ storeId = null , $ currentCustomerGroupId = null , $ attrs = null )
1972
- {
1973
- if (!$ attrs ){
1974
- $ attrs = $ this ->getSorting ($ storeId );
1975
- }
1976
-
1977
- $ currency = $ this ->getCurrencyCode ($ storeId );
1978
- $ attributesToAdd = [];
1979
- foreach ($ attrs as $ key => $ attr ) {
1980
- $ indexName = false ;
1981
- $ sortAttribute = false ;
1982
- if ($ this ->isCustomerGroupsEnabled ($ storeId ) && $ attr ['attribute ' ] === 'price ' ) {
1983
- $ websiteId = (int )$ this ->storeManager ->getStore ($ storeId )->getWebsiteId ();
1984
- $ groupCollection = $ this ->groupCollection ;
1985
- if (!is_null ($ currentCustomerGroupId )) {
1986
- $ groupCollection ->addFilter ('customer_group_id ' , $ currentCustomerGroupId );
1987
- }
1988
- foreach ($ groupCollection as $ group ) {
1989
- $ customerGroupId = (int )$ group ->getData ('customer_group_id ' );
1990
- $ excludedWebsites = $ this ->groupExcludedWebsiteRepository ->getCustomerGroupExcludedWebsites ($ customerGroupId );
1991
- if (in_array ($ websiteId , $ excludedWebsites )) {
1992
- continue ;
1993
- }
1994
- $ groupIndexNameSuffix = 'group_ ' . $ customerGroupId ;
1995
- $ groupIndexName =
1996
- $ originalIndexName . '_ ' . $ attr ['attribute ' ] . '_ ' . $ groupIndexNameSuffix . '_ ' . $ attr ['sort ' ];
1997
- $ groupSortAttribute = $ attr ['attribute ' ] . '. ' . $ currency . '. ' . $ groupIndexNameSuffix ;
1998
- $ newAttr = [];
1999
- $ newAttr ['name ' ] = $ groupIndexName ;
2000
- $ newAttr ['attribute ' ] = $ attr ['attribute ' ];
2001
- $ newAttr ['sort ' ] = $ attr ['sort ' ];
2002
- $ newAttr ['sortLabel ' ] = $ attr ['sortLabel ' ];
2003
- if (!array_key_exists ('label ' , $ newAttr ) && array_key_exists ('sortLabel ' , $ newAttr )) {
2004
- $ newAttr ['label ' ] = $ newAttr ['sortLabel ' ];
2005
- }
2006
- $ newAttr ['ranking ' ] = [
2007
- $ newAttr ['sort ' ] . '( ' . $ groupSortAttribute . ') ' ,
2008
- 'typo ' ,
2009
- 'geo ' ,
2010
- 'words ' ,
2011
- 'filters ' ,
2012
- 'proximity ' ,
2013
- 'attribute ' ,
2014
- 'exact ' ,
2015
- 'custom ' ,
2016
- ];
2017
- $ attributesToAdd [$ newAttr ['sort ' ]][] = $ newAttr ;
2018
- }
2019
- } elseif ($ attr ['attribute ' ] === 'price ' ) {
2020
- $ indexName = $ originalIndexName . '_ ' . $ attr ['attribute ' ] . '_ ' . 'default ' . '_ ' . $ attr ['sort ' ];
2021
- $ sortAttribute = $ attr ['attribute ' ] . '. ' . $ currency . '. ' . 'default ' ;
2022
- } else {
2023
- $ indexName = $ originalIndexName . '_ ' . $ attr ['attribute ' ] . '_ ' . $ attr ['sort ' ];
2024
- $ sortAttribute = $ attr ['attribute ' ];
2025
- }
2026
- if ($ indexName && $ sortAttribute ) {
2027
- $ attrs [$ key ]['name ' ] = $ indexName ;
2028
- if (!array_key_exists ('label ' , $ attrs [$ key ]) && array_key_exists ('sortLabel ' , $ attrs [$ key ])) {
2029
- $ attrs [$ key ]['label ' ] = $ attrs [$ key ]['sortLabel ' ];
2030
- }
2031
- $ attrs [$ key ]['ranking ' ] = [
2032
- $ attr ['sort ' ] . '( ' . $ sortAttribute . ') ' ,
2033
- 'typo ' ,
2034
- 'geo ' ,
2035
- 'words ' ,
2036
- 'filters ' ,
2037
- 'proximity ' ,
2038
- 'attribute ' ,
2039
- 'exact ' ,
2040
- 'custom ' ,
2041
- ];
2042
- }
2043
- }
2044
- $ attrsToReturn = [];
2045
- if (count ($ attributesToAdd ) > 0 ) {
2046
- foreach ($ attrs as $ key => $ attr ) {
2047
- if ($ attr ['attribute ' ] == 'price ' && isset ($ attributesToAdd [$ attr ['sort ' ]])) {
2048
- $ attrsToReturn = array_merge ($ attrsToReturn , $ attributesToAdd [$ attr ['sort ' ]]);
2049
- } else {
2050
- $ attrsToReturn [] = $ attr ;
2051
- }
2052
- }
2053
- }
2054
- if (count ($ attrsToReturn ) > 0 ) {
2055
- return $ attrsToReturn ;
2056
- }
2057
- if (is_array ($ attrs )) {
2058
- return $ attrs ;
2059
- }
2060
- return [];
2061
- }
2062
-
2063
1960
/***
2064
1961
* @param int|null $storeId
2065
1962
* @return array<string,<array<string, mixed>>>
0 commit comments