Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

How To Get Custom Profil Field Name And Their Values? Rate Topic   - - - - -

 
  • ooaykac
  • Senior Member
  • Members
  • Join Date: 22-Nov 12
  • 298 posts

Posted 30 December 2019 - 07:07 AM #1

How to get custom profil field names and values? When I check by fn_print_die I only see below:


[fields] => Array ( [64] => 9999999999999999 [65] => 88888777         ) 


 
  • soft-solid
  • Junior Member
  • Authorized Reseller
  • Join Date: 19-Apr 10
  • 997 posts

Posted 30 December 2019 - 05:49 PM #2

Hello
 
I use this function to extract data from an order or profile field.
 
function fn_find_add_field($field_name = "", $order_id = 0, $user_id = 0)
{
    if(!empty($field_name)) {
        $field_id = db_get_field("SELECT field_id FROM ?:profile_fields WHERE field_name = ?s", $field_name);
        if($field_id) {
            if(isset($order_id) && $order_id > 0) {
                $return = db_get_field(
                    "SELECT value FROM ?:profile_fields_data"
                    . " WHERE object_id = ?i AND object_type = ?s AND field_id = ?i", $order_id, 'O', $field_id
                );
                if(empty($return)) {
                    if($user_id > 0) {
                        $return = db_get_field(
                            "SELECT value FROM ?:profile_fields_data"
                            . " WHERE object_id = ?i AND object_type = ?s AND field_id = ?i", $user_id, 'U', $field_id
                        );
                        if(!empty($return)) {
                            return $return;
                        } // end if
                    } // end if
                } else {
                    return $return;
                } // end if
            } // end if
        } // end if
    } // end if
} // end function fn_find_add_field
 
Best regards
Robert

Team of SoftSolid
cs-cart.pl

 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19982 posts

Posted 05 January 2020 - 06:48 AM #3

 

How to get custom profil field names and values? When I check by fn_print_die I only see below:


[fields] => Array ( [64] => 9999999999999999 [65] => 88888777         ) 

 

 

Try to use built-in function

 

E.g.

$_data = fn_get_profile_field(64);
fn_print_die($_data);

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)