0

I've run into a dead end when trying to create custom URL's for a product type in Commerce 2. I want to create the URL from a custom field -- a Commerce Product field to be exact. This product does not have variants.

I've referenced this question here, but the example did not work for me.

Here is what I've tried with no success: {relatedImage.first().id}, {relatedImage[0].id}, {object.relatedImage.first().id}.

When the Craft task manager tries to rerun these products, it just errors out (Failed). And I'm not sure where to find task manager error logs to see if I can get any information from them.

  • The underlying error for the failed job will be in your project's craft/storage/logs or storage/logs folder depending on how you have it setup. – Brad Bell Aug 6 '18 at 18:31
  • "Could not generate a unique URI based on the URI format". The URI format is: {relatedImage.first().id}. It's looking for the id of a selected commerce product. Is that not possible? – John Johnson Aug 7 '18 at 13:59
  • Assuming relatedImage is the Commerce Product field, is it inside of Matrix or SuperTable or the like? Or is it at the root? – Brad Bell Aug 7 '18 at 23:53
  • It's at the root. – John Johnson Aug 8 '18 at 16:08
  • Just did a test of this locally on the latest Commerce 2 beta. Created a Commerce Products field, added it to the Product Type field layout using {relatedImage.first().id} as the URI Format, created a new Product, selected a related Product with an ID of 10, then the new Product's resulting URI is the expected site.com/10 – Brad Bell Aug 8 '18 at 22:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.