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
db133702
Commit
db133702
authored
May 18, 2023
by
halweg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
inc to cm
parent
8254912a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
1 deletions
+35
-1
app/design/frontend/Joshine/breeze/Magento_Swatches/web/js/swatch-renderer.js
+35
-1
No files found.
app/design/frontend/Joshine/breeze/Magento_Swatches/web/js/swatch-renderer.js
View file @
db133702
...
@@ -427,11 +427,45 @@ define([
...
@@ -427,11 +427,45 @@ define([
label
+=
currentItem
[
i
]
+
" : "
;
label
+=
currentItem
[
i
]
+
" : "
;
continue
;
continue
;
}
}
/*单位转换代码,预留待用
if (typeof(currentItem[i]) == "string") {
label += dealLabel(option[i], currentItem[i]);
} else {
label += option[i] + ' ' + currentItem[i] +"("+getCurrentType()+") ";
}*/
label
+=
option
[
i
]
+
' '
+
currentItem
[
i
]
+
"(inc) "
;
label
+=
option
[
i
]
+
' '
+
currentItem
[
i
]
+
"(inc) "
;
if
(
i
<
labelLen
-
1
)
{
if
(
i
<
labelLen
-
1
)
{
label
+=
", "
;
label
+=
", "
;
}
}
}
}
function
getCurrentType
()
{
var
type
=
$
(
".chart-size-switch-item.-active"
).
data
(
"size-type"
);
return
type
;
}
function
dealLabel
(
option
,
current
)
{
var
percent
=
2.54
;
var
data
=
current
.
split
(
"-"
);
if
(
data
.
length
==
0
)
{
return
" "
;
}
var
currentType
=
getCurrentType
();
if
(
currentType
==
'inc'
)
{
return
option
+
' '
+
currentItem
+
"(inc) "
;
}
let
tmp
=
[];
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
var
res
=
(
data
[
i
]
*
percent
-
0
).
toFixed
(
2
);
tmp
.
push
(
res
);
}
if
(
tmp
instanceof
Array
)
{
tmp
=
tmp
.
join
(
'-'
);
}
return
option
+
' '
+
tmp
+
"(cm) "
;
}
return
label
;
return
label
;
},
},
...
@@ -568,7 +602,7 @@ define([
...
@@ -568,7 +602,7 @@ define([
listLabel
=
''
,
listLabel
=
''
,
label
=
''
;
label
=
''
;
if
(
item
.
code
==
"size"
)
{
if
(
item
.
code
==
"size"
)
{
var
options
=
$widget
.
_RenderSwatchWithCustomerOptions
(
item
,
controlLabelId
);
var
options
=
$widget
.
_RenderSwatchWithCustomerOptions
(
item
,
controlLabelId
);
}
else
{
}
else
{
var
options
=
$widget
.
_RenderSwatchOptions
(
item
,
controlLabelId
);
var
options
=
$widget
.
_RenderSwatchOptions
(
item
,
controlLabelId
);
...
...
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