Jump to content

Update Configurable Custom Field using updateclientproduct


dixonjoseph.k

Recommended Posts

Hi,

 

We have to update client products dynamically. For that we developed a script, it should update configurable custom field (which is a hidden filed) with static values. But it is not updating even it shows "Success" message. Please see the code below.

 

<?php
$url = "https://example.com:8081/includes/api.php";
$postfields["username"] ="test";
$postfields["password"] = md5("test");								 
$postfields["action"] = "updateclientproduct";
$postfields["serviceid"] = 229; 
$postfields["pid"] = 152; 
$postfields["autorecalc"] = 1;

$postfields["configoptions"] = base64_encode(serialize(array(537 => array('optionid' => '7613', 'qty' => '1'))));
$postfields["responsetype"] = "xml";

$query_string = "";
foreach ($postfields AS $k=>$v) $query_string .= "$k=".urlencode($v)."&";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $query_string);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$xmldata = curl_exec($ch);	

if (curl_error($ch))
{
die("Connection Error: ".curl_errno($ch).' - '.curl_error($ch));
}
else
{
print_r($xmldata);
}
?>

 

The above script is trying to update product data in test licensed whmcs site and it is running from live whmcs directory. When it executes it shows as 'Success', but not updated. Please help.

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