1

I upgraded a Craft CMS 3 site to version 4. The Product URI Format for my products look like this:

screenshot of slug format {productFamily.last.uri}/{slug}

Before I re-save a product, the URL displays correctly the way it looked in Craft 3:

correct URL

But when I re-save, the path to the productFamily category is no longer displayed:

wrong URL

Any idea why this is happening? Is {productFamily.last.uri}/{slug} no longer a valid URI format? Or has this something to do with the Entrification Plan?

2 Answers 2

1

Confirm that the Product URI format in production is the same as in development. If you are using Project config, you can look in your config/project/commerce/productTypes/<your-product-type>.yaml for the current file format in production.

If correct, you could try resaving a product in production and see if that updates the URL.

If resaving the product works to update the URL, you can resave all products in production with the command:

php craft resave/products

Which will update the URLs with the current URL format from product type settings.

6
  • The yaml-file does contain the same on prod (I really meant on dev-environment of hyperlane). '{productFamily.last.uri}/{slug}'. php craft resave/products does not do any difference
    – nitech
    Commented Jun 12, 2023 at 11:51
  • Just to elaborate: The difference is between ddev local development environment and any environment on the host. To make sure I didn't mess up a lot when going from local environment to host, I deployed all code and then overwrote the whole database via MySQL workbench so the dev on host would be equal to ddev
    – nitech
    Commented Jun 12, 2023 at 11:54
  • I suspect there's something wrong with the project config. When I rebuild the local project config so it matches the database, I get a lot of changes. When I deploy these changes, I am able to apply, but the process ends up in "A fatal error has occurred" with status: undefined and response: undefined.
    – nitech
    Commented Jun 12, 2023 at 12:14
  • please send in a support ticket to [email protected] also recommend reading craftcms.com/docs/4.x/… and craftcms.com/knowledge-base/deployment-best-practices Commented Jun 12, 2023 at 15:20
  • Thanks. Have sent support ticket.
    – nitech
    Commented Jun 13, 2023 at 8:50
0

The problem was that .last is deprecated. The correct Product URI should be:

{productFamily.inreverse.one.uri}/{slug}

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.