+ Start a Discussion
Jaime StuardoJaime Stuardo 

Sending data from e-commerce site to SalesForce

Hello,

I want to send some data from an E-Commerce site to SalesForce.

This is a system already developed where I need to add a new variable to send to SalesForce.

Currently this bidimensional array is being constructed:
$salesForce['pedido']['numero_pedido'] = substr($orderId, 0, 20);
$salesForce['pedido']['fecha'] = substr($pedidoFecha, 0, 10);
$salesForce['pedido']['metodo_pago'] = substr($pedidoMetodoPago, 0, 80);
The actual request is done with this instruction:
$wsResponse = json_decode($this->callRestWS('POST', $this->ws_salesforce, json_encode($salesForce)), true);
where callRestWS is defined this way:
    function callRestWS($method, $url, $data = false)
    {
        $curl = curl_init();
        switch ($method)
        {
            case "POST":
                curl_setopt($curl, CURLOPT_POST, 1);
                if ($data) {
                    curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
                }
                break;
            case "PUT":
                curl_setopt($curl, CURLOPT_PUT, 1);
                break;
            default:
                if ($data) {
                    $url = sprintf("%s?%s", $url, http_build_query($data));
                }
        }
        // curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
        // curl_setopt($curl, CURLOPT_USERPWD, "username:password");
        curl_setopt($curl, CURLOPT_URL, $url);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($curl, CURLOPT_HTTPHEADER, array(
            'Content-Type: application/json',
            'accept: application/json'
            ));
        $result = curl_exec($curl);
        curl_close($curl);
        return $result;
    }
This currently works.

First, can you teach me where might be stored, in SalesForce, the parameteres numero_pedido, fecha and metodo_pago? I have searched everywhere but I could not find anything similar.

I think by resolving question above, I can do the next part. I need to add a 4th parameter to those, so I need to create it in SalesForce so that it could take and store it.

Any help will be greatly appreciated,

Thanks
Jaime