diff --git a/app/appserver/modules/Catalog/controllers/ProductController.php b/app/appserver/modules/Catalog/controllers/ProductController.php index 902a999c9..e72d2a21d 100644 --- a/app/appserver/modules/Catalog/controllers/ProductController.php +++ b/app/appserver/modules/Catalog/controllers/ProductController.php @@ -544,7 +544,10 @@ protected function getSameSpuInfo() } } // 得到当前的spu下面的所有的值 - $select = ['name', 'image', 'url_key']; + $productPrimaryKey = Yii::$service->product->getPrimaryKey(); + $select = [$productPrimaryKey, 'name', 'image', 'url_key']; + + //$select = ['name', 'image', 'url_key']; $data = $this->getSpuData($select); $spuValColl = []; // 通过值,找到spu。 @@ -559,7 +562,7 @@ protected function getSameSpuInfo() //$active = 'class="active"'; $one['main_img'] = isset($one['image']['main']['image']) ? $one['image']['main']['image'] : ''; - $one['url'] = Yii::$service->url->getUrl($one['url_key']); + $one['url'] = '/catalog/product/'.(string)$one[$productPrimaryKey]; $reverse_val_spu[$reverse_key] = $one; $showAsImgVal = $one[$this->_spuAttrShowAsImg]; if ($showAsImgVal) { @@ -588,10 +591,12 @@ protected function getSameSpuInfo() $attr_coll = []; foreach ($attrValArr as $attrVal) { $attr_info = $this->getSpuAttrInfo($spuAttr, $attrVal, $reverse_val_spu); + $attr_info['attr_val'] = Yii::$service->page->translate->__($attr_info['attr_val']); $attr_coll[] = $attr_info; } $spuShowArr[] = [ - 'label' => $spuAttr, + //'label' => $spuAttr, + 'label' => Yii::$service->page->translate->__($spuAttr), 'value' => $attr_coll, ]; } @@ -621,7 +626,7 @@ protected function getSpuAttrInfo($spuAttr, $attrVal, $reverse_val_spu) $return[$k] = $v; } if ($spuAttr == $this->_spuAttrShowAsImg) { - $return['show_as_img'] = $arr['main_img']; + $return['show_as_img'] = Yii::$service->product->image->getResize($arr['main_img'],[50,55],false); } } else if ($this->_spuAttrShowAsImg){ // 如果是图片,不存在,则使用备用的。 @@ -633,7 +638,7 @@ protected function getSpuAttrInfo($spuAttr, $attrVal, $reverse_val_spu) $return[$k] = $v; } } - $return['show_as_img'] = $arr['main_img']; + $return['show_as_img'] = Yii::$service->product->image->getResize($arr['main_img'],[50,55],false); } } else if ($this->_spuAttrShowAsTop){ if ($spuAttr == $this->_spuAttrShowAsTop) { @@ -649,7 +654,9 @@ protected function getSpuAttrInfo($spuAttr, $attrVal, $reverse_val_spu) if ($active) { $return['active'] = 'current'; } - + $productPrimaryKey = Yii::$service->product->getPrimaryKey(); + $return['_id'] = (string)$return[$productPrimaryKey]; + return $return; }