本文整理汇总了PHP中Address::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Address::update方法的具体用法?PHP Address::update怎么用?PHP Address::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Address
的用法示例。
在下文中一共展示了Address::update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayMain
public function displayMain()
{
global $smarty, $link, $cookie;
$errors = false;
if (!$cookie->logged || !User::checkPassword($cookie->id_user, $cookie->passwd)) {
Tools::redirect($link->getPage('userView'));
}
$referer = Tools::Q('referer') ? $link->getPage(Tools::Q('referer')) : $link->getPage('MyAddressesView');
if ($id_address = Tools::Q('id')) {
$address = new Address((int) $id_address);
if (Tools::isSubmit('saveAddress')) {
$address->copyFromPost();
if ($address->update()) {
Tools::redirect($referer);
} else {
$errors = $address->_errors;
}
}
$smarty->assign('address', $address);
} elseif (Tools::isSubmit('saveAddress')) {
$address = new Address();
$address->copyFromPost();
$address->id_user = $cookie->id_user;
if ($address->add()) {
Tools::redirect($referer);
} else {
$errors = $address->_errors;
}
}
$countrys = Country::loadData(1, 1000, 'position', 'asc', array('active' => true));
$smarty->assign(array('referer' => Tools::Q('referer'), 'countrys' => $countrys, 'errors' => $errors));
return $smarty->fetch('address.tpl');
}
示例2: updateProcess
function updateProcess($id)
{
$send = Request::get('send');
$address = Request::get('address');
$address['firstname'] = $send['firstname'];
$address['lastname'] = $send['lastname'];
Users::update($id, $send);
Address::update($id, $address);
}
示例3: getAddress
/**
* Get location of user
* @param Address $address location
*/
public function getAddress()
{
$address = null;
if ($data = $this->getLocationData()) {
$address = new Address();
$address->update($data);
$address->ID = 0;
//ensure not in db
}
return $address;
}
示例4: postProcess
/**
* AdminController::postProcess() override
* @see AdminController::postProcess()
*/
public function postProcess()
{
require_once _PS_MODULE_DIR_ . 'erpillicopresta/models/ErpFeature.php';
$this->context->smarty->assign(array('erp_feature' => ErpFeature::getFeaturesWithToken($this->context->language->iso_code), 'template_path' => $this->template_path));
if (Tools::isSubmit('export_csv')) {
$this->renderCSV();
}
// checks access
if (Tools::isSubmit('submitAdd' . $this->table) && !($this->tabAccess['add'] === '1')) {
$this->errors[] = Tools::displayError($this->l('You do not have permission to add suppliers.'));
return parent::postProcess();
}
if (Tools::isSubmit('submitAdd' . $this->table)) {
if (Tools::isSubmit('id_supplier') && !($obj = $this->loadObject(true))) {
return;
}
// updates/creates address if it does not exist
if (Tools::isSubmit('id_address') && (int) Tools::getValue('id_address') > 0) {
$address = new Address((int) Tools::getValue('id_address'));
} else {
$address = new Address();
}
// creates address
$address->alias = Tools::getValue('name', null);
$address->lastname = 'supplier';
// skip problem with numeric characters in supplier name
$address->firstname = 'supplier';
// skip problem with numeric characters in supplier name
$address->address1 = Tools::getValue('address', null);
$address->address2 = Tools::getValue('address2', null);
$address->postcode = Tools::getValue('postcode', null);
$address->phone = Tools::getValue('phone', null);
$address->id_country = Tools::getValue('id_country', null);
$address->id_state = Tools::getValue('id_state', null);
$address->city = Tools::getValue('city', null);
$validation = $address->validateController();
// checks address validity
if (count($validation) > 0) {
foreach ($validation as $item) {
$this->errors[] = $item;
}
$this->errors[] = Tools::displayError($this->l('The address is not correct. Please make sure all of the required fields are completed.'));
} else {
if (Tools::isSubmit('id_address') && Tools::getValue('id_address') > 0) {
$address->update();
} else {
$address->save();
$_POST['id_address'] = $address->id;
}
}
//--ERP informations
// updates/creates erp_supplier if it does not exist
if (Tools::isSubmit('id_erpip_supplier') && (int) Tools::getValue('id_erpip_supplier') > 0) {
$erp_supplier = new ErpSupplier((int) Tools::getValue('id_erpip_supplier'));
} else {
$erp_supplier = new ErpSupplier();
}
// creates erp_supplier
$erp_supplier->email = Tools::getValue('email', null);
$erp_supplier->fax = Tools::getValue('fax', null);
$erp_supplier->franco_amount = Tools::getValue('franco_amount', null);
$erp_supplier->discount_amount = Tools::getValue('discount_amount', null);
$erp_supplier->shipping_amount = Tools::getValue('shipping_amount', null);
$erp_supplier->escompte = Tools::getValue('escompte', null);
$erp_supplier->delivery_time = Tools::getValue('delivery_time', null);
$erp_supplier->account_number_accounting = Tools::getValue('account_number_accounting', null);
$validation2 = $erp_supplier->validateController();
//print_r($validation2);
// checks erp_supplier validity
if (count($validation2) > 0) {
foreach ($validation2 as $item) {
$this->errors[] = $item;
}
$this->errors[] = Tools::displayError($this->l('The ErpIllicopresta Supplier is not correct. Please make sure all of the required fields are completed.'));
} else {
if (Tools::isSubmit('id_erpip_supplier') && Tools::getValue('id_erpip_supplier') > 0) {
$erp_supplier->update();
} else {
$erp_supplier->save();
$_POST['id_erpip_supplier'] = $erp_supplier->id;
}
}
return parent::postProcess();
} else {
if (Tools::isSubmit('delete' . $this->table)) {
if (!($obj = $this->loadObject(true))) {
return;
} else {
if (SupplyOrder::supplierHasPendingOrders($obj->id)) {
$this->errors[] = $this->l('It is not possible to delete a supplier if there are pending supplier orders.');
} else {
//delete all product_supplier linked to this supplier
Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'product_supplier` WHERE `id_supplier`=' . (int) $obj->id);
$id_address = Address::getAddressIdBySupplierId($obj->id);
$address = new Address($id_address);
if (Validate::isLoadedObject($address)) {
//.........这里部分代码省略.........
示例5: array
/**
* 更新国家信息
* @access public
*/
function update_save()
{
//判断country是否已存在
$id = get_post_value('id');
$country = get_post_value('country');
$region = get_post_value('region');
$orders = get_post_value('orders');
$status = get_post_value('status');
if (!$this->verify_region($id)) {
echo '<br>大区 ' . $_POST['region'] . ' 已存在,请核对后重新输入。<a href="javascript:history.go(-1)">返回</a><br>';
return;
}
$field = array('country_id' => $country, 'region' => $region, 'orders' => $orders, 'status' => $status == '10000' ? '10000' : '30000');
$m = new Address();
$m->clear();
$m->setTable('vcb_address_region');
$m->setField($field);
$m->setWhere('region_id', '=', $id);
$m->update();
//返回
echo '<br>操作成功,<a href="index" >返回</a><br>';
}
示例6: _postProcessShipping
private function _postProcessShipping()
{
Configuration::updateValue('GOINTERPAY_RECIPIENT_LASTNAME', pSQL(Tools::getValue('recipientLastName')));
Configuration::updateValue('GOINTERPAY_RECIPIENT_FIRSTNAME', pSQL(Tools::getValue('recipientFirstName')));
Configuration::updateValue('GOINTERPAY_RECIPIENT_ADDRESS', pSQL(Tools::getValue('recipientAddress')));
Configuration::updateValue('GOINTERPAY_RECIPIENT_ZIPCODE', pSQL(Tools::getValue('recipientZipCode')));
Configuration::updateValue('GOINTERPAY_RECIPIENT_CITY', pSQL(Tools::getValue('recipientCity')));
Configuration::updateValue('GOINTERPAY_RECIPIENT_COUNTRY', (int) Tools::getValue('recipientCountry'));
Configuration::updateValue('GOINTERPAY_RECIPIENT_STATE', !isset($_POST['recipientState']) ? 0 : (int) Tools::getValue('recipientState'));
if (Configuration::get('GOINTERPAY_SHIPPING_ADDRESS_ID')) {
$address = new Address((int) Configuration::get('GOINTERPAY_SHIPPING_ADDRESS_ID'));
$address->id_country = (int) $_POST['recipientCountry'];
if (isset($_POST['recipientState'])) {
$address->id_state = (int) $_POST['recipientState'];
} else {
$address->id_state = 0;
}
$address->alias = 'gointerpay';
$address->lastname = pSQL(Tools::getValue('recipientLastName'));
$address->firstname = isset($_POST['recipientFirstName']) && $_POST['recipientFirstName'] != '' ? pSQL(Tools::getValue('recipientFirstName')) : 'Go Interpay';
$address->address1 = pSQL(Tools::getValue('recipientAddress'));
$address->city = pSQL(Tools::getValue('recipientCity'));
$address->postcode = pSQL(Tools::getValue('recipientZipCode'));
$address->update();
} else {
$address = new Address();
$address->id_country = (int) $_POST['recipientCountry'];
if (Tools::getValue('recipientState')) {
$address->id_state = (int) $_POST['recipientState'];
} else {
$address->id_state = 0;
}
$address->alias = 'gointerpay';
$address->lastname = pSQL(Tools::getValue('recipientLastName'));
$address->firstname = isset($_POST['recipientFirstName']) && $_POST['recipientFirstName'] != '' ? pSQL(Tools::getValue('recipientFirstName')) : 'Go Interpay';
$address->address1 = pSQL(Tools::getValue('recipientAddress'));
$address->city = pSQL(Tools::getValue('recipientCity'));
$address->postcode = pSQL(Tools::getValue('recipientZipCode'));
if ($address->add()) {
Configuration::updateValue('GOINTERPAY_SHIPPING_ADDRESS_ID', (int) $address->id);
}
}
}
示例7:
// Vérification si nom adresse est déjà présent
$addressNameExist = $address->verifAddressExist($addressNewName);
if ($categorieCount === 0) {
echo "categorieDoesntExist";
} else {
if ($addressCount === 0) {
echo "addressDosentExist";
} else {
if ($addressNameExist !== 0) {
echo "addressAlreadyExist";
} else {
echo "succesChangeAddress";
if (!empty($addressNewName)) {
$elem = "name";
$nameElem = $addressNewName;
$address->update($elem, $nameElem, $addressName);
$addressList->update($elem, $nameElem, $addressName);
echo "Name";
}
if (!empty($newCategorieName)) {
$adressNameChangeCategorie = $addressName;
if (!empty($addressNewName)) {
$adressNameChangeCategorie = $addressNewName;
}
$elem = "categorie";
$nameElem = $newCategorieName;
$address->update($elem, $nameElem, $adressNameChangeCategorie);
echo "Categorie";
}
if (!empty($phone)) {
$adressNameChangePhone = $addressName;
示例8: array
/**
* 更新国家信息
* @access public
*/
function update_save()
{
$id = get_post_value('id');
$country = get_post_value('country');
if (!$this->verify($id)) {
echo '<br>大区 ' . $country . ' 已存在,请核对后重新输入。<a href="javascript:history.go(-1)">返回</a><br>';
return;
}
$status = get_post_value('status');
$field = array('country' => trim($country), 'orders' => get_post_value('orders'), 'status' => $status == '10000' ? '10000' : '30000');
//判断country是否已存在
$m = new Address();
$m->clear();
$m->setTable('vcb_address_country');
//设置表名
$m->setField($field);
///设置更新字段及值,(键值数组)
$m->setWhere('country_id', '=', $id);
//设置Where条件
$m->update();
//返回
echo '<br>操作成功,<a href="index" >返回</a><br>';
}
示例9: elseif
exit;
} elseif ($origin == 'shipment') {
header("Location: ../expedition/fiche.php?id=" . $originid);
exit;
} else {
header("Location: " . $_SERVER['PHP_SELF'] . "?socid=" . $socid);
exit;
}
}
} else {
$mesg = $object->error;
$action = 'create';
}
} else {
if ($action == 'update') {
$result = $object->update($id, $socid, $user);
if ($result >= 0) {
if (!empty($backtopage)) {
header("Location: " . $backtopage);
exit;
} else {
if ($origin == 'commande') {
header("Location: ../commande/contact.php?id=" . $originid);
exit;
} elseif ($origin == 'propal') {
header("Location: ../comm/propal/contact.php?id=" . $originid);
exit;
} elseif ($origin == 'shipment') {
header("Location: ../expedition/fiche.php?id=" . $originid);
exit;
} else {
示例10: update_detail
public function update_detail($order_id, $data)
{
$xml = simplexml_load_string($data);
$prefix = _DB_PREFIX_;
$sql = 'SELECT id_address_delivery from `' . $prefix . 'orders` where `id_order` = ' . $order_id . ' ';
$result = Db::getInstance()->ExecuteS($sql);
$address_id = $result[0]['id_address_delivery'];
$address = new Address($address_id);
$address->phone_mobile = (string) $xml->ProcessedOrder->ShippingAddress->PhoneNumber;
$address->update();
}
示例11: catch
Flight::ok($object);
} catch (Exception $exception) {
Flight::error($exception);
}
});
Flight::route('POST /v1/main/address', function () {
try {
$object = Address::insert();
Flight::ok($object);
} catch (Exception $exception) {
Flight::error($exception);
}
});
Flight::route('PUT /v1/main/address/@id', function ($id) {
try {
$object = Address::update($id);
Flight::ok($object);
} catch (Exception $exception) {
Flight::error($exception);
}
});
Flight::route('DELETE /v1/main/address/@id', function ($id) {
try {
$object = Address::delete($id);
Flight::ok($object);
} catch (Exception $exception) {
Flight::error($exception);
}
});
//=============================================================================
//Collection
示例12: saveAddress
private function saveAddress($cart_id_address, $id_country, $id_state, $postcode, $city, $firstname, $lastname, $address1)
{
$dummy = "dummyvalue";
if ($cart_id_address > 0) {
// update existing one
$tmp_addr = new Address($cart_id_address);
$tmp_addr->deleted = 0;
} else {
// create a new address
$tmp_addr = new Address();
$tmp_addr->alias = "My Address";
$tmp_addr->lastname = $dummy;
$tmp_addr->firstname = $dummy;
$tmp_addr->address1 = $dummy;
$tmp_addr->postcode = $postcode;
$tmp_addr->city = $dummy;
}
if (trim($postcode) != "") {
$tmp_addr->postcode = $postcode;
}
if (trim($city) != "") {
$tmp_addr->city = $city;
}
if (trim($firstname) != "") {
$tmp_addr->firstname = $firstname;
}
if (trim($lastname) != "") {
$tmp_addr->lastname = $lastname;
}
if (trim($address1) != "") {
$tmp_addr->address1 = $address1;
}
if (trim($id_country) == "") {
$id_country = (int) Configuration::get('PS_COUNTRY_DEFAULT');
}
if (trim($id_country) != "") {
$tmp_addr->id_country = $id_country;
if (trim($id_state) != "") {
$tmp_addr->id_state = $id_state;
} else {
$tmp_addr->id_state = 0;
}
if (Configuration::get('VATNUMBER_MANAGEMENT') and file_exists(dirname(__FILE__) . '/../../modules/vatnumber/vatnumber.php') && !VatNumber::isApplicable($id_country)) {
$tmp_addr->vat_number = "";
}
if ($cart_id_address > 0) {
$tmp_addr->update();
} else {
$tmp_addr->add();
}
return $tmp_addr->id;
} else {
return 0;
}
}
示例13:
exit;
}
}
else
{
$mesg = $address->error;
$_GET["action"]='create';
}
}
if ($_POST["action"] == 'update')
{
$socid = $_POST["socid"];
$origin = $_POST["origin"];
$originid = $_POST["originid"];
$result = $address->update($_POST["id"], $socid, $user);
if ($result >= 0)
{
if ($origin == commande)
{
Header("Location: ../commande/fiche.php?id=".$originid);
exit;
}
elseif ($origin == propal)
{
Header("Location: ../comm/propal.php?id=".$originid);
exit;
}
elseif ($origin == shipment)
{
示例14: saveAddress
private function saveAddress($cart_id_address, $id_country, $id_state, $postcode, $city, $firstname, $lastname, $address1)
{
$dummy = "dummyvalue";
if ($cart_id_address > 0) {
// update existing one
/* @var $tmp_addr AddressCore */
$tmp_addr = new Address($cart_id_address);
$tmp_addr->deleted = 0;
} else {
// create a new address
$tmp_addr = new Address();
$tmp_addr->alias = "My Address";
$tmp_addr->lastname = $dummy;
$tmp_addr->firstname = $dummy;
$tmp_addr->address1 = $dummy;
$tmp_addr->postcode = $postcode;
$tmp_addr->city = $dummy;
}
if (trim($postcode) != "") {
$tmp_addr->postcode = $postcode;
}
// For carrier module which depend on city field
if (trim($city) != "") {
$tmp_addr->city = $city;
}
if (trim($firstname) != "") {
$tmp_addr->firstname = $firstname;
}
if (trim($lastname) != "") {
$tmp_addr->lastname = $lastname;
}
if (trim($address1) != "") {
$tmp_addr->address1 = $address1;
}
// kvoli virtual produktom, ked online country bola skryta a teda id_country bolo prazdne
if (trim($id_country) == "") {
$id_country = (int) Configuration::get('PS_COUNTRY_DEFAULT');
}
if (trim($id_country) != "") {
$tmp_addr->id_country = $id_country;
if (trim($id_state) != "") {
$tmp_addr->id_state = $id_state;
} else {
$tmp_addr->id_state = 0;
}
// Reset VAT number when address is non-EU (otherwise, taxes won't be added when VAT address changes to non-VAT!)
if (Configuration::get('VATNUMBER_MANAGEMENT') and file_exists(dirname(__FILE__) . '/../../modules/vatnumber/vatnumber.php') && !VatNumber::isApplicable($id_country)) {
$tmp_addr->vat_number = "";
}
if ($cart_id_address > 0) {
$tmp_addr->update();
} else {
$tmp_addr->add();
// $opckt_helper->addAddressIdAndCartId($tmp_addr->id, $this->context->cookie->id_cart);
}
return $tmp_addr->id;
} else {
return 0;
}
}
示例15: updateAddress
protected function updateAddress()
{
// updates/creates address if it does not exist
if (Tools::isSubmit('id_address') && (int) Tools::getValue('id_address') > 0) {
$address = new Address((int) Tools::getValue('id_address'));
} else {
$address = new Address();
}
// creates address
// sets the address
$address->alias = Tools::getValue('reference', null);
$address->lastname = 'warehouse';
// skip problem with numeric characters in warehouse name
$address->firstname = 'warehouse';
// skip problem with numeric characters in warehouse name
$address->address1 = Tools::getValue('address', null);
$address->address2 = Tools::getValue('address2', null);
$address->postcode = Tools::getValue('postcode', null);
$address->phone = Tools::getValue('phone', null);
$address->id_country = Tools::getValue('id_country', null);
$address->id_state = Tools::getValue('id_state', null);
$address->city = Tools::getValue('city', null);
// validates the address
$validation = $address->validateController();
// checks address validity
if (count($validation) > 0) {
foreach ($validation as $item) {
$this->errors[] = $item;
}
$this->errors[] = Tools::displayError('The address is not correct. Please make sure all of the required fields are completed.');
} else {
if (Tools::isSubmit('id_address') && Tools::getValue('id_address') > 0) {
$address->update();
} else {
$address->save();
$_POST['id_address'] = $address->id;
}
}
}