예제 #1
0
파일: UserView.php 프로젝트: yiuked/tmcart
 public function displayMain()
 {
     global $smarty, $link, $cookie;
     if (!$cookie->logged) {
         Tools::redirect($link->getPage('LoginView'));
     }
     $user = new User((int) $cookie->id_user);
     if (Tools::isSubmit('joinCommit')) {
         if (User::checkPassword($user->id, Tools::encrypt($_POST['old_passwd']))) {
             if (Tools::getRequest('confirmation') == Tools::getRequest('passwd')) {
                 if (!empty($_POST['passwd']) && Validate::isPasswd($_POST['passwd'])) {
                     $user->copyFromPost();
                     if ($user->update()) {
                         $cookie->passwd = $user->passwd;
                         $cookie->write();
                         $smarty->assign('success', 'Your personal information has been successfully updated.');
                     }
                 } else {
                     $user->_errors[] = 'Password is invalid.';
                 }
             } else {
                 $user->_errors[] = 'Password and confirmation do not match.';
             }
         } else {
             $user->_errors[] = 'Your password is incorrect.';
         }
     }
     $smarty->assign(array('errors' => $user->_errors, 'DISPLAY_LEFT' => Module::hookBlock(array('myaccount')), 'user' => $user));
     return $smarty->fetch('my-user.tpl');
 }
예제 #2
0
 public function displayMain()
 {
     global $smarty, $link, $cookie;
     if (!$cookie->logged) {
         Tools::redirect($link->getPage('LoginView'));
     }
     $smarty->assign(array('DISPLAY_LEFT' => Module::hookBlock(array('myaccount'))));
     return $smarty->fetch('my-account.tpl');
 }
예제 #3
0
 public function displayMain()
 {
     global $smarty, $link, $cookie;
     if (!$cookie->logged) {
         Tools::redirect($link->getPage('LoginView'));
     }
     $user = new User((int) $cookie->id_user);
     $smarty->assign(array('DISPLAY_LEFT' => Module::hookBlock(array('myaccount')), 'addresses' => $user->getAddresses()));
     return $smarty->fetch('my-addresses.tpl');
 }
예제 #4
0
 public function displayMain()
 {
     global $smarty, $link, $cookie;
     if (!$cookie->logged) {
         Tools::redirect($link->getPage('LoginView'));
     }
     $user = new User((int) $cookie->id_user);
     if ($reference = Tools::getRequest('reference')) {
         $order = Order::getByReference($reference);
         $smarty->assign(array('products' => $order->cart->getProducts(), 'h_order' => $order));
     }
     $smarty->assign(array('orders' => $user->getOrders(), 'DISPLAY_LEFT' => Module::hookBlock(array('myaccount'))));
     return $smarty->fetch('my-orders.tpl');
 }
예제 #5
0
 public function displayMain()
 {
     global $smarty, $link, $cookie;
     if (!$cookie->logged) {
         Tools::redirect($link->getPage('LoginView'));
     }
     $user = new User((int) $cookie->id_user);
     $errors = array();
     $success = false;
     //添加feedback
     //1.添加创建对象
     if (Tools::isSubmit('submit')) {
         $feedback = new Feedback();
         $feedback->copyFromPost();
         if ($feedback->rating <= 0 && $feedback->rating > 5) {
             $feedback->rating = 4;
         }
         $data = explode("-", base64_decode(Tools::getRequest("data")));
         $feedback->id_product = (int) $data[0];
         $feedback->unit_price = (double) $data[2];
         $feedback->quantity = (int) $data[3];
         $feedback->md5_key = md5(Tools::getRequest("data"));
         $feedback->name = substr($user->first_name, 0, 1) . "***" . substr($user->last_name, -1, 1);
         $feedback->id_user = $user->id;
         if ($feedback->add()) {
             $success = true;
         } else {
             $errors = $feedback->_errors;
         }
     }
     //2.获取用户评论过的MD5KEY
     $proids = Feedback::haveFeedbackWithUser($user->id);
     //3.获取用户购买过的产品
     $products = array();
     if ($result = $user->getPaymentedProduct()) {
         foreach ($result as &$row) {
             if (!in_array($row['md5_key'], $proids)) {
                 $products[] = $row;
             }
         }
     }
     $smarty->assign(array('success' => $success, 'errors' => $errors, 'products' => $products, 'DISPLAY_LEFT' => Module::hookBlock(array('myaccount'))));
     return $smarty->fetch('my-feedback.tpl');
 }
예제 #6
0
 public function displayFooter()
 {
     global $smarty;
     $smarty->assign(array('FOOT_BLOCK' => Module::hookBlock(array('viewed'))));
     return parent::displayFooter();
 }
예제 #7
0
파일: CMSView.php 프로젝트: yiuked/tmcart
 public function displayLeft()
 {
     global $smarty;
     $smarty->assign(array('LEFT_BLOCK' => Module::hookBlock(array('cmsblock'))));
     return $smarty->fetch('block/left_columns.tpl');
 }