File "ws-stores-20241022103646.php"
Full Path: /srv/www/www.cadoro.it/scripts/ws-stores-20241022103646.php
File size: 1.24 KB
MIME-type: text/x-php
Charset: utf-8
<?php
require("includes/loader.inc.php");
require("includes/smarty.inc.php");
$result = classes\Fidelity::Negozi();
foreach ($result as $store) {
$store = array(
"id" => $store['negozio']*1,
"slug" => _slug($store['citta'] . " " . preg_replace("/([,0-9]|S\.S\.).*/", "", $store['indirizzo'])),
"title" => trim($store['citta'] . " " . preg_replace("/([,0-9]|S\.S\.).*/", "", $store['indirizzo'])),
"type" => 1,
"address" => trim($store['indirizzo']),
"zipcode" => trim($store['cap']),
"city" => trim($store['citta']),
"province" => trim($store['provincia']),
"lat" => _n($store['latitudine'], 8),
"lng" => _n($store['longitudine'], 8),
"phone" => trim($store['telefono']),
"email" => trim($store['mail']),
);
if (!($s = models\Store::get_by_id($store['id']))) {
models\Store::add($store);
} else {
$s['title'] = $store['title'];
$s['address'] = $store['address'];
$s['zipcode'] = $store['zipcode'];
$s['city'] = $store['city'];
$s['province'] = $store['province'];
$s['lat'] = $store['lat'];
$s['lng'] = $store['lng'];
$s['phone'] = $store['phone'];
$s['email'] = $store['email'];
$s->update($s);
}
}