VirtueMart Forum

VirtueMart 2 + 3 + 4 => Administration & Configuration => Topic started by: Kuubs on April 03, 2018, 16:16:00 PM

Title: Make custom fields more stand out, more user friendly
Post by: Kuubs on April 03, 2018, 16:16:00 PM
Hello,

I have a store which has products with custom fields. Works flawlessly, except for the fact that in the order manager, the custom fields get displayed like this:

question answer

So for example

color red
color none

The problem that arises is that in the order manager, you can miss the custom fields and their values because its not very clear when an answer is given, and when no answer is given. I want to add some styling to the answers to make them more stand out (if a value is chosen)

Now I checked the backend files and the custom fields get called via this way:

$product_attribute = VirtueMartModelCustomfields::CustomsFieldOrderDisplay($item,'BE');

And that gets put between <div></div>

Now everything gets defined in this call, but I want to add some classes to the answers to make them stand out. Is this possible?
Title: Re: Make custom fields more stand out, more user friendly
Post by: Kuubs on April 05, 2018, 10:24:19 AM
Anyone has an idea? Maybe an override? I tried but it seems that I have to modify the core code?

Else maybe a hack with javascript? It only has to be more user friendly in regards to reading it. Actually changing the code so that the program sees it differently does't have to.
Title: Re: Make custom fields more stand out, more user friendly
Post by: Kuubs on April 09, 2018, 11:01:07 AM
Can anybody please support me in this? I have tried to find it myself but I cannot seem to do that.
Title: Re: Make custom fields more stand out, more user friendly
Post by: jenkinhill on April 09, 2018, 11:59:25 AM
It's important to avoid a core hack. You could add a css style for .vm-customfield-cart but that is not specific to just the answer.

It can be done by using Regularlab's ReReplacer (https://www.regularlabs.com/extensions/rereplacer) which I have used for similar functions to avpoid core hacking on non-VM sites.

I just tested it on VM and found it can be used. It does mean that all possible custom field selections + answers would need entering into the ReReplacer component, though.

eg with ReReplacer set to work in admin area only,  search for Size: M  and replace with Size: <span style="color:red;">M</span> displays Size: M whenever Size: M is found.  Although it is something extra to maintain, different answers could be shown with different colours or made bold etc.
Title: Re: Make custom fields more stand out, more user friendly
Post by: Kuubs on April 09, 2018, 14:44:19 PM
Quote from: jenkinhill on April 09, 2018, 11:59:25 AM
It's important to avoid a core hack. You could add a css style for .vm-customfield-cart but that is not specific to just the answer.

It can be done by using Regularlab's ReReplacer (https://www.regularlabs.com/extensions/rereplacer) which I have used for similar functions to avpoid core hacking on non-VM sites.

I just tested it on VM and found it can be used. It does mean that all possible custom field selections + answers would need entering into the ReReplacer component, though.

eg with ReReplacer set to work in admin area only,  search for Size: M  and replace with Size: <span style="color:red;">M</span> displays Size: M whenever Size: M is found.  Although it is something extra to maintain, different answers could be shown with different colours or made bold etc.

I'm not fond of a core hack, so every other possible solution would be preferred.

That ReReplacer tools looks good. I'm gonna check it out.