Ejemplo n.º 1
0
 /**
  * List a user's orders
  *
  */
 public function index()
 {
     $identity = $this->getIdentity();
     if (empty($identity->id)) {
         \Dsc\System::instance()->get('session')->set('site.login.redirect', '/shop/orders');
         \Base::instance()->reroute('/sign-in');
         return;
     }
     $model = new \Shop\Models\Orders();
     $model->emptyState()->populateState()->setState('list.limit', 10)->setState('filter.user', (string) $identity->id)->setState('filter.status_excludes', \Shop\Constants\OrderStatus::cancelled);
     $state = $model->getState();
     try {
         $paginated = $model->paginate();
     } catch (\Exception $e) {
         // TODO Change to a normal 404 error
         \Dsc\System::instance()->addMessage($e->getMessage(), 'error');
         $f3->reroute('/');
         return;
     }
     \Base::instance()->set('state', $state);
     \Base::instance()->set('paginated', $paginated);
     $this->app->set('meta.title', 'My Orders');
     $view = \Dsc\System::instance()->get('theme');
     echo $view->render('Shop/Site/Views::orders/index.php');
 }
Ejemplo n.º 2
0
 public function index()
 {
     $identity = $this->getIdentity();
     $model = new \Shop\Models\Orders();
     $model->emptyState()->populateState()->setParam('sort', $model->defaultSort())->setState('filter.user', (string) $identity->id)->setState('filter.status_excludes', \Shop\Constants\OrderStatus::cancelled);
     $state = $model->getState();
     try {
         $order = $model->getItem();
         $this->app->set('order', $order);
     } catch (\Exception $e) {
     }
     $this->app->set('meta.title', 'My Account');
     echo $this->theme->render('Shop/Site/Views::account/index.php');
 }
Ejemplo n.º 3
0
 /**
  * List a user's wishlists 
  * 
  */
 public function index()
 {
     $this->requireIdentity();
     $model = new \Shop\Models\Orders();
     $model->emptyState()->populateState()->setState('list.limit', 10)->setState('filter.user', (string) $identity->id);
     $state = $model->getState();
     try {
         $paginated = $model->paginate();
     } catch (\Exception $e) {
         // TODO Change to a normal 404 error
         \Dsc\System::instance()->addMessage($e->getMessage(), 'error');
         $f3->reroute('/');
         return;
     }
     \Base::instance()->set('state', $state);
     \Base::instance()->set('paginated', $paginated);
     $this->app->set('meta.title', 'My Wishlists');
     $view = \Dsc\System::instance()->get('theme');
     echo $view->render('Shop/Site/Views::wishlist/index.php');
 }