Skip to content

Commit

Permalink
#1218 - Fix product attribute mapping and backoffice UI (#1221)
Browse files Browse the repository at this point in the history
* fix product attribute mapping and UI

* change to builder
  • Loading branch information
khanhduzz authored Oct 23, 2024
1 parent 7bc4ef8 commit d8b6d28
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const ProductGeneralInformation = ({ register, errors, setValue }: Props) => {
setValue('taxClassId', data.taxClassId ?? '');
setValue('description', data.description ?? '');
setValue('specification', data.specification ?? '');
setValue('price', data.price ?? 0);
setLoading(false);
})
.catch((error) => {
Expand Down
59 changes: 30 additions & 29 deletions product/src/main/java/com/yas/product/service/ProductService.java
Original file line number Diff line number Diff line change
Expand Up @@ -649,35 +649,36 @@ public ProductDetailVm getProductById(long productId) {
if (null != product.getBrand()) {
brandId = product.getBrand().getId();
}
return new ProductDetailVm(product.getId(),
product.getName(),
product.getShortDescription(),
product.getDescription(),
product.getSpecification(),
product.getSku(),
product.getGtin(),
product.getSlug(),
product.isAllowedToOrder(),
product.isPublished(),
product.isFeatured(),
product.isVisibleIndividually(),
product.isStockTrackingEnabled(),
product.getPrice(),
product.getDimensionUnit(),
product.getWeight(),
product.getLength(),
product.getWidth(),
product.getHeight(),
brandId,
categories,
product.getMetaTitle(),
product.getMetaKeyword(),
product.getMetaDescription(),
thumbnailMedia,
productImageMedias,
product.getTaxClassId(),
Objects.isNull(product.getParent()) ? null : product.getParent().getId()
);
return ProductDetailVm.builder()
.id(product.getId())
.name(product.getName())
.shortDescription(product.getShortDescription())
.description(product.getDescription())
.specification(product.getSpecification())
.sku(product.getSku())
.gtin(product.getGtin())
.slug(product.getSlug())
.isAllowedToOrder(product.isAllowedToOrder())
.isPublished(product.isPublished())
.isFeatured(product.isFeatured())
.isVisible(product.isVisibleIndividually())
.stockTrackingEnabled(product.isStockTrackingEnabled())
.weight(product.getWeight())
.dimensionUnit(product.getDimensionUnit())
.length(product.getLength())
.width(product.getWidth())
.height(product.getHeight())
.price(product.getPrice())
.brandId(brandId)
.categories(categories)
.metaTitle(product.getMetaTitle())
.metaKeyword(product.getMetaKeyword())
.metaDescription(product.getMetaDescription())
.thumbnailMedia(thumbnailMedia)
.productImageMedias(productImageMedias)
.taxClassId(product.getTaxClassId())
.parentId(Objects.isNull(product.getParent()) ? null : product.getParent().getId())
.build();
}

public List<ProductListVm> getLatestProducts(int count) {
Expand Down

0 comments on commit d8b6d28

Please sign in to comment.