Example #1
0
 private function getAssets()
 {
     $js = \Concrete\Package\VividStore\Controller::returnHeaderJS();
     $this->addFooterItem($js);
     $this->requireAsset('css', 'vividStoreDashboard');
     $this->requireAsset('javascript', 'vividStoreFunctions');
 }
Example #2
0
 public function view()
 {
     $codeerror = false;
     $codesuccess = false;
     if ($this->isPost()) {
         if ($this->post('action') == 'update') {
             $data = $this->post();
             $result = StoreCart::update($data);
             $added = $result['added'];
             $returndata = array('success' => true, 'quantity' => (int) $data['pQty'], 'action' => 'update', 'added' => $added);
         }
         if ($this->post('action') == 'clear') {
             StoreCart::clear();
             $returndata = array('success' => true, 'action' => 'clear');
         }
         if ($this->post('action') == 'remove') {
             $data = $this->post();
             $result = StoreCart::remove($data['instance']);
             $returndata = array('success' => true, 'action' => 'remove');
         }
     }
     $this->set('actiondata', $returndata);
     $this->set('cart', StoreCart::getCart());
     $this->set('total', StoreCalculator::getSubTotal());
     $this->requireAsset('javascript', 'jquery');
     $js = \Concrete\Package\VividStore\Controller::returnHeaderJS();
     $this->addFooterItem($js);
     $this->requireAsset('javascript', 'vivid-store');
     $this->requireAsset('css', 'vivid-store');
 }
Example #3
0
 public function getFooterAssets()
 {
     $this->requireAsset('javascript', 'jquery');
     $js = \Concrete\Package\VividStore\Controller::returnHeaderJS();
     $this->addFooterItem($js);
     $this->requireAsset('javascript', 'vivid-store');
     $this->requireAsset('css', 'vivid-store');
 }
Example #4
0
 public function view()
 {
     $this->set("itemCount", StoreCart::getTotalItemsInCart());
     $this->set("total", StorePrice::format(StoreCalculator::getSubTotal()));
     $js = \Concrete\Package\VividStore\Controller::returnHeaderJS();
     $this->requireAsset('javascript', 'jquery');
     $this->addFooterItem($js);
     $this->requireAsset('javascript', 'vivid-store');
     $this->requireAsset('css', 'vivid-store');
 }
Example #5
0
 public function loadFormAssets()
 {
     $pkg = Package::getByHandle('vivid_store');
     $pkgconfig = $pkg->getConfig();
     $this->set('pkgconfig', $pkgconfig);
     $this->addHeaderItem('<style type="text/css">.redactor_editor{padding:20px}</style>');
     $js = \Concrete\Package\VividStore\Controller::returnHeaderJS();
     $this->addFooterItem($js);
     $this->requireAsset('css', 'vividStoreDashboard');
     $this->requireAsset('javascript', 'vividStoreFunctions');
 }
Example #6
0
 public function view()
 {
     $customer = new StoreCustomer();
     if ($customer->getLastOrderID()) {
         $order = StoreOrder::getByID($customer->getLastOrderID());
     }
     if (is_object($order)) {
         $this->set("order", $order);
     } else {
         $this->redirect("/cart");
     }
     $this->requireAsset('javascript', 'jquery');
     $js = \Concrete\Package\VividStore\Controller::returnHeaderJS();
     $this->addFooterItem($js);
     $this->requireAsset('javascript', 'vivid-store');
     $this->requireAsset('css', 'vivid-store');
 }
Example #7
0
 public function view()
 {
     $sr = new SalesReport();
     $this->set('sr', $sr);
     $pkg = Package::getByHandle('vivid_store');
     $packagePath = $pkg->getRelativePath();
     $this->requireAsset('chartist');
     $today = date('Y-m-d');
     $thirtyDaysAgo = date('Y-m-d', strtotime('-30 days'));
     $this->set('defaultFromDate', $thirtyDaysAgo);
     $this->set('defaultToDate', $today);
     $dateFrom = $this->post('dateFrom');
     $dateTo = $this->post('dateTo');
     if (!$dateFrom) {
         $dateFrom = $thirtyDaysAgo;
     }
     if (!$dateTo) {
         $dateTo = $today;
     }
     $this->set('dateFrom', $dateFrom);
     $this->set('dateTo', $dateTo);
     $ordersTotals = $sr::getTotalsByRange($dateFrom, $dateTo);
     $this->set('ordersTotals', $ordersTotals);
     $orders = new OrderList();
     $orders->setFromDate($dateFrom);
     $orders->setToDate($dateTo);
     $orders->setItemsPerPage(10);
     $paginator = $orders->getPagination();
     $pagination = $paginator->renderDefaultView();
     $this->set('orders', $paginator->getCurrentPageResults());
     $this->set('pagination', $pagination);
     $this->set('paginator', $paginator);
     $js = \Concrete\Package\VividStore\Controller::returnHeaderJS();
     $this->addFooterItem($js);
     $this->requireAsset('css', 'vividStoreDashboard');
     $this->requireAsset('javascript', 'vividStoreFunctions');
 }
Example #8
0
 public function view()
 {
     $products = new StoreProductList();
     $sort = $this->sortOrder;
     if ($_GET['sort' . $this->bID]) {
         $sort = $_GET['sort' . $this->bID];
     }
     $products->setSortBy($sort);
     if ($this->filter == 'current' || $this->filter == 'current_children') {
         $page = Page::getCurrentPage();
         $products->setCID($page->getCollectionID());
         if ($this->filter == 'current_children') {
             $products->setCIDs($page->getCollectionChildrenArray());
         }
     }
     if ($this->filter == 'page' || $this->filter == 'page_children') {
         if ($this->filterCID) {
             $products->setCID($this->filterCID);
             if ($this->filter == 'page_children') {
                 $targetpage = Page::getByID($this->filterCID);
                 if ($targetpage) {
                     $products->setCIDs($targetpage->getCollectionChildrenArray());
                 }
             }
         }
     }
     $products->setItemsPerPage($this->maxProducts);
     $products->setGroupIDs($this->getGroupFilters());
     $products->setFeatureType($this->showFeatured);
     $products->setShowOutOfStock($this->showOutOfStock);
     $products->setGroupMatchAny($this->groupMatchAny);
     $paginator = $products->getPagination();
     $pagination = $paginator->renderDefaultView();
     $products = $paginator->getCurrentPageResults();
     foreach ($products as $product) {
         $product->setInitialVariation();
     }
     $this->set('sort', $sort);
     $this->set('products', $products);
     $this->set('pagination', $pagination);
     $this->set('paginator', $paginator);
     //load some helpers
     $this->set('ih', Core::make('helper/image'));
     $this->set('th', Core::make('helper/text'));
     $this->requireAsset("css", "font-awesome");
     $js = \Concrete\Package\VividStore\Controller::returnHeaderJS();
     $this->requireAsset('javascript', 'jquery');
     $this->addFooterItem($js);
     $this->requireAsset('javascript', 'vivid-store');
     $this->requireAsset('css', 'vivid-store');
 }