Is there a way to use @inherit for TV values from a resource that is not a direct parent?
In this particular usage, we have a product section and a post purchase consumer information section. I would like to have the product consumer info pages inherit the same header images, titles, etc from the product page, but they sit in different directories ( mydomain.com/products/the-product-seo-optimized-url ) ( mydomain.com/consumerinfo/the-product ).
I could move the info pages under the product pages, but that would mess with the preferred friendly url pattern.
-
☆ A M B ☆
- 1,031 Posts
Have you tried '@INHERIT xxx'? That one worked in Evo, if I remember right. Maybe it works in Revo, too. Otherwise it would be a good feature request.
@Jako - thanks for the suggestion but it was a no go ... also tried id=xxx.
If I'm understanding you, using System Settings rather than TVs might be a better option. They're available anywhere with a setting tag and they would be much faster than @INHERIT TVs.
Another alternative would be to use getField or a custom snippet.
@BobRay - Thanks.
The system setting (if I understand it's workings correctly) probably is not what I need. I am looking to copy the TVs for product name, mini-description and background image. And these are all different for each product. Plus if I change the image on the product page, I want the consumer info page to change to match.
But following up with your getField suggestion, I came across a getResourceField snippet that seems ideal. It looks to let me fetch TV values from any resource.
https://forums.modx.com/thread/32531/getfield-for-revolution
getField sounds perfect for that.
If you will have a lot of products down the road, you might consider using ClassExtender to extend modResource and put the data you now have in TVs into a custom DB table, where each row is a product and the fields are the product's data. Searching and sorting will be much faster that way.
-
☆ A M B ☆
- 24,524 Posts
Or you could use FastField, which adds a new MODX tag, [[#id.fieldname]] or [[#id.tv.tvname]]
http://rtfm.modx.com/extras/revo/fastfield
Thanks for the additional ideas. I started playing with the getResourceField snippet and it works fine. Speed is not really an issue, as this project will also use the static file generating concept I mentioned in early forum posts.