本文整理汇总了PHP中AddressFormat::update方法的典型用法代码示例。如果您正苦于以下问题:PHP AddressFormat::update方法的具体用法?PHP AddressFormat::update怎么用?PHP AddressFormat::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AddressFormat
的用法示例。
在下文中一共展示了AddressFormat::update方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postProcess
public function postProcess()
{
if (isset($_GET['delete' . $this->table]) or Tools::getValue('submitDel' . $this->table)) {
$this->_errors[] = Tools::displayError('You cannot delete a country. If you do not want it available for customers, please disable it.');
} else {
if (Tools::getValue('submitAdd' . $this->table)) {
$id_country = Tools::getValue('id_country');
$tmp_addr_format = new AddressFormat($id_country);
$save_status = false;
$is_new = is_null($tmp_addr_format->id_country);
if ($is_new) {
$tmp_addr_format = new AddressFormat();
$tmp_addr_format->id_country = $id_country;
}
$tmp_addr_format->format = Tools::getValue('address_layout');
if (strlen($tmp_addr_format->format) > 0) {
if ($tmp_addr_format->checkFormatFields()) {
$save_status = $is_new ? $tmp_addr_format->save() : $tmp_addr_format->update();
} else {
$errorList = $tmp_addr_format->getErrorList();
foreach ($errorList as $numError => $error) {
$this->_errors[] = $error;
}
}
if (!$save_status) {
$this->_errors[] = Tools::displayError('Invalid address layout' . Db::getInstance()->getMsgError());
}
}
unset($tmp_addr_format);
}
return parent::postProcess();
}
}
示例2: postProcess
public function postProcess()
{
if (!Tools::getValue('id_' . $this->table)) {
if (Validate::isLanguageIsoCode(Tools::getValue('iso_code')) && Country::getByIso(Tools::getValue('iso_code'))) {
$this->errors[] = Tools::displayError('This ISO code already exists, you cannot create two country with the same ISO code');
}
} else {
if (Validate::isLanguageIsoCode(Tools::getValue('iso_code'))) {
$id_country = Country::getByIso(Tools::getValue('iso_code'));
if (!is_null($id_country) && $id_country != Tools::getValue('id_' . $this->table)) {
$this->errors[] = Tools::displayError('This ISO code already exists, you cannot create two country with the same ISO code');
}
}
}
if (!count($this->errors)) {
$res = parent::postProcess();
} else {
return false;
}
if (Tools::getValue('submitAdd' . $this->table) && $res) {
$id_country = ($id_country = Tools::getValue('id_country')) ? $id_country : $res['id'];
$tmp_addr_format = new AddressFormat($id_country);
$save_status = false;
$is_new = is_null($tmp_addr_format->id_country);
if ($is_new) {
$tmp_addr_format = new AddressFormat();
$tmp_addr_format->id_country = $id_country;
}
$tmp_addr_format->format = Tools::getValue('address_layout');
if (strlen($tmp_addr_format->format) > 0) {
if ($tmp_addr_format->checkFormatFields()) {
$save_status = $is_new ? $tmp_addr_format->save() : $tmp_addr_format->update();
} else {
$error_list = $tmp_addr_format->getErrorList();
foreach ($error_list as $num_error => $error) {
$this->errors[] = $error;
}
}
if (!$save_status) {
$this->errors[] = Tools::displayError('Invalid address layout' . Db::getInstance()->getMsgError());
}
}
unset($tmp_addr_format);
}
return $res;
}
示例3: setOnlineCountryAddressFormat
private function setOnlineCountryAddressFormat($online_country_id)
{
$tmp_addr_format = new AddressFormat($online_country_id);
$save_status = false;
$is_new = is_null($tmp_addr_format->id_country);
if ($is_new) {
$tmp_addr_format = new AddressFormat();
$tmp_addr_format->id_country = $online_country_id;
}
$tmp_addr_format->format = "Country:name\nCustomer:email\nphone";
$save_status = $is_new ? $tmp_addr_format->save() : $tmp_addr_format->update();
// we don't rely on result, so we won't return it at all
}