private function cartShipping() { $dataf = $this->Cart->DataJsonCart($this->Cart->id); $data = $this->Cart->DataCart($this->Cart->id); #if( $data->id_shipping != 1 && $data->id_shipping != 2 ) return true; #$items = $this->Cart->ListItems(); $ccdata = $this->Cart->DataCart($this->Cart->id); $total = $ccdata->total; /*$cost = 0; foreach($items as $item) { $cost = $item->items * $item->cost; $total += $item->items; }*/ $reembolso = 0; if ($data->id_payment == 5) { $reembolso = number_format($total, 2, ',', ''); } $requestParams = array('usuario' => 'takezo_p', 'clave' => 'hBXlqzCvV8', 'codigo_rte' => '000802467', 'nombre_rte' => 'Ana Angulo', 'direccion_rte' => 'C/ROSELLON 222', 'poblacion_rte' => 'BARCELONA', 'codpos_rte' => '08008', 'nifdni_rte' => '', 'contacto_rte' => '', 'telefono_rte' => '', 'nombre_cons' => $dataf['name'] . ' ' . $dataf['lastname'], 'direccion_cons' => $dataf['dir1'], 'poblacion_cons' => $dataf['city'], 'pais_cons' => '', 'codpos_cons' => substr($dataf['cp'], 0, 7), 'nifdni_cons' => substr($dataf['dni'], 0, 20), 'contacto_cons' => '', 'telefono1_cons' => isset($dataf['cel_2']) && $dataf['cel_2'] ? $dataf['cel_2'] : $dataf['cel'], 'telefono2_cons' => '', 'observ_cons' => $data->comments, 'mercan' => '', 'referencia' => '', 'bultos' => 1, 'kilos' => '1', 'volumen' => '0', 'ml' => '', 'servicio' => '3', 'codigo_fac' => '', 'tipo_portes' => 'P', 'tipo_reemb' => 'P', 'reembolso' => $reembolso, 'valor_seguro' => 0); $client = new SoapClient('https://wscli.zeleris.com/EXPPeticion.asmx?wsdl', array('cache_wsdl' => 0, 'soap_version' => SOAP_1_1, 'trace' => 1)); $response = $client->DocumentarExpedicion($requestParams); if (!$response || !isset($response->DocumentarExpedicionResult)) { $response = false; } else { $response = simplexml_load_string($response->DocumentarExpedicionResult); } if (!$response || !isset($response->resultado) || $response->resultado != 'OK') { if (isset($response->mensaje)) { $this->data['error'] = utf8_decode($response->mensaje); } return $this->index('tpv-ko'); } $data = array('modified' => date('Y-m-d H:i:s'), 'shipping_data' => json_encode($response)); $this->Cart->SaveCartData($data); $this->cartTag($response->expedicion); return true; }