Merge pull request #1110 from mirumee/SALEOR-1995/add-no-category-set-for-product-alert

Add error for co category set for product
This commit is contained in:
mmarkusik 2021-05-13 13:37:58 +02:00 committed by GitHub
commit bd02c1b260
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 1 deletions

View file

@ -7005,6 +7005,10 @@
"src_dot_utils_dot_errors_dot_nameAlreadyTaken": {
"string": "This name is already taken. Please provide another."
},
"src_dot_utils_dot_errors_dot_noCategorySet": {
"context": "no category set error",
"string": "Product category not set"
},
"src_dot_utils_dot_errors_dot_noShippingAddress": {
"context": "error message",
"string": "Cannot choose a shipping method for an order without the shipping address"

View file

@ -300,7 +300,12 @@ export const ProductUpdate: React.FC<ProductUpdateProps> = ({ id, params }) => {
const [updateChannels, updateChannelsOpts] = useProductChannelListingUpdate({
onCompleted: data => {
if (!!data.productChannelListingUpdate.errors.length) {
return;
data.productChannelListingUpdate.errors.forEach(error =>
notify({
status: "error",
text: getProductErrorMessage(error, intl)
})
);
}
}
});

View file

@ -50,6 +50,10 @@ const messages = defineMessages({
variantUnique: {
defaultMessage: "This variant already exists",
description: "product attribute error"
},
noCategorySet: {
defaultMessage: "Product category not set",
description: "no category set error"
}
});
@ -79,6 +83,8 @@ function getProductErrorMessage(
return intl.formatMessage(messages.variantNoDigitalContent);
case ProductErrorCode.UNSUPPORTED_MEDIA_PROVIDER:
return intl.formatMessage(messages.unsupportedMediaProvider);
case ProductErrorCode.PRODUCT_WITHOUT_CATEGORY:
return intl.formatMessage(messages.noCategorySet);
case ProductErrorCode.INVALID:
if (err.field === "price") {
return intl.formatMessage(messages.priceInvalid);