trabajando en guardar

This commit is contained in:
2025-01-15 01:50:15 +01:00
parent a4394ed470
commit a9eece668c
16 changed files with 859 additions and 846 deletions

View File

@ -98,11 +98,13 @@ class TarifaEnvioModel extends \App\Models\BaseModel
// Si el pais es españa se tienen que tener en cuenta los postales
// Se busca primero la tarifa a la que corresponde
$builder = $this->db->table($this->table . " t1")
->select("t1.id AS tarifa_envio_id, t2.importe_fijo as importe_fijo")
->select("t1.id AS tarifa_envio_id, t2.importe_fijo as importe_fijo, t3.nombre as pais")
->join("tarifas_envios_zonas t2", "t1.id = t2.tarifa_envio_id")
->join("lg_paises t3", "t1.pais_id = t3.id")
->where("t1.pais_id", $paisId)
->where("t1.is_deleted", 0)
->where("t2.is_deleted", 0);
if ($paisId == 1) { // España
$builder->where("CAST(t2.cp_inicial AS UNSIGNED)<=", intval($cp))
@ -117,10 +119,12 @@ class TarifaEnvioModel extends \App\Models\BaseModel
$precio_tarifas = $model->getEnvioPrecio($tarifa->tarifa_envio_id, $peso, $tipo_envio);
foreach ($precio_tarifas as $precio_tarifa) {
$precio_tarifa->importe_fijo = $tarifa->importe_fijo;
$precio_tarifa->pais = $tarifa->pais;
array_push($resultado, $precio_tarifa);
}
}
return $resultado;
}
}