News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

How to give a custom field a separate title for each product?

Started by gba, December 08, 2020, 15:47:58 PM

Previous topic - Next topic

gba

Hello all!

How can I give a customfield a separate title for each product?
Sure, I could create a new copy of the customfield for each product and add it to the product then.
But that seems to me not to be very reasonable.
Isn't there any way to differently configure the title of one and the same customfield with each product?

Thank you very much in advance for any useful hint!

Kind regards,
Gerald

Jörgen

This is just an idea, turn off the display of title for the product and add a textfield before this customfield, there you can change the text as You please.

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

Studio 42

A solution can be to generate the tittle with the product ID or name , but this need some PHP knowledge.

gba

Quote from: Studio 42 on December 09, 2020, 12:30:56 PM
A solution can be to generate the tittle with the product ID or name , but this need some PHP knowledge.
Hm ... seems to be too complicated for the shop admin.
Thank you, though!

gba

Quote from: Jörgen on December 09, 2020, 10:49:59 AM
This is just an idea, turn off the display of title for the product and add a textfield before this customfield, there you can change the text as You please.
Thank you for your idea.
I created a new custom field of type 'String'.
Then I added it to the product's custom fields and entered a text.
In frontend then a selectbox is displayed with that text as an option.
What did I do wrong?

Jörgen

Go through the custom field settings. The are maybe not obvious, but with som trial and error you Will get it.

Jörgen
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

Studio 42

If you see a select box, it's because you have set it as an input or cart custom field

jenkinhill

This is what I use for a text instruction on one client site:

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

gba

Thank you very much for taking time to send me that screenshot.
I configured the custom field according that, except the setting 'Cart attribute' - this I set to 'Yes' to have it rendered in the cart, too.
But now I am still having the problem, that custom fields of type Y are being rendered after fields of type E in the cart.
This makes that solution approach useless.

The most flexible solution would be this new feature in the product backend, custom fields tab:  #featurerequest
Instead of just displaying the configured title (see now.jpg attached), display a textbox containing the title as default value (see new.jpg attached).
Then the shop admin could decide to leave the default title or set an individual one for that product.

Any other idea?

Jörgen

You know that You can change the order of customfields with drag and drop, yes ?

Jörgen
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

gba

Yes, I know and did that.
And it works in product view.
But in the cart the Y fields actually are not being rendered at the place, where they are in the product backend.
Also the setting 'Show Title' seems to be ignored: The title is rendered within the same span as the textaread content, right before it.
Seems to be a bit weird ...

AH

You can always create your own customfield plugin if the core one does not suit your needs


And then you can create your own template to render as you want
Regards
A

Joomla 4.4.5
php 8.1

gba

I am using third party custom field plugins, which are constantly being maintained.
Everytime cloning them to have an editable title seems to be not that reasonable to me.

I attached the settings I made for the "title field" (see customfield.jpg).
I also attached a screenshot of the cart output, where I noted the order in the backend (see cart.jpg).

GJC Web Design

how about

<span class="product-fields-title-wrapper"><span class="product-fields-title"><strong><?php echo vmText::_ ($field->custom_title.$product->virtuemart_product_id) ?></strong></span>

CUSTOMFIELD_TITLE22="title for pid 22"
CUSTOMFIELD_TITLE23="title for pid 23"

etc etc
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

gba

Hi all!

Thank you again for your suggestions.

I gave the additional text field(s) before the concerning custom field(s) a try.
But it turned out, that it is not enough for us to just display an additional text field.
We need the title in the object of the respective custom field for further data processing.

The idea with concatenating the product id looks nice, too.
But actually we don't want to create a language override for every needed custom field in every product.

And cloning third party custom field plugins and maintaining the clones is way too expensive.

Therefore I am coming back to my idea:
The most flexible solution would be this new feature in the product backend, custom fields tab:
Instead of just displaying the configured title, display a textbox containing the title as default value.
Then the shop admin could decide to leave the default title or set an individual one for that product.

Unfortunately Milbo told me, that he is not interested in that feature.
From his point of view this would cost too much performance.
So does anyone, please, have any other/better idea to enable the shop admin to easily decide to leave the default custom field title or set an individual title for any product, where this is necessary?

I am very grateful for your help!

Kind regards,
Gerald