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
a32673c3
Commit
a32673c3
authored
Sep 06, 2022
by
王东红
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
18b9d8b6
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
78 additions
and
2 deletions
+78
-2
app/code/JTool/toolbar/Plugin/Catalog/Block/Toolbar.php
+31
-0
app/code/JTool/toolbar/Plugin/Catalog/Model/Config.php
+17
-0
app/code/JTool/toolbar/etc/di.xml
+11
-0
app/code/JTool/toolbar/etc/module.xml
+6
-0
app/code/JTool/toolbar/registration.php
+6
-0
app/code/Magento/Swatches/view/base/web/js/swatch-renderer.js
+2
-2
app/design/frontend/Joshine/breeze/etc/view.xml
+5
-0
No files found.
app/code/JTool/toolbar/Plugin/Catalog/Block/Toolbar.php
0 → 100644
View file @
a32673c3
<?php
namespace
JTool\toolbar\Plugin\Catalog\Block
;
class
Toolbar
{
public
function
aroundSetCollection
(
\Magento\Catalog\Block\Product\ProductList\Toolbar
$subject
,
\Closure
$proceed
,
$collection
)
{
//ordered_qty
$currentOrder
=
$subject
->
getCurrentOrder
();
$this
->
_collection
=
$collection
;
$result
=
$proceed
(
$collection
);
if
(
$currentOrder
)
{
if
(
$currentOrder
==
'high_to_low'
)
{
$subject
->
getCollection
()
->
setOrder
(
'price'
,
'desc'
);
}
elseif
(
$currentOrder
==
'low_to_high'
)
{
$subject
->
getCollection
()
->
setOrder
(
'price'
,
'asc'
);
}
elseif
(
$currentOrder
==
'new_arrivals'
)
{
$this
->
_collection
->
getSelect
()
->
order
(
'e.created_at DESC'
);
}
}
return
$result
;
}
}
\ No newline at end of file
app/code/JTool/toolbar/Plugin/Catalog/Model/Config.php
0 → 100644
View file @
a32673c3
<?php
namespace
JTool\toolbar\Plugin\Catalog\Model
;
class
Config
{
public
function
afterGetAttributeUsedForSortByArray
(
\Magento\Catalog\Model\Config
$catalogConfig
,
$options
)
{
$options
[
'new_arrivals'
]
=
__
(
'New Arrivals'
);
$options
[
'low_to_high'
]
=
__
(
'Price Low To High'
);
$options
[
'high_to_low'
]
=
__
(
'Price High To Low'
);
unset
(
$options
[
'price'
]);
return
$options
;
}
}
\ No newline at end of file
app/code/JTool/toolbar/etc/di.xml
0 → 100644
View file @
a32673c3
<?xml version="1.0"?>
<config
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation=
"urn:magento:framework:ObjectManager/etc/config.xsd"
>
<type
name=
"Magento\Catalog\Block\Product\ProductList\Toolbar"
>
<plugin
name=
"custom_custom_block_toolbar"
type=
"JTool\toolbar\Plugin\Catalog\Block\Toolbar"
/>
</type>
<type
name=
"Magento\Catalog\Model\Config"
>
<plugin
name=
"custom_catalog_model_config"
type=
"JTool\toolbar\Plugin\Catalog\Model\Config"
/>
</type>
</config>
\ No newline at end of file
app/code/JTool/toolbar/etc/module.xml
0 → 100644
View file @
a32673c3
<?xml version="1.0"?>
<config
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation=
"urn:magento:framework:Module/etc/module.xsd"
>
<module
name=
"JTool_toolbar"
setup_version=
"1.0.0"
/>
</config>
\ No newline at end of file
app/code/JTool/toolbar/registration.php
0 → 100644
View file @
a32673c3
<?php
\Magento\Framework\Component\ComponentRegistrar
::
register
(
\Magento\Framework\Component\ComponentRegistrar
::
MODULE
,
'JTool_toolbar'
,
__DIR__
);
\ No newline at end of file
app/code/Magento/Swatches/view/base/web/js/swatch-renderer.js
View file @
a32673c3
...
@@ -577,12 +577,12 @@ define([
...
@@ -577,12 +577,12 @@ define([
// Color
// Color
html
+=
'<div class="'
+
optionClass
+
' color" '
+
attr
+
html
+=
'<div class="'
+
optionClass
+
' color" '
+
attr
+
' style="background: '
+
value
+
' style="background: '
+
value
+
' no-repeat center; background-size:
initial
;">'
+
''
+
' no-repeat center; background-size:
cover
;">'
+
''
+
'</div>'
;
'</div>'
;
}
else
if
(
type
===
2
)
{
}
else
if
(
type
===
2
)
{
// Image
// Image
html
+=
'<div class="'
+
optionClass
+
' image" '
+
attr
+
html
+=
'<div class="'
+
optionClass
+
' image" '
+
attr
+
' style="background: url('
+
value
+
') no-repeat center; background-size:
initial
;width:'
+
' style="background: url('
+
value
+
') no-repeat center; background-size:
cover
;width:'
+
swatchImageWidth
+
'px; height:'
+
swatchImageHeight
+
'px">'
+
''
+
swatchImageWidth
+
'px; height:'
+
swatchImageHeight
+
'px">'
+
''
+
'</div>'
;
'</div>'
;
}
else
if
(
type
===
3
)
{
}
else
if
(
type
===
3
)
{
...
...
app/design/frontend/Joshine/breeze/etc/view.xml
View file @
a32673c3
...
@@ -95,6 +95,11 @@
...
@@ -95,6 +95,11 @@
<height>
110
</height>
<height>
110
</height>
</image>
</image>
<image
id=
"swatch_image"
type=
"swatch_image"
>
<width>
40
</width>
<height>
50
</height>
</image>
<!-- These lists use category_page_grid fallback. Not need to declare srcset for them -->
<!-- These lists use category_page_grid fallback. Not need to declare srcset for them -->
<image
id=
"related_products_list"
type=
"small_image"
>
<image
id=
"related_products_list"
type=
"small_image"
>
<width>
300
</width>
<width>
300
</width>
...
...
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