Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: RE: Hide the price
Hello, is there a way to hide products price for all users which are
in an inactive Account or for not logged users?
Liferay 7.4
Hi Gennaro, there are a few options that come to mind.
- If you want to hide the products completely, you can adjust the Product Visiblity for that Account Group and have some logic (possibly in a model listener) that moves inactive accounts into a specific Account Group.
- If the Channel (Site) is built with a private pages, you could remove access to those pages if the Account is inactive. This would probably require a model listener on the Account object.
- You could implement some logic in a product renderer that hides prices on those products (e.g. Member Pricing Renderer is an example of hiding for guests, you could do something similar that also checks for Account status).
The first approach would cover the UI and the headless APIs, the 2nd and 3rd would only cover the UI.
Hello Jeffrey
- I don't want to hide the products completely, so I exclude point one.
- I have public pages, option 2 doesn't fit too
- I implemented already a custom commerce search result template, and with it I'm able to hide the price to not logged users. But I should hide the price also in product publisher widget and in the product page. So before to implement other custom solutions I was wondering if there was a fast solution, like a system setting.
Hi Gennaro,
I am trying to find out if the work being done on COMMERCE-5603 will support your use case. If not, I think this would be a great candidate for a Feature Request. If you do not have access to create Jira issues, let me know and I can create the issue for you.
Also, I wanted to be sure that you were aware that if you implement your commerce search result template as an OSGi module that implents the CPContentListRenderer (e.g. https://github.com/jhanda/plan-renderer) you can create a single renderer that can be used by Product Publisher and Commerce Search Results widgets. (It could even be used by the Product Comparison Table widget too). You would just need to be sure to include the "commerce.product.content.list.renderer.portlet.name=" property in your Component annotation as seen here: https://github.com/jhanda/plan-renderer/blob/main/src/main/java/com/liferay/commerce/demo/plan/renderer/list/PlanCPContentListRenderer.java#L35-L37
Thanks for all information. I started to watch that issue, if you get more info about it then let me know
Powered by Liferay™