Beispiel #1
0
 /**
  *	Save the changes made to an existing shipping address
  */
 private function SaveEditedShippingAddress()
 {
     if (isset($_POST['shipid'])) {
         $entity = new ISC_ENTITY_SHIPPING();
         $shippingData = $entity->get($_POST['shipid']);
         $fields = $GLOBALS['ISC_CLASS_FORM']->getFormFields(FORMFIELDS_FORM_ADDRESS, true);
         /**
          * Validate the field input
          */
         $errmsg = '';
         if (!$this->validateFieldData($fields, $errmsg)) {
             $_GET['address_id'] = $_POST['shipid'];
             return $this->EditShippingAddress($errmsg, MSG_ERROR);
         }
         $ShippingAddress = $this->parseFieldData($fields, $shippingData['shipformsessionid']);
         // Update the existing shipping address
         $ShippingAddress['shipid'] = (int) $_POST['shipid'];
         if ($entity->edit($ShippingAddress)) {
             if (isset($_SESSION['LOGIN_REDIR'])) {
                 // Take them to the page they wanted
                 $page = $_SESSION['LOGIN_REDIR'];
                 unset($_SESSION['LOGIN_REDIR']);
                 header(sprintf("Location: %s", $page));
             } else {
                 // Take them to the my account page
                 header(sprintf("Location: %s/account.php", $GLOBALS['ShopPath']));
             }
         } else {
             // Database error
             ob_end_clean();
             header(sprintf("location:%s/account.php", $GLOBALS['ShopPath']));
             die;
         }
     } else {
         // Bad details
         ob_end_clean();
         header(sprintf("location:%s/account.php", $GLOBALS['ShopPath']));
         die;
     }
 }