Commit 5ee6e614 by liumengfei

Merge branch 'developer' into production

parents 714a0819 0eaca49c
......@@ -146,7 +146,7 @@ class Main extends Generic implements TabInterface
'chart_table',
[
'name' => 'chart_table',
'label' => __('Chart Table(英尺)'),
'label' => __('Chart Table(英尺,范围值用-分隔)'),
'id' => 'chart_table',
'title' => __('Chart Table'),
'required' => false,
......
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
<acl>
<resources>
<resource id="Magento_Backend::admin">
<resource id="Magepow_Sizechart::magepow" title="Size Chart" sortOrder="10">
<resource id="Magepow_Sizechart::sizechart" title="Size Chart Management" sortOrder="50" />
</resource>
<resource id="Magento_Backend::stores">
<resource id="Magento_Backend::stores_settings">
<resource id="Magento_Config::config">
<resource id="Magepow_Sizechart::config" title="Size Chart"/>
</resource>
</resource>
</resource>
</resource>
</resources>
</acl>
</config>
\ No newline at end of file
......@@ -302,6 +302,9 @@
}
$('.chart-size-switch-item').click(function(data) {
if ($(this).hasClass('-active')) {
return;
}
......@@ -314,12 +317,34 @@
}
$.each($(".size-item"), function (x) {
var current = $(this).data('size-item-inc');
if (currentType == 'inc' && type == 'cm') {
var data = (current * percent - 0).toFixed(2);
} else {
var data = $(this).data('size-item-inc');
if (typeof(current) == "number") {
if (currentType == 'inc' && type == 'cm') {
var data = (current * percent - 0).toFixed(2);
} else {
var data = $(this).data('size-item-inc');
}
$(this).html(data);
} else if (typeof(current) == "string" && current.indexOf("-") != -1) {
var data = current.split("-");
if (data.length == 0) {
return;
}
let tmp = new Array();
for (var i = 0; i < data.length; i++) {
var currentSizeFloat = data[i];
if (currentType == 'inc' && type == 'cm') {
var res = (currentSizeFloat * percent - 0).toFixed(2);
tmp.push(res);
} else {
var res = $(this).data('size-item-inc');
tmp = res;
}
}
if (tmp instanceof Array) {
tmp = tmp.join('-');
}
$(this).html(tmp);
}
$(this).html(data);
});
});
......
......@@ -427,11 +427,45 @@ define([
label += currentItem[i]+" : ";
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) ";
if (i < labelLen - 1) {
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;
},
......@@ -568,7 +602,7 @@ define([
listLabel = '',
label = '';
if (item.code == "size") {
if (item.code == "size" ) {
var options = $widget._RenderSwatchWithCustomerOptions(item, controlLabelId);
} else {
var options = $widget._RenderSwatchOptions(item, controlLabelId);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment