URL patterns with entity reference Possible Duplicate:
  Path alias tokens and node references  




I'm having some difficulties setting up url patterns for my drupal project.

The site has 3 different content types, Main category, sub category and products.
All of these are linked together by entity references.

So a sub category is linked to a main category, and a product is linked to a sub category.
But now I want my urls to look like: main_category/sub_category/product
Or for a sub category it should look like: main_category/product

How would I be able to achieve this? I've installed path auto, but can't seem to figure it out.

EDIT: And another question would be, what would be the easiest way to create a menu out of this?
It has been solved before. Have a look at https://drupal.stackexchange.com/a/36025/6286