Question

We would like to use the values from the Magento attribute frontend properties 'Use in Quick Search' and 'Use in Advanced Search'.

We have changed the properties translations to 'Show for wholesale user' and 'Show for distributor user'. We aim to show/hide some attributes based on customer group without to make extra store views and have to clear attribute values per product and per store view.

So, in the Catalog/Block/Product/View/Additional.php file we want to obtain the values of the frontend properties so we can show/hide based on customer group.

I hope it's clear enough.

Thanks,

Michael

Was it helpful?

Solution

First of all I think you are referring to the file Catalog/Block/Product/View/Attributes.php. If not, then I misunderstood and I will delete this answer.
To check if the attribute is set to 'Use in Quick search' you can do it like this: if ($attribute->getIsSearchable()){...} and if you want to check if an attribute is marked as 'use in advanced search' if ($attribute->getIsVisibleInAdvancedSearch()){...}.
But I don't think is a good idea what you are trying to do. Changing the labels does not change the field purpose.
Your customers will see a strange advanced search for example. they will search for something and get (valid) results that won't mean anything to them because they may be in the wrong group.
I recommend adding 2 new fields to the attribute form to serve your requirements.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top