1

We have a section of products. Their title is always the raw ISBN Number. I think this makes it hard for craft to auto increment them.

Example:

enter image description here

But this is not the main problem.

Since some update, Craft no longer gives an error on the initial safe of a new entry if the slug can't be generated. (it is for example already taken, but can't be incremented)

So Craft "saves" the entry, but throws the user back to the entry table view and disables the entry. The user only notices this if they pay attention.

2
  • What's the URL setting for the products section?
    – MoritzLost
    Feb 1 at 9:23
  • @MoritzLost produkte/{kubProductIsbnField}
    – Leonardo
    Feb 2 at 7:42

1 Answer 1

1

Every entry needs a unique URI - otherwise, Craft wouldn't know which entry to load for a URL if multiple entries have the same one. A slug is usually used as part of the URL, but not always. If it is, Craft tries to add an incrementing number suffix to the end of the slug to generate a unique URL (up to the maxSlugIncrement config).

In your case, the slug is not used in the URL format. You have produkte/{kubProductIsbnField} as your URI setting, so Craft will use kubProductIsbnField as the second path segment, not the slug. That's why it doesn't try to increment the slug - it won't change the URL in this case. You probably have another entry in your section with the same ISBN, so the URL produkte/123-3-12-123451-7 is already taken.

If you don't use the slug, you have to ensure your URI setting will always produce a unique URL. In your use-case, is there a legitimate reason to have two entries with the same ISBN in your section? If there isn't, this warning might even be helpful, by informing you that you're creating a duplicate entry.

If you need multiple entries with the same ISBN, you need to adjust your URI settings, so that entries get unique URLs each. For example, you can put a truncated part of the description text in the URL.

Another option would be to set your title format to be based on kubProductIsbnField, which means the title - and therefore also the slug - will match the ISBN by default. Then use produkte/{slug} as the URI setting. This will result in the same URL as before, but will allow Craft to add an incrementing suffix to the slug to generate unique URLs for entries with the same ISBN.

1
  • I will look into make the isbn field also my title to use produkte/{slug}. Also we do NOT want duplicated entries by the isbn. But craft does not throw an error on the first creation of the entry. Just tells the user it is saved, but not that it is deactivated because of this issue. So some of our users think its saved and later notice that it is not. Only on saving a second time will craft currently show the error
    – Leonardo
    Feb 13 at 7:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.