|
|
@@ -72,6 +72,45 @@ func (self *ProductController) Latest() {
|
|
|
}
|
|
|
pd.DeliverStartTime = pd.DeliverStartAt.Unix()
|
|
|
pd.DeliverStopTime = pd.DeliverStopAt.Unix()
|
|
|
+ //店铺列表专区商品增加规格显示
|
|
|
+ if ptype == product_model.SHOP_SALE && product_model.GetProductAttrConfig(pd.RelateProductId) != nil {
|
|
|
+
|
|
|
+ list := product_model.GetProductConfigAttrsByPId(pd.RelateProductId)
|
|
|
+ for _, item := range list {
|
|
|
+
|
|
|
+ productKeyConfig := product_model.GetProductAttrKey(item.AttrKeyId)
|
|
|
+ if productKeyConfig != nil {
|
|
|
+ if item.SizeType == product_model.SIZE_TYPE_1 {
|
|
|
+ attrList := product_model.GetProductAttrsByKId(productKeyConfig.Id)
|
|
|
+ for _, attr := range attrList {
|
|
|
+ prodSize := product_model.GetProductByIdAndSizeId(pd.RelateProductId, attr.Id, true)
|
|
|
+ if prodSize != nil {
|
|
|
+ size := &product_model.ProductAttr{}
|
|
|
+ size.Id = attr.Id
|
|
|
+ //beego.BeeLogger.Warn("size_id --- %d", size.Id)
|
|
|
+ size.Name = attr.Name
|
|
|
+ productKeyConfig.ProductAttr = append(productKeyConfig.ProductAttr, size)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ pd.Size = productKeyConfig
|
|
|
+ }
|
|
|
+ if item.SizeType == product_model.SIZE_TYPE_2 {
|
|
|
+ attrList := product_model.GetProductAttrsByKId(productKeyConfig.Id)
|
|
|
+ for _, attr := range attrList {
|
|
|
+ prodColor := product_model.GetProductByIdAndColorId(pd.RelateProductId, attr.Id, true)
|
|
|
+ if prodColor != nil {
|
|
|
+ size := &product_model.ProductAttr{}
|
|
|
+ size.Id = attr.Id
|
|
|
+ //beego.BeeLogger.Warn("color_id --- %d", size.Id)
|
|
|
+ size.Name = attr.Name
|
|
|
+ productKeyConfig.ProductAttr = append(productKeyConfig.ProductAttr, size)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ pd.Color = productKeyConfig
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
self.Data["json"] = &Ret{List: pds, ListCount: count}
|