Jump to content
ajmeireles

Custom Fields By User

Recommended Posts

Hello, everyone!

Happy new year!

Someone can help me to understand how I can check if a specific(or all) customers have one same value set in "value" of a specified products custom field?

I'm trying do it using MYSQL, but doesn't have success.. For example: if I look for ID 4 on "relid" of tblcustomfieldsvalues table, I receive all customer custom fields, as birthday. However the products custom field for this customer(id 4) is using relid 61.

How I can get it?
How understand it?

Share this post


Link to post
Share on other sites
On 04/01/2019 at 18:20, ajmeireles said:

Someone can help me to understand how I can check if a specific(or all) customers have one same value set in "value" of a specified products custom field?

you should be able to do it from the Product/Services page in the Admin Area if that's easier for you...

7HZAj1p.png

On 04/01/2019 at 18:20, ajmeireles said:

I'm trying do it using MYSQL, but doesn't have success.. For example: if I look for ID 4 on "relid" of tblcustomfieldsvalues table, I receive all customer custom fields, as birthday. However the products custom field for this customer(id 4) is using relid 61.

when if you wanted all customfield values for ID4, then it's a simple query...

SELECT * FROM tblcustomfieldsvalues WHERE tblcustomfieldsvalues.relid = '4'

but that will give you all types of customfield values (addon, client, product, support etc) - if you just wanted a specific result, specify the fieldid (which equals the id value in tblcustomfields) in the query...

SELECT * FROM tblcustomfieldsvalues WHERE tblcustomfieldsvalues.relid = '4' AND tblcustomfieldsvalues.fieldid = '61'

Share this post


Link to post
Share on other sites
23 hours ago, brian! said:

you should be able to do it from the Product/Services page in the Admin Area if that's easier for you...

7HZAj1p.png

when if you wanted all customfield values for ID4, then it's a simple query...


SELECT * FROM tblcustomfieldsvalues WHERE tblcustomfieldsvalues.relid = '4'

but that will give you all types of customfield values (addon, client, product, support etc) - if you just wanted a specific result, specify the fieldid (which equals the id value in tblcustomfields) in the query...


SELECT * FROM tblcustomfieldsvalues WHERE tblcustomfieldsvalues.relid = '4' AND tblcustomfieldsvalues.fieldid = '61'

Sorry due abou my long question, Brian!

As a resume, I want understand how is associated the relid id of tblcustomfieldvalue with the customer.

For example, at same time that customer ID is 4 to custom fields of register, the customer ID to the product custom field in tblcustomfieldvalue is other!

Did you understand me?

See it: 

Looking for register custom field 235:
(custom field 235 is named as birthday)

image.png.25cbf6340d631914c7d87185a12dea4b.png

- See that relid is correct! The customer ID is 2 and relid was displayed as 2, it's correct due the customer id is really 2!

Looking for a VALUE inserted on specific custom field of a product that is used to customer with id 2:

image.png.a0752cf7cf0713c0756f35d91e4ba316.png

- See that relid id on this case is other, different of the REAL CUSTOMER ID, on this case the relid was 626.

I want understand it!

Share this post


Link to post
Share on other sites
23 hours ago, ajmeireles said:

As a resume, I want understand how is associated the relid id of tblcustomfieldvalue with the customer.

then you should probably use Google and search for "relational databases" and get reading - otherwise it might take me all afternoon to walk you though this! celestial5.gif

but it might help if I quickly told you that relid in tblcustomfieldvalues does not always relate to a customer ID - it will do if it's a client custom field; if it's a product, it will relate to tblproducts; if it's a support custom field, it will relate to tbltickets; if it's a product addon custom field it will relate to the id in tbladdons.

so as you can now hopefully see, you can't just take a relid value from tblcustomfieldvalues and know for sure what it is.

you will have to check the fieldid value as that will give you the id value in the tblcustomfields database table and from that table you will be able to tell what type of custom field it is (addon/client/product/support etc)... and once you know the type, you will know which table that the relid is referring to.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

By using this site, you agree to our Terms of Use & Guidelines