diff --git a/app/model/productDescription.go b/app/model/productDescription.go index 4781be5..985b819 100644 --- a/app/model/productDescription.go +++ b/app/model/productDescription.go @@ -18,9 +18,10 @@ type ProductDescription struct { AvailableLater string `gorm:"column:available_later;type:varchar(255)" json:"available_later" form:"available_later"` DeliveryInStock string `gorm:"column:delivery_in_stock;type:varchar(255)" json:"delivery_in_stock" form:"delivery_in_stock"` DeliveryOutStock string `gorm:"column:delivery_out_stock;type:varchar(255)" json:"delivery_out_stock" form:"delivery_out_stock"` - Usage string `gorm:"column:usage;type:text" json:"usage" form:"usage"` + Usage string `gorm:"column:_usage_;type:text" json:"usage" form:"usage"` - ExistsInDatabase bool `gorm:"-" json:"exists_in_database"` + ImageLink string `gorm:"column:image_link" json:"image_link"` + ExistsInDatabase bool `gorm:"-" json:"exists_in_database"` } type ProductRow struct { diff --git a/app/repos/productDescriptionRepo/productDescriptionRepo.go b/app/repos/productDescriptionRepo/productDescriptionRepo.go index 1b0faf8..ae26f6b 100644 --- a/app/repos/productDescriptionRepo/productDescriptionRepo.go +++ b/app/repos/productDescriptionRepo/productDescriptionRepo.go @@ -4,6 +4,7 @@ import ( "errors" "fmt" + "git.ma-al.com/goc_daniel/b2b/app/config" "git.ma-al.com/goc_daniel/b2b/app/db" "git.ma-al.com/goc_daniel/b2b/app/model" "git.ma-al.com/goc_daniel/b2b/app/model/dbmodel" @@ -36,6 +37,27 @@ func (r *ProductDescriptionRepo) GetProductDescription(productID uint, productid IDShop: int32(constdata.SHOP_ID), IDLang: int32(productid_lang), }). + Select(` + `+dbmodel.PsProductLangCols.IDProduct.TabCol()+` AS id_product, + `+dbmodel.PsProductLangCols.IDShop.TabCol()+` AS id_shop, + `+dbmodel.PsProductLangCols.IDLang.TabCol()+` AS id_lang, + `+dbmodel.PsProductLangCols.Description.TabCol()+` AS description, + `+dbmodel.PsProductLangCols.DescriptionShort.TabCol()+` AS description_short, + `+dbmodel.PsProductLangCols.LinkRewrite.TabCol()+` AS link_rewrite, + `+dbmodel.PsProductLangCols.MetaDescription.TabCol()+` AS meta_description, + `+dbmodel.PsProductLangCols.MetaKeywords.TabCol()+` AS meta_keywords, + `+dbmodel.PsProductLangCols.MetaTitle.TabCol()+` AS meta_title, + `+dbmodel.PsProductLangCols.Name.TabCol()+` AS name, + `+dbmodel.PsProductLangCols.AvailableNow.TabCol()+` AS available_now, + `+dbmodel.PsProductLangCols.AvailableLater.TabCol()+` AS available_later, + `+dbmodel.PsProductLangCols.DeliveryInStock.TabCol()+` AS delivery_in_stock, + `+dbmodel.PsProductLangCols.DeliveryOutStock.TabCol()+` AS delivery_out_stock, + `+dbmodel.PsProductLangCols.Usage.TabCol()+` AS _usage_, + CONCAT(?, '/', `+dbmodel.PsImageShopCols.IDImage.TabCol()+`, '-large_default/', `+dbmodel.PsProductLangCols.LinkRewrite.TabCol()+`, '.webp') AS image_link + `, config.Get().Image.ImagePrefix). + Joins("JOIN " + dbmodel.TableNamePsImageShop + + " ON " + dbmodel.PsImageShopCols.IDProduct.TabCol() + "=" + dbmodel.PsProductLangCols.IDProduct.TabCol() + + " AND " + dbmodel.PsImageShopCols.Cover.TabCol() + " = 1"). First(&ProductDescription).Error if errors.Is(err, gorm.ErrRecordNotFound) { diff --git a/bo/src/components/admin/PageProducts.vue b/bo/src/components/admin/PageProducts.vue index 09cbe53..83a52c8 100644 --- a/bo/src/components/admin/PageProducts.vue +++ b/bo/src/components/admin/PageProducts.vue @@ -1,39 +1,11 @@