Exemplo 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');
 }
Exemplo n.º 2
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');
 }
Exemplo n.º 3
0
 public function productReviews()
 {
     $user = $this->getIdentity();
     $model = new \Shop\Models\Orders();
     $state = $model->populateState()->getState();
     $is_reviewed = null;
     if (strlen($state->get('filter.is_reviewed'))) {
         if ($state->get('filter.is_reviewed')) {
             $is_reviewed = true;
         } else {
             $is_reviewed = false;
         }
     }
     try {
         $paginated = \Shop\Models\Customers::purchasedProducts($user, array('offset' => $state->get('list.offset'), 'keyword' => $state->get('filter.keyword'), 'is_reviewed' => $is_reviewed));
     } catch (\Exception $e) {
     }
     $this->app->set('meta.title', 'My Reviews');
     $this->app->set('paginated', $paginated);
     $this->app->set('state', $state);
     echo $this->theme->render('Shop/Site/Views::account/product_reviews.php');
 }