本文整理汇总了PHP中Address::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Address::delete方法的具体用法?PHP Address::delete怎么用?PHP Address::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Address
的用法示例。
在下文中一共展示了Address::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __destruct
/**
* clear DB
*/
public function __destruct()
{
/**
* delete customer
*/
if ($this->getPlugin()->getContext() && $this->_isDummyCustomer) {
$this->getPlugin()->getContext()->customer->delete();
// "delete" function calls deleteByIdCustomer.
// In version 1.4.x.x this logic only deletes discounts defined to an user, but not the user itself.
// It's needed to delete the user entry manually
if (version_compare(_PS_VERSION_, '1.5.0', '<')) {
Db::getInstance()->Execute('DELETE FROM `' . _DB_PREFIX_ . 'customer`
WHERE `id_customer` = ' . (int) $this->getPlugin()->getContext()->customer->id);
}
}
/**
* delete delivery address
*/
if ($this->_deliveryAddress && $this->_deliveryAddress->id) {
$this->_deliveryAddress->delete();
}
/**
* delete invoice address
*/
if ($this->_invoiceAddress && $this->_invoiceAddress->id) {
$this->_invoiceAddress->delete();
}
/**
* delete cart
*/
if ($this->getPlugin()->getContext()->cart->id) {
$this->getPlugin()->getContext()->cart->delete();
}
}
示例2: testDelete
/**
* @todo Implement testDelete().
*/
public function testDelete()
{
$this->testSave();
$id = $this->object->getId();
$this->object->delete();
$obj = new Address($id);
$this->assertEquals($obj, new Address());
}
示例3: delete
public function delete()
{
$addresses = $this->getAddresses((int) Configuration::get('PS_LANG_DEFAULT'));
foreach ($addresses as $address) {
$obj = new Address((int) $address['id_address']);
$obj->delete();
}
Db::getInstance()->Execute('DELETE FROM `' . _DB_PREFIX_ . 'customer_group` WHERE `id_customer` = ' . (int) $this->id);
Discount::deleteByIdCustomer((int) $this->id);
return parent::delete();
}
示例4: delete
public function delete()
{
$address = new Address($this->id_address);
if (!$address->delete()) {
return false;
}
if (parent::delete()) {
CartRule::cleanProductRuleIntegrity('manufacturers', $this->id);
return $this->deleteImage();
}
}
示例5: deleteAction
/**
* Method used for control delete operation.
*/
public function deleteAction($id)
{
$model = new Address();
if ($model->delete($id) === false) {
$this->_result['error'] = true;
$this->_result['errorMessage'] = 'Record not deleted.';
header('HTTP/1.1 204 No Content');
} else {
$this->_result['data'] = 'DELETED.';
}
$this->renderResult();
}
示例6: save
public function save(Address $address, $token)
{
if (!$this->authorizeChange($address, $token)) {
return false;
}
$address->id_customer = $this->customer->id;
if ($address->isUsed()) {
$old_address = new Address($address->id);
$address->id = $address->id_address = null;
return $address->save() && $old_address->delete();
}
return $address->save();
}
示例7: update
public function update($nullValues = false)
{
$this->birthday = empty($this->years) ? $this->birthday : (int) $this->years . '-' . (int) $this->months . '-' . (int) $this->days;
if ($this->newsletter && !Validate::isDate($this->newsletter_date_add)) {
$this->newsletter_date_add = date('Y-m-d H:i:s');
}
if (isset(Context::getContext()->controller) && Context::getContext()->controller->controller_type == 'admin') {
$this->updateGroup($this->groupBox);
}
if ($this->deleted) {
$addresses = $this->getAddresses((int) Configuration::get('PS_LANG_DEFAULT'));
foreach ($addresses as $address) {
$obj = new Address((int) $address['id_address']);
$obj->delete();
}
}
return parent::update(true);
}
示例8: delete
public function delete()
{
$address = new Address($this->id_address);
if (!$address->delete()) {
return false;
}
return parent::delete();
}
示例9: truncateTables
private function truncateTables($case)
{
switch ((int) $case) {
case $this->entities[$this->l('Categories')]:
$categories = Db::getInstance()->ExecuteS('SELECT `id_category` FROM `' . _DB_PREFIX_ . 'category` WHERE id_category != 1');
foreach ($categories as $category) {
$c = new Category((int) $category['id_category']);
$c->delete();
}
break;
case $this->entities[$this->l('Products')]:
$products = Db::getInstance()->ExecuteS('SELECT `id_product` FROM `' . _DB_PREFIX_ . 'product`');
foreach ($products as $product) {
$p = new Product((int) $product['id_product']);
$p->delete(true);
}
break;
case $this->entities[$this->l('Customers')]:
$customers = Db::getInstance()->ExecuteS('SELECT `id_customer` FROM `' . _DB_PREFIX_ . 'customer`');
foreach ($customers as $customer) {
$c = new Customer((int) $customer['id_customer']);
$c->delete();
}
break;
case $this->entities[$this->l('Addresses')]:
$addresses = Db::getInstance()->ExecuteS('SELECT `id_address` FROM `' . _DB_PREFIX_ . 'address`');
foreach ($addresses as $address) {
$a = new Address((int) $address['id_address']);
$a->delete();
}
break;
case $this->entities[$this->l('Combinations')]:
$products = Db::getInstance()->ExecuteS('SELECT `id_product` FROM `' . _DB_PREFIX_ . 'product`');
foreach ($products as $product) {
$p = new Product((int) $product['id_product']);
$p->deleteProductAttributes();
}
break;
case $this->entities[$this->l('Manufacturers')]:
$manufacturers = Db::getInstance()->ExecuteS('SELECT `id_manufacturer` FROM `' . _DB_PREFIX_ . 'manufacturer`');
foreach ($manufacturers as $manufacturer) {
$m = new Manufacturer((int) $manufacturer['id_manufacturer']);
$m->delete();
}
break;
case $this->entities[$this->l('Suppliers')]:
$suppliers = Db::getInstance()->ExecuteS('SELECT `id_supplier` FROM `' . _DB_PREFIX_ . 'supplier`');
foreach ($suppliers as $supplier) {
$m = new Supplier((int) $supplier['id_supplier']);
$m->delete();
}
break;
}
Image::clearTmpDir();
return true;
}
示例10: getCarriersByCountry
public static function getCarriersByCountry($id_country, $id_state, $zipcode, $exiting_cart, $id_customer)
{
// Create temporary Address
$addr_temp = new Address();
$addr_temp->id_customer = $id_customer;
$addr_temp->id_country = $id_country;
$addr_temp->id_state = $id_state;
$addr_temp->postcode = $zipcode;
// Populate required attributes
// Note: Some carrier needs the whole address
// the '.' will do the job
$addr_temp->firstname = ".";
$addr_temp->lastname = ".";
$addr_temp->address1 = ".";
$addr_temp->city = ".";
$addr_temp->alias = "TEMPORARY_ADDRESS_TO_DELETE";
$addr_temp->save();
$cart = new Cart();
$cart->id_currency = $exiting_cart->id_currency;
$cart->id_customer = $exiting_cart->id_customer;
$cart->id_lang = $exiting_cart->id_lang;
$cart->id_address_delivery = $addr_temp->id;
$cart->add();
$products = $exiting_cart->getProducts();
foreach ($products as $key => $product) {
$cart->updateQty($product['quantity'], $product['id_product'], $product['id_product_attribute']);
}
$carriers = $cart->simulateCarriersOutput(null, true);
//delete temporary objects
$addr_temp->delete();
$cart->delete();
return $carriers;
}
示例11: delete
public function delete()
{
$addresses = $this->getAddresses(intval(Configuration::get('PS_LANG_DEFAULT')));
foreach ($addresses as $address) {
$obj = new Address(intval($address['id_address']));
$obj->delete();
}
return parent::delete();
}
示例12: actionAddCust
/**
* 添加顾客
*/
public function actionAddCust()
{
$user_model = new User();
$addr_model = new Address();
$cust_model = new Customer();
$custhi_model = new Cust_Health_Info();
if (isset($_POST["User"]) && isset($_POST["Customer"])) {
$user_model->attributes = $_POST["User"];
//设定用户种别为:顾客
$user_model->usr_kind = 2;
//设定用户密码为:xyz123456
$user_model->usr_password = md5("xyz123456");
$user_model->user_chg_pwd_old = "oldpassword";
$user_model->user_chg_pwd_new = "newpassword";
$user_model->user_chg_pwd_new_cfm = "newpassword";
//设置用户头像的默认值
if ($user_model->usr_pic_id == '') {
$user_model->usr_pic_id = '100000';
}
if ($user_model->save()) {
$cust_model->attributes = $_POST["Customer"];
//customer表里面的主键是user表的外键,user表的外键又是自增的,所以要先保存完user表才能保存customer表
$cust_model->pk_cust_id = $user_model->pk_usr_id;
//将作为用户名的手机号填入顾客信息里
$cust_model->cust_mobile1 = $_POST['User']['usr_username'];
//将用户喜爱的项目按位计算并保存
$cust_prefer = 0;
//如果啥都没选的话,下记字符串应该为空,否则为数组(内容为数字)
if ($_POST['Customer']['cust_prefer'] != '') {
for ($i = 0; $i < count($_POST['Customer']['cust_prefer']); $i++) {
if ($_POST['Customer']['cust_prefer'][$i]) {
$cust_prefer |= (int) $_POST['Customer']['cust_prefer'][$i];
}
}
} else {
$cust_prefer = 0;
}
$cust_model->cust_prefer = $cust_prefer;
//将用户喜爱的美疗师按位计算并保存
$cust_beautician = 0;
//如果啥都没选的话,下记字符串应该为空,否则为字符串数组(内容为数字)
if ($_POST['Customer']['cust_beautician'] != '') {
for ($i = 0; $i < count($_POST['Customer']['cust_beautician']); $i++) {
if ($_POST['Customer']['cust_beautician'][$i]) {
$cust_beautician |= (int) $_POST['Customer']['cust_beautician'][$i];
}
}
} else {
$cust_beautician = 0;
}
$cust_model->cust_beautician = $cust_beautician;
if ($cust_model->save()) {
$addr_model->attributes = $_POST['Address'];
$addr_model->addr_cust_id = $user_model->pk_usr_id;
if (!$addr_model->save()) {
$cust_model->delete();
$user_model->delete();
echo "<script>alert('地址信息添加失败!');</script>";
}
$custhi_model->attributes = $_POST['Cust_Health_Info'];
$custhi_model->pk_custhi_cust_id = $user_model->pk_usr_id;
$custhi_model->custhi_height = (double) $_POST['Cust_Health_Info']['custhi_height'];
$custhi_model->custhi_weight = (double) $_POST['Cust_Health_Info']['custhi_weight'];
$custhi_model->custhi_date = date("Y-m-d H:i:s", time());
if (!$custhi_model->save()) {
$addr_model->delete();
$cust_model->delete();
$user_model->delete();
echo "<script>alert('用户健康信息添加失败!');</script>";
}
$this->redirect("./index.php?r=user/showCust");
} else {
$user_model->delete();
var_dump($cust_model->getErrors());
echo "<script>alert('顾客信息添加失败!');</script>";
}
} else {
// var_dump($user_model->getErrors());
echo "<script>alert('用户信息添加失败!');</script>";
}
}
$this->renderPartial('addCust', array('user_info' => $user_model, 'cust_info' => $cust_model, 'addr_info' => $addr_model, 'custhi_info' => $custhi_model));
}
示例13: getCarriersListByIdZone
public function getCarriersListByIdZone($id_country, $id_state = 0, $zipcode = 0)
{
global $cart, $smarty, $cookie;
// cookie saving/updating
$cookie->id_country = $id_country;
if ($id_state != 0) {
$cookie->id_state = $id_state;
}
if ($zipcode !== 0) {
$cookie->postcode = $zipcode;
}
$id_zone = 0;
if ($id_state != 0) {
$id_zone = State::getIdZone($id_state);
}
if (!$id_zone) {
$id_zone = Country::getIdZone($id_country);
}
// Need to set the infos for carrier module !
$cookie->id_country = $id_country;
$cookie->id_state = $id_state;
$cookie->postcode = $zipcode;
$carriers = array();
if ($this->addAddress($id_country, $zipcode)) {
// Back up the current id_address_delivery
$current_id_address_delivery = $cart->id_address_delivery;
// Get the new one created
$cart->id_address_delivery = Configuration::get(CarrierCompare::VIRTUAL_ADDRESS);
$cart->id_customer = Configuration::get(CarrierCompare::VIRTUAL_CUSTOMER);
// Get carriers with good id_zone
$carriers = Carrier::getCarriersForOrder((int) $id_zone);
// Delete Address and restore id_address_delivery
$address = new Address((int) Configuration::get(CarrierCompare::VIRTUAL_ADDRESS));
$address->delete();
$cart->id_address_delivery = $current_id_address_delivery;
}
return count($carriers) ? $carriers : array();
}
示例14: Address
}
}
else
{
$reload = 0;
$mesg = $address->error;
$_GET["action"]= "edit";
}
}
}
if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes' && $user->rights->societe->supprimer)
{
$address = new Address($db);
$result = $address->delete($_GET["id"], $socid);
if ($result == 0)
{
Header("Location: ".$_SERVER['PHP_SELF']."?socid=".$socid);
exit ;
}
else
{
$reload = 0;
$_GET["action"]='';
}
}
/**
*
示例15:
$nameElem = $newCategorieName;
$address->update($elem, $nameElem, $adressNameChangeCategorie);
echo "Categorie";
}
if (!empty($phone)) {
$adressNameChangePhone = $addressName;
if (!empty($addressNewName)) {
$adressNameChangePhone = $addressNewName;
}
$elem = "phone";
$nameElem = $phone;
$address->update($elem, $nameElem, $adressNameChangePhone);
}
}
}
}
}
}
}
} else {
if (isset($_POST["delete"]) and $_POST["delete"] === "true" and isset($_POST["name"]) and isset($_POST["categorie"])) {
$name = strip_tags($_POST["name"]);
$categorie = strip_tags($_POST["categorie"]);
$address->delete($name, $categorie);
$addressList->delete($name);
echo "successDelete";
}
}
}
break;
}