Jump to content

Add Field on Product


Recommended Posts

Hi, i'm a new WHMCS user.

I wanted to know if it was possible to set a personalized value in the product tab.
It would serve me generic for all users who choose that product, so I cannot use the custom fields as they will then have to be set for each individual user who purchases that product.
Is it possible to do this or do I need a hook?

Link to comment
Share on other sites

On 09/07/2020 at 17:41, luigidefra said:

It would serve me generic for all users who choose that product, so I cannot use the custom fields as they will then have to be set for each individual user who purchases that product.

you want a personalised value, but you don't want to set it individually ??

there's nothing to stop you using a custom field, setting it as admin only, and setting the values individually when you need to.

alternatively, if the value is going to be a same for all users, then you could use a product custom field, make it a dropdown and only enter one value as an option - and then don't show it on the order forms.

On 09/07/2020 at 17:41, luigidefra said:

Is it possible to do this or do I need a hook?

i'd still use a custom field whether you use a hook to fill it or not... but what is this personalised value going to be and do you want the user to know about it or enter a value for it ??

Link to comment
Share on other sites

On 7/13/2020 at 5:24 PM, brian! said:

i'd still use a custom field whether you use a hook to fill it or not... but what is this personalised value going to be and do you want the user to know about it or enter a value for it ??

The user does not need to know anything about this field. It is a field that I must insert when creating a new product.
It would like to be shown only in my products tab and only I can edit it.
I need it to use in an external addon made by me.

In fact, I asked if it is feasible via hook to make sure to add an additional field in the create product and change product tab

Link to comment
Share on other sites

23 hours ago, luigidefra said:

The user does not need to know anything about this field. It is a field that I must insert when creating a new product.
It would like to be shown only in my products tab and only I can edit it.
I need it to use in an external addon made by me.

I still think the native way to do it would be an admin-only product custom field... client wouldn't never see it and it gives you a value in the database per service that you can adjust.

23 hours ago, luigidefra said:

In fact, I asked if it is feasible via hook to make sure to add an additional field in the create product and change product tab

with a product custom field, you can obtain, or update, its value by any number of methods (sql/capsule/api etc).

Link to comment
Share on other sites

On 7/16/2020 at 7:03 PM, brian! said:

I still think the native way to do it would be an admin-only product custom field... client wouldn't never see it and it gives you a value in the database per service that you can adjust.

with a product custom field, you can obtain, or update, its value by any number of methods (sql/capsule/api etc).

yes, But so I will have to go to each user card, select the product and fill in the custom field.
Instead, I already know upstream, creating a product, what will be its value for all users

Link to comment
Share on other sites

21 hours ago, luigidefra said:

yes, But so I will have to go to each user card, select the product and fill in the custom field.

i'm not suggesting that you necessarily have to fill these details in manually.

21 hours ago, luigidefra said:

Instead, I already know upstream, creating a product, what will be its value for all users

the reason why i'm suggesting a PCF is because it gives you an empty container that you can use when the service is created - so when you, or WHMCS automatically, creates the client's service, you can fill this PCF with whatever your default value is... via hook, api whatever.

Link to comment
Share on other sites

16 minutes ago, brian! said:

the reason why i'm suggesting a PCF is because it gives you an empty container that you can use when the service is created - so when you, or WHMCS automatically, creates the client's service, you can fill this PCF with whatever your default value is... via hook, api whatever.

ok, this was a solution!

today,  I solved it by adding a configurable option group hidden and set as a dropdown with a single value inside. So during the creation of the product by a customer, the product will have its option as attribute ...

 

Is this also correct as a solution?

Link to comment
Share on other sites

17 hours ago, luigidefra said:

Is this also correct as a solution?

if it works, yes. 🙂

it's just another empty container that you're filling on account creation, but instead of being stored in the tblcustomfieldsvalues database table, it's going to be stored in the tblhostingconfigoptions table.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated