Пример #1
0
 public function getAddress()
 {
     $userAddressId = $this->order->getUserAddress();
     if (!empty($userAddressId) && $userAddressId != 0) {
         $addressModel = new AddressTableModel($this->order->getUserId());
         $addressModel->setTable('address');
         $address = $addressModel->readRecordsById()[0];
         return $address['address'] . ', Индекс: ' . $address['postal_code'];
     } else {
         $mode = $this->order->getRememberAddress();
         if ($mode && $mode == 1) {
             $addressModel = new AddressTableModel($this->order->getUserId(), [$this->order->getFullAddress()], [$this->order->getPostal()]);
             $flag = $addressModel->checkAddress($this->order->getFullAddress());
             if (!$flag) {
                 $addressModel->addRecord();
             }
         }
         if (!is_null($this->order->getFullAddress())) {
             return $this->order->getFullAddress() . ', Индекс: ' . $this->order->getPostal();
         } else {
             return NULL;
         }
     }
 }
Пример #2
0
 protected function setAddressesAndPhones()
 {
     $addressModel = new AddressTableModel($this->id);
     $addressModel->setData();
     $this->addresses = $addressModel;
     $phoneModel = new PhoneTableModel($this->id);
     $phoneModel->setData();
     $this->phones = $phoneModel;
 }
Пример #3
0
 public function deleteUserAddressAction()
 {
     header('Content-Type: application/json; charset=utf-8');
     header('Cache-Control: no-store, no-cache');
     header('Expires: ' . date('r'));
     $id = Validate::validateInputVar('id', 'INPUT_GET', 'int');
     $model = new AddressTableModel();
     $model->setId($id);
     $model->setTable('address');
     echo $model->deleteRecord();
 }