Jump to content

Problem with customfields array when making a servermodule


TommyK

Recommended Posts

Getting no error message or anything, but the info does not save. Anyone see why?

 

$command = 'updateclientproduct';
$values = array('serviceid' => $params["serviceid"], 'customfields' => base64_encode(serialize(array('Fieldname' => "data"))));
$adminuser = 'adminusername';

# Call API
$results = localAPI($command,$values,$adminuser);

if ($results['result']!="success") echo "An Error Occurred: ".$results['result'];
return $results['result'];

 

/Tommy

Link to comment
Share on other sites

I found out my problem. The code in OP is not working. A working example is below;

 

$command = 'updateclientproduct';
$values = array('serviceid' => $params["serviceid"], 'customfields' => base64_encode(serialize(array("3" => "data"))));
$adminuser = 'adminusername';

# Call API
$results = localAPI($command,$values,$adminuser);

if ($results['result']!="success") echo "An Error Occurred: ".$results['result'];
return $results['result'];

 

The id of the array values wasn't from 0 to 4 in my case, they were scattered little bit.

 

So I also had to enter Display Order for all of my custom fields on my product.

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