News:

Looking for documentation? Take a look on our wiki

Main Menu

Make custom fields more stand out, more user friendly

Started by Kuubs, April 03, 2018, 16:16:00 PM

Previous topic - Next topic

Kuubs

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?

Kuubs

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.

Kuubs

Can anybody please support me in this? I have tried to find it myself but I cannot seem to do that.

jenkinhill

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 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.
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Kuubs

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 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.