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
02382755
Commit
02382755
authored
May 11, 2023
by
halweg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 负边距
parent
e4c51f17
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
14 deletions
+40
-14
app/code/Joshine/Category/Block/Html/Topmenu.php
+34
-14
app/code/Joshine/Category/Model/Category/Attribute/Source/Columns.php
+6
-0
No files found.
app/code/Joshine/Category/Block/Html/Topmenu.php
View file @
02382755
...
...
@@ -199,19 +199,17 @@ class Topmenu extends JoshineMenu
$colStops
=
$this
->
_columnBrake
(
$child
->
getChildren
(),
$limit
);
}
$sumMenuColumnsTotal
=
$child
->
getSubmenuColumnsTotal
();
$columns
=
$sumMenuColumnsTotal
??
"11"
;
if
(
intval
(
$columns
)
>=
12
)
{
$columns
=
"11"
;
}
if
(
$childLevel
==
0
)
{
$leftMargin
=
$child
->
getChildLeftMargin
();
if
(
$leftMargin
!=
"0"
&&
empty
(
$leftMargin
))
{
$leftMargin
=
"1"
;
$leftMarginClass
=
$this
->
getMarginClass
(
$child
->
getChildLeftMargin
());
$sumMenuColumnsTotal
=
$child
->
getSubmenuColumnsTotal
();
$columns
=
$sumMenuColumnsTotal
??
"11"
;
if
(
intval
(
$columns
)
>=
12
)
{
$columns
=
"11"
;
}
$colClass
=
$this
->
getColClass
(
$columns
);
$html
=
"<div class=
\"
level
{
$childLevel
}
{
$childrenWrapClass
}
\"
>"
;
$html
.=
"<div class=
\"
row
\"
>
<ul class=
\"
subchildmenu
joshine-col-lg-push-
{
$leftMargin
}
mega-columns joshine-clearfix joshine-col-lg-
{
$columns
}
{
$child
->
getMenuImage
()
}
\"
>
<ul class=
\"
subchildmenu
$leftMarginClass
mega-columns joshine-clearfix
$colClass
{
$child
->
getMenuImage
()
}
\"
>
{
$this
->
_getHtml
(
$child
,
$childrenWrapClass
,
$limit
,
$colStops
)
}
</ul>"
;
$html
.=
$this
->
appendImage
(
$child
);
...
...
@@ -224,6 +222,30 @@ class Topmenu extends JoshineMenu
return
$html
;
}
private
function
getMarginClass
(
$col
)
{
$colInt
=
intval
(
$col
);
if
(
$colInt
>
0
)
{
return
"joshine-col-lg-push-
{
$colInt
}
"
;
}
if
(
$colInt
<
0
)
{
$colInt
=
abs
(
$colInt
);
return
"joshine-col-lg-pull-
{
$colInt
}
"
;
}
return
"joshine-col-lg-push-1"
;
}
private
function
getColClass
(
$col
)
{
$colInt
=
intval
(
$col
);
if
(
$colInt
<=
0
)
{
return
""
;
}
return
"joshine-col-lg-
{
$colInt
}
"
;
}
private
function
appendImage
(
$child
)
{
$html
=
""
;
...
...
@@ -232,15 +254,13 @@ class Topmenu extends JoshineMenu
}
if
(
$child
->
getMenuImage
())
{
$imageLeftMargin
=
$child
->
getImageLeftMargin
();
if
(
empty
(
$imageLeftMargin
))
{
$imageLeftMargin
=
"0"
;
}
$marginClass
=
$this
->
getMarginClass
(
intval
(
$child
->
getImageLeftMargin
()));
$imageWidth
=
$child
->
getImageWidth
();
if
(
empty
(
$imageWidth
))
{
$imageWidth
=
"3"
;
}
$html
.=
"<div class=
\"
pull-right joshine-col-lg-
{
$imageWidth
}
joshine-col-lg-push-
{
$imageLeftMargin
}
joshine-hidden-xs joshine-hidden-sm joshine-hidden-md
\"
>"
;
$colClass
=
$this
->
getColClass
(
$imageWidth
);
$html
.=
"<div class=
\"
$colClass
$marginClass
joshine-hidden-xs joshine-hidden-sm joshine-hidden-md
\"
>"
;
$html
.=
"<img src='
{
$child
->
getMenuImage
()
}
'/>"
;
$html
.=
"</div>"
;
}
...
...
app/code/Joshine/Category/Model/Category/Attribute/Source/Columns.php
View file @
02382755
...
...
@@ -40,6 +40,12 @@ class Columns extends \Magento\Eav\Model\Entity\Attribute\Source\AbstractSource
[
'value'
=>
'10'
,
'label'
=>
'10-columns'
],
[
'value'
=>
'11'
,
'label'
=>
'11-columns'
],
[
'value'
=>
'12'
,
'label'
=>
'12-columns'
],
[
'value'
=>
'-1'
,
'label'
=>
'-1-left'
],
[
'value'
=>
'-2'
,
'label'
=>
'-2-left'
],
[
'value'
=>
'-3'
,
'label'
=>
'-3-left'
],
[
'value'
=>
'-4'
,
'label'
=>
'-4-left'
],
[
'value'
=>
'-5'
,
'label'
=>
'-5-left'
],
[
'value'
=>
'-6'
,
'label'
=>
'-6-left'
],
];
}
return
$this
->
_optionsData
;
...
...
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