Skip to main content
Commonmark migration
Source Link

I'm in the middle of learning Craft Commerce. When I go to an individual product my URL says /shop/wella-shampoo/. I'd like it to say /shop/**hair-care**/wella-shampoo/ because this is the category this product falls into.

I've tried adding shop/{categories.first().slug}/{slug} to the URL Format but I get the following error:

Internal Server Error

 

Craft\Commerce_ProductModel and its behaviors do not have a method or closure named "categories".

I'm in the middle of learning Craft Commerce. When I go to an individual product my URL says /shop/wella-shampoo/. I'd like it to say /shop/**hair-care**/wella-shampoo/ because this is the category this product falls into.

I've tried adding shop/{categories.first().slug}/{slug} to the URL Format but I get the following error:

Internal Server Error

 

Craft\Commerce_ProductModel and its behaviors do not have a method or closure named "categories".

I'm in the middle of learning Craft Commerce. When I go to an individual product my URL says /shop/wella-shampoo/. I'd like it to say /shop/**hair-care**/wella-shampoo/ because this is the category this product falls into.

I've tried adding shop/{categories.first().slug}/{slug} to the URL Format but I get the following error:

Internal Server Error

Craft\Commerce_ProductModel and its behaviors do not have a method or closure named "categories".

Bumped by Community user
added 10 characters in body
Source Link
Brad Bell
  • 67.6k
  • 6
  • 75
  • 145

I'm in the middle of learning Craft Commerce. When I go to an individual product my URL says /shop/wella-shampoo//shop/wella-shampoo/. I'd like it to say /shop/hair-care/wella-shampoo//shop/**hair-care**/wella-shampoo/ because this is the category this product falls into.

I've tried adding shop/{categories.first().slug}/{slug}shop/{categories.first().slug}/{slug} to the URL Format but I get the following error:

Internal Server Error

Internal Server Error

Craft\Commerce_ProductModel and its behaviors do not have a method or closure named "categories".

Craft\Commerce_ProductModel and its behaviors do not have a method or closure named "categories".

I'm in the middle of learning Craft Commerce. When I go to an individual product my URL says /shop/wella-shampoo/. I'd like it to say /shop/hair-care/wella-shampoo/ because this is the category this product falls into.

I've tried adding shop/{categories.first().slug}/{slug} to the URL Format but I get the following error:

Internal Server Error

Craft\Commerce_ProductModel and its behaviors do not have a method or closure named "categories".

I'm in the middle of learning Craft Commerce. When I go to an individual product my URL says /shop/wella-shampoo/. I'd like it to say /shop/**hair-care**/wella-shampoo/ because this is the category this product falls into.

I've tried adding shop/{categories.first().slug}/{slug} to the URL Format but I get the following error:

Internal Server Error

Craft\Commerce_ProductModel and its behaviors do not have a method or closure named "categories".

Source Link
Martin
  • 1.2k
  • 8
  • 18

Get the category into the url of the product page

I'm in the middle of learning Craft Commerce. When I go to an individual product my URL says /shop/wella-shampoo/. I'd like it to say /shop/hair-care/wella-shampoo/ because this is the category this product falls into.

I've tried adding shop/{categories.first().slug}/{slug} to the URL Format but I get the following error:

Internal Server Error

Craft\Commerce_ProductModel and its behaviors do not have a method or closure named "categories".