VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: EvanGR on August 11, 2022, 14:08:43 PM

Title: Custom Fields: Allow using the same Title multiple times
Post by: EvanGR on August 11, 2022, 14:08:43 PM
Hello,

I've run into this limitation multiple times. I want to use the same "Title" for two (or more) Custom Fields, but it's not permitted.

We create groups of products, where the same name custom field may mean a different thing, be implemented differently, and reside in a different Layout position.
It would be a huge relief if I could use the same names for multiple fields.

I understand each field must have a unique identifier. One way to overcome this, is to add a new optional property e.g. "Name" where we could use to name the field instead of "Title", with no restrictions.
If "Name" is filled in, it is used for display only, while keeping the "Title" field as a unique identifier behind the scenes.

Thanks for any consideration.
Title: Re: Custom Fields: Allow using the same Title multiple times
Post by: pinochico on August 11, 2022, 15:53:50 PM
custom html output in template override, where you can put custom anything == you don't need new property for customfield

https://www.archivbox.cz/prenosny-box-m28-8000z00-0012

tab params and link to BS modal with icons

or you can create a language constant by custmfield ID
Title: Re: Custom Fields: Allow using the same Title multiple times
Post by: EvanGR on August 11, 2022, 16:43:51 PM
@pinochico Very nice website!

But I don't understand your message... I am talking about the VM Custom Fields. Especially those you select in the Add to Cart section.
Title: Re: Custom Fields: Allow using the same Title multiple times
Post by: pinochico on August 11, 2022, 19:11:11 PM
The correct solution is to make the unique identifier not the CF name, but the ID - this is the old VM disease

At this point if you want to use a custom/different/same title for multiple fields, the only option is to modify the customfield renderer with override in the template focusing on the ID and add the title as a language constant that can be the same for multiple fields.

This is how we customized the output and did not use the customfield sublayout to insert a different headline.
Title: Re: Custom Fields: Allow using the same Title multiple times
Post by: EvanGR on August 12, 2022, 08:24:51 AM
I got it now... thanks!

Very smart. A bit technical, but smart!
Title: Re: Custom Fields: Allow using the same Title multiple times
Post by: balai on August 12, 2022, 11:29:29 AM
You can also use language constants instead of real titles
Title: Re: Custom Fields: Allow using the same Title multiple times
Post by: Studio 42 on August 12, 2022, 17:10:11 PM
EvanGR : use Joomla keys
CUSTOM_TITLE_1, CUSTOM_TITLE_2, CUSTOM_TITLE_3,...
...
Then add your translation as any other Joomla language keys
CUSTOM_TITLE_1 = "my same title"
CUSTOM_TITLE_2 = "my same title"
CUSTOM_TITLE_3 = "my same title"
Title: Re: Custom Fields: Allow using the same Title multiple times
Post by: EvanGR on August 13, 2022, 10:02:09 AM
I can use joomla keys in the Title of each custom field? In the VM backend interface, where I set up the Custom Field? Really?

Quote from: Studio 42 on August 12, 2022, 17:10:11 PM
EvanGR : use Joomla keys
CUSTOM_TITLE_1, CUSTOM_TITLE_2, CUSTOM_TITLE_3,...
...
Then add your translation as any other Joomla language keys
CUSTOM_TITLE_1 = "my same title"
CUSTOM_TITLE_2 = "my same title"
CUSTOM_TITLE_3 = "my same title"