continuacion del controlador
Código PHP:
Ver original//Validate sendmail
if ($this->contact_us_emails_m->insert($data['post'])) {
// si estan separados por , mandamos los correos si no mandamos 1 solo
$id_email = $this->db->insert_id();
$products_contact = $this->session->userdata('products_contact');
if (count($products_contact) > 0) { foreach ($products_contact as $item => $value) {
$quote_array = array('id_product' => $item, 'id_email' => $id_email, 'pagina' => $products_contact[$item]['pagina']); $this->db->insert('contact_us_email_products', $quote_array);
}
}
$products = '';
foreach ($products_contact AS $row => $value) {
}
$products = $this->db->select('pr.*')->from('products AS pr')->where_in('pr.id', $array)->get()->result();
}
$this->session->set_userdata(array('products_contact' => array()));
foreach ($emails AS $row => $value) {
$this->send_email_to_user($data['post'], $value, $products);
}
} else {
$send = $this->send_email_to_user($data['post'], $email, $products);
}
if($send){
$statusJson = '';
$msgJson = 'Su mensaje ha sido enviado';
}else{
$statusJson = 'error';
$msgJson = 'Error Mailing, Contact the Webmaster. x2020';
}
} else {
$statusJson = 'error';
$msgJson = 'Error Mailing, Contact the Webmaster';
}
} else {
$statusJson = 'error';
$msgJson = validation_errors();
}
}
public function detail($slug) {
$return = $this->google_map_model->get_many_by('slug', $slug);
$return = $return[0];
if (!$return)
redirect('google_maps');
// Se convierten algunas variables necesarias para usar como slugs
'image' => val_image($return->image),
);
$relation = $this->db->where('google_map_id', $google_map['id'])->get('google_maps_categories')->result();
foreach ($relation as $item) {
$category = $this->google_map_category_model->get_many_by('id', $item->category_id);
$category = $category[0];
"title" => $category->title,
"slug" => $category->slug
);
}
// imagenes para slider
$images = $this->google_map_image_model->get_many_by('google_map_id', $google_map['id']);
// datos para el mapa de google
// mandamos los puntos
$json_markers = json_encode(array(array($google_map['adress'] . ', Prueba-Cali', (double
) $google_map['coordinate1'], (double
) $google_map['coordinate2'])));
// sacamos solo el nombre de la imagen
$imageTogoogle = str_replace(site_url
() . 'uploads/default/' . $this->moduleName . '/', "", $google_map['image']);
// mandamos los datos para el modal dentro del mapa
$json_info_content = json_encode(array(array('image' => $imageTogoogle, 'adress' => $google_map['adress'], 'title' => $google_map['name'], 'moduleName' => $this->moduleName, 'schedule' => $google_map['schedule'], 'description' => $google_map['description'])));
$this->template
->append_js('module::google_maps.js')
->set('json_info_content', $json_info_content)
->set('json_markers', $json_markers)
->set('google_map', (object) $google_map)
->set('categories', $categories)
->set('images', $images)
->build('detail');
}