Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
joshine
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
joshine
Commits
b775e801
Commit
b775e801
authored
Feb 08, 2023
by
dhn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
分层导航,sku排序
parent
2f6ca11c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
2 deletions
+68
-2
app/code/Magento/Elasticsearch/Model/ResourceModel/Fulltext/Collection/SearchResultApplier.php
+38
-1
app/design/frontend/Joshine/breeze/Magento_LayeredNavigation/templates/layer/view.phtml
+30
-1
No files found.
app/code/Magento/Elasticsearch/Model/ResourceModel/Fulltext/Collection/SearchResultApplier.php
View file @
b775e801
...
@@ -63,7 +63,6 @@ class SearchResultApplier implements SearchResultApplierInterface
...
@@ -63,7 +63,6 @@ class SearchResultApplier implements SearchResultApplierInterface
return
;
return
;
}
}
$items
=
$this
->
sliceItems
(
$this
->
searchResult
->
getItems
(),
$this
->
size
,
$this
->
currentPage
);
$items
=
$this
->
sliceItems
(
$this
->
searchResult
->
getItems
(),
$this
->
size
,
$this
->
currentPage
);
$ids
=
[];
$ids
=
[];
foreach
(
$items
as
$item
)
{
foreach
(
$items
as
$item
)
{
...
@@ -74,17 +73,55 @@ class SearchResultApplier implements SearchResultApplierInterface
...
@@ -74,17 +73,55 @@ class SearchResultApplier implements SearchResultApplierInterface
->
reset
(
\Magento\Framework\DB\Select
::
ORDER
);
->
reset
(
\Magento\Framework\DB\Select
::
ORDER
);
$sortOrder
=
$this
->
searchResult
->
getSearchCriteria
()
$sortOrder
=
$this
->
searchResult
->
getSearchCriteria
()
->
getSortOrders
();
->
getSortOrders
();
$skus
=
[];
if
(
isset
(
$_GET
[
'skus'
])
&&
!
empty
(
$_GET
[
'skus'
]))
{
$skus
=
explode
(
','
,
$_GET
[
'skus'
]);
$this
->
collection
->
getSelect
()
->
orWhere
(
"e.sku in ('"
.
implode
(
"','"
,
$skus
)
.
"')"
);
}
if
(
!
empty
(
$sortOrder
[
'price'
])
&&
$this
->
collection
->
getLimitationFilters
()
->
isUsingPriceIndex
())
{
if
(
!
empty
(
$sortOrder
[
'price'
])
&&
$this
->
collection
->
getLimitationFilters
()
->
isUsingPriceIndex
())
{
$sortDirection
=
$sortOrder
[
'price'
];
$sortDirection
=
$sortOrder
[
'price'
];
if
(
empty
(
$skus
))
{
$this
->
collection
->
getSelect
()
$this
->
collection
->
getSelect
()
->
order
(
->
order
(
new
\Zend_Db_Expr
(
"price_index.min_price = 0, price_index.min_price
{
$sortDirection
}
"
)
new
\Zend_Db_Expr
(
"price_index.min_price = 0, price_index.min_price
{
$sortDirection
}
"
)
);
);
}
else
{
foreach
(
$skus
as
$sku
)
{
$this
->
collection
->
getSelect
()
->
order
(
new
\Zend_Db_Expr
(
'e.sku = "'
.
$sku
.
'" desc'
));
}
$this
->
collection
->
getSelect
()
->
order
(
new
\Zend_Db_Expr
(
"price_index.min_price = 0, price_index.min_price
{
$sortDirection
}
"
)
);
}
}
else
{
}
else
{
$orderList
=
join
(
','
,
$ids
);
$orderList
=
join
(
','
,
$ids
);
if
(
empty
(
$skus
))
{
$this
->
collection
->
getSelect
()
$this
->
collection
->
getSelect
()
->
order
(
new
\Zend_Db_Expr
(
"FIELD(e.entity_id,
$orderList
)"
));
->
order
(
new
\Zend_Db_Expr
(
"FIELD(e.entity_id,
$orderList
)"
));
}
}
else
{
foreach
(
$skus
as
$sku
)
{
$this
->
collection
->
getSelect
()
->
order
(
new
\Zend_Db_Expr
(
'e.sku = "'
.
$sku
.
'" desc'
));
}
$this
->
collection
->
getSelect
()
->
order
(
new
\Zend_Db_Expr
(
"FIELD(e.entity_id,
$orderList
)"
));
}
}
$this
->
collection
->
getSelect
()
->
limit
(
$this
->
size
);
}
}
/**
/**
...
...
app/design/frontend/Joshine/breeze/Magento_LayeredNavigation/templates/layer/view.phtml
View file @
b775e801
...
@@ -25,8 +25,14 @@
...
@@ -25,8 +25,14 @@
$isExpanded
=
false
;
$isExpanded
=
false
;
}
}
?>
?>
<style>
.page-head-zindex
{
z-index
:
5
!important
;
}
<div
class=
"block filter"
data-mage-init=
'{"slideout":{"toggler":".filter-title","panel":".filter-content"}}'
>
</style>
<div
class=
"block filter"
data-mage-init=
'{"slideout":{"toggler":".filter-title","panel":".filter-content"}}'
data-breeze-processed=
"true"
>
<div
class=
"block-title filter-title"
tabindex=
"0"
>
<div
class=
"block-title filter-title"
tabindex=
"0"
>
<strong>
<?=
$block
->
escapeHtml
(
__
(
'Shop By'
))
?>
</strong>
<strong>
<?=
$block
->
escapeHtml
(
__
(
'Shop By'
))
?>
</strong>
<?php
if
(
$activeFilters
)
:
?>
<?php
if
(
$activeFilters
)
:
?>
...
@@ -35,6 +41,7 @@
...
@@ -35,6 +41,7 @@
</div>
</div>
<div
class=
"block-content filter-content"
>
<div
class=
"block-content filter-content"
>
<button
class=
"button-close filter-content-close"
></button>
<?=
$block
->
getChildHtml
(
'state'
)
?>
<?=
$block
->
getChildHtml
(
'state'
)
?>
<?php
if
(
$activeFilters
)
:
?>
<?php
if
(
$activeFilters
)
:
?>
...
@@ -61,3 +68,24 @@
...
@@ -61,3 +68,24 @@
<?php
endif
;
?>
<?php
endif
;
?>
</div>
</div>
</div>
</div>
<script>
require
([
'jquery'
],
function
(
$
)
{
//footer
$
(
".filter-title"
).
click
(
function
()
{
var
isMobile
=
window
.
matchMedia
(
"(pointer:coarse)"
).
matches
;
if
(
isMobile
)
{
$
(
'.filter'
).
addClass
(
'active'
);
$
(
'body'
).
css
({
'overflow'
:
'hidden'
,
'box-sizing'
:
'border-box'
,
'padding-right'
:
'0px'
});
$
(
'.page-header'
).
addClass
(
'page-head-zindex'
);
$
(
'.filter-content-close'
).
click
(
function
()
{
$
(
'.filter'
).
removeClass
(
'active'
);
$
(
'body'
).
removeAttr
(
"style"
);
$
(
'.page-header'
).
removeClass
(
'page-head-zindex'
);
});
}
});
});
</script>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment