提交 872fc58b 编写于 作者: T Terry

调整: apphtml5 product custom option

上级 6c924ad9
...@@ -74,16 +74,16 @@ class CustomOption ...@@ -74,16 +74,16 @@ class CustomOption
foreach ($custom_option_attr_info as $attr => $info) { foreach ($custom_option_attr_info as $attr => $info) {
if (isset($info['display']['type']) && ($info['display']['type'] == 'select')) { if (isset($info['display']['type']) && ($info['display']['type'] == 'select')) {
if (isset($info['display']['data']) && is_array($info['display']['data'])) { if (isset($info['display']['data']) && is_array($info['display']['data'])) {
foreach ($info['display']['data'] as $key=>$val) { foreach ($info['display']['data'] as $val) {
if (is_array($my_arr[$attr]) && in_array($key, $my_arr[$attr])) { if (is_array($my_arr[$attr]) && in_array($val, $my_arr[$attr])) {
$t_arr = [ $t_arr = [
'key' => $key, 'key' => $val,
'val' => $val, 'val' => $val,
]; ];
$require = isset($info['require']) ? $info['require'] : 0; $require = isset($info['require']) ? $info['require'] : 0;
if (isset($info['showAsImg']) && $info['showAsImg']) { if (isset($info['showAsImg']) && $info['showAsImg']) {
if (isset($img_arr[$key])) { if (isset($img_arr[$val])) {
$t_arr['image'] = $img_arr[$key]; $t_arr['image'] = $img_arr[$val];
} }
} }
$arr[$attr]['info'][] = $t_arr; $arr[$attr]['info'][] = $t_arr;
......
...@@ -119,21 +119,18 @@ class Index ...@@ -119,21 +119,18 @@ class Index
//var_dump($info); //var_dump($info);
if (isset($this->_product[$attr]) && $this->_product[$attr]) { if (isset($this->_product[$attr]) && $this->_product[$attr]) {
$attrVal = $this->_product[$attr]; $attrVal = $this->_product[$attr];
// get translate
if (isset($info['display']['lang']) && $info['display']['lang'] && is_array($attrVal)) { if (isset($info['display']['lang']) && $info['display']['lang'] && is_array($attrVal)) {
$attrVal = Yii::$service->store->getStoreAttrVal($attrVal, $attr); $attrVal = Yii::$service->store->getStoreAttrVal($attrVal, $attr);
} } else if ($attrVal && !is_array($attrVal)) {
if ($attrVal && !is_array($attrVal)) {
$attr = str_replace('_', ' ', $attr);
$attr = str_replace('-', ' ', $attr);
$attr = Yii::$service->page->translate->__($attr);
$attrVal = Yii::$service->page->translate->__($attrVal); $attrVal = Yii::$service->page->translate->__($attrVal);
$gArr[$attr] = $attrVal;
} }
$attr = Yii::$service->page->translate->__($attr);
$gArr[$attr] = $attrVal;
} }
} }
} }
//var_dump($gArr);
return $gArr; return $gArr;
} }
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册