RE: Any way to make related-assets widget dynamic?

Nofal B, modified 5 Years ago. New Member Posts: 2 Join Date: 12/4/20 Recent Posts

I have a product with certain things in its fields on the basis of which the other products should be shown in the widget without having to relate them in the product properties i.e without having to do "Select Related Assets" for each product. Is there a way to achieve this?

This is a follow up question.I have a dislpay page template configured for every product and that is rendered within an HTML container and I want the related assets to be shown within the same container but since both are seperate widgets, I can't make them both show up in the same HTML container since both have different templates. Is there a way of acheiving this?

I am using DXP 7.3.

Many Thanks!

thumbnail
Olaf Kock, modified 5 Years ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts

If I understand the first part of your question correctly, I'd rather recommend to create your own "related assets" widget instead of changing the stock one: That one is simple and just shows the configured related assets to the main asset on page. Period.

If you have other criteria to determine the relatedness, just build your own widget that implements them. This way you won't have to maintain a delta with a widget that does different things, but have your own relatively stable implementation.

I don't fully understand the second part of your question

Nofal B, modified 5 Years ago. New Member Posts: 2 Join Date: 12/4/20 Recent Posts

Thankyou for the reply! Can you please guide me to the correct way of making my own widget and/or extending it if possible?

I can explain my second question more clearly. Is there a way to control the templates so I have control of the related asset widget and display page template widget at the same time because in my case they both need to be in one HTML div container I dont see a possible way to do it currently. So far I havent seen anything that could help me in the documentation so I would really appreciate it if you could guide me to the correct way of doing both.

Many thanks!

thumbnail
Olaf Kock, modified 5 Years ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts

Regarding your followup: To create your own Widget, follow any portlet documentation. In depth, you can find one here.
As you mention DXP: Liferay University access is included in a DXP subscription, you can also go through the trainings at https://passport.liferay.com

The "same div container" requirement sounds weird to me. Well - technically they are (<div id="wrapper">) but in general, you probably "only" need the information about the other article to be shown on the page. As you mention the "Related Assets" portlet, you're obviously aware of it. I'd recommend to inspect it to see how it determines the main asset that it should relate to.