Example #1
0
 protected function _postDelete()
 {
     $modelUserFinance = new App_Model_Db_Table_UserFinance();
     $modelUserFinance->delete("userId='" . $this->kopel . "'");
     $modelUserInvoice = new App_Model_Db_Table_Invoice();
     $modelUserInvoice->delete("uid='" . $this->kopel . "'");
     $acl = Pandamp_Acl::manager();
     $acl->deleteUser($this->username);
     $modelOrder = new App_Model_Db_Table_Order();
     $fetchOrder = $modelOrder->fetchAll("userId='" . $this->kopel . "'");
     foreach ($fetchOrder as $rowOrder) {
         $rowOrder->delete();
     }
     $registry = Zend_Registry::getInstance();
     $config = $registry->get(Pandamp_Keys::REGISTRY_APP_OBJECT);
     $cdn = $config->getOption('cdn');
     $sDir = $cdn['static']['dir']['photo'];
     //$sDir = ROOT_DIR.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'photo';
     try {
         if (file_exists($sDir . "/" . $this->kopel . ".gif")) {
             unlink($sDir . "/" . $this->kopel . ".gif");
         }
         if (file_exists($sDir . "/" . $this->kopel . ".jpg")) {
             unlink($sDir . "/" . $this->kopel . ".jpg");
         }
         if (file_exists($sDir . "/" . $this->kopel . ".jpeg")) {
             unlink($sDir . "/" . $this->kopel . ".jpeg");
         }
         if (file_exists($sDir . "/" . $this->kopel . ".png")) {
             unlink($sDir . "/" . $this->kopel . ".png");
         }
     } catch (Exception $e) {
     }
 }
Example #2
0
 function completeorderAction()
 {
     $modelPaymentSetting = new App_Model_Db_Table_PaymentSetting();
     $rowTaxRate = $modelPaymentSetting->fetchRow("settingKey='taxRate'");
     $cart =& $_SESSION['jCart'];
     if (!is_object($cart)) {
         $cart = new jCart();
     }
     if (empty($cart) || count($cart->items) == 0) {
         $this->_redirect(ROOT_URL . '/checkout/cartempty');
     }
     $bpm = new Pandamp_Core_Hol_Catalog();
     $result = array('subTotal' => 0, 'disc' => 0, 'taxAmount' => 0, 'grandTotal' => 0, 'items' => array());
     for ($iCart = 0; $iCart < count($cart->items); $iCart++) {
         $itemId = $cart->items[$iCart];
         $qty = $cart->itemqtys[$itemId];
         $coupon = isset($cart->coupon) ? $cart->coupon : '';
         $itemPrice = $bpm->getPrice($itemId);
         $disc = $bpm->getDiscount($coupon);
         $result['items'][$iCart]['itemId'] = $itemId;
         $result['items'][$iCart]['item_name'] = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($itemId, 'fixedTitle');
         $result['items'][$iCart]['itemPrice'] = $itemPrice;
         $result['items'][$iCart]['itemTotal'] = $qty * $itemPrice;
         $result['items'][$iCart]['qty'] = $qty;
         $result['coupon'] = $coupon;
         $result['disc'] = $disc;
         $result['subTotal'] += $itemPrice * $qty;
     }
     $result['taxAmount'] = $result['subTotal'] * $rowTaxRate->settingValue / 100;
     $grandTotal = $result['subTotal'] - $result['disc'] / 100 * $result['subTotal'];
     $result['grandTotal'] = $grandTotal + $result['taxAmount'];
     $payment = $this->_request->getParam('payment');
     $orderId = $this->saveOrder($result, $payment);
     //        $cart = null;
     $data = $this->_request->getParams();
     $this->view->cart = $result;
     $this->view->data = $data;
     $this->view->orderId = $orderId;
     $modDir = $this->getFrontController()->getModuleDirectory();
     require_once $modDir . '/models/Store/Mailer.php';
     $mod = new HolSite_Model_Store_Mailer();
     switch (strtolower($payment['method'])) {
         case 'bank':
             $mod->sendBankInvoiceToUser($orderId);
             break;
         case 'nsiapay':
             //                $mod->sendInvoiceToUser($orderId);
             break;
         case 'postpaid':
             $tblUserFinance = new App_Model_Db_Table_UserFinance();
             $userFinanceInfo = $tblUserFinance->find($this->_user->kopel)->current();
             if (!$userFinanceInfo->isPostPaid) {
                 return $this->_helper->redirector('notpostpaid', 'store_payment', 'hol-site');
             }
             $mod->sendInvoiceToUser($orderId);
             break;
     }
 }
Example #3
0
 private function _checkAuth()
 {
     //$sso = new Pandamp_Session_Remote();
     //$sso->getInfo();
     $auth = Zend_Auth::getInstance();
     if (!$auth->hasIdentity()) {
         //$this->_helper->redirector('login','account','identity',array('sReturn'=>$sReturn));
         $sReturn = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
         $sReturn = base64_encode($sReturn);
         $identity = Pandamp_Application::getResource('identity');
         $loginUrl = $identity->loginUrl;
         $this->_redirect($loginUrl . '?returnTo=' . $sReturn);
     } else {
         $this->_user = $auth->getIdentity();
     }
     $modelUserFinance = new App_Model_Db_Table_UserFinance();
     $this->_userFinanceInfo = $modelUserFinance->find($this->_user->kopel)->current();
     if (empty($this->_userFinanceInfo)) {
         $finance = $modelUserFinance->fetchNew();
         $finance['userId'] = $this->_user->kopel;
         $finance->save();
         $this->_userFinanceInfo = $modelUserFinance->find($this->_user->kopel)->current();
     }
 }